The problem is in DataTransform::sanitizeReferences():
function sanitizeReferences($row,$meta){ global $adb,$log; $references = $meta->getReferenceFieldDetails(); var_dump($references); foreach($references as $field=>$typeList){ if(strtolower($meta->getEntityName()) == "emails"){ if(isset($row['parent_id'])){ list($row['parent_id'], $fieldId) = explode('@', $row['parent_id']); } } if($row[$field]){ $found = false; foreach ($typeList as $entity) { $webserviceObject = VtigerWebserviceObject::fromName($adb,$entity); $handlerPath = $webserviceObject->getHandlerPath(); $handlerClass = $webserviceObject->getHandlerClass(); require_once $handlerPath; $handler = new $handlerClass($webserviceObject,$meta->getUser(),$adb,$log); $entityMeta = $handler->getMeta(); if($entityMeta->exists($row[$field])){ $row[$field] = vtws_getId($webserviceObject->getEntityId(),$row[$field]); $found = true; break; } } if($found !== true){ //This is needed as for query operation of the related record is deleted. $row[$field] = null; } //0 is the default for most of the reference fields, so handle the case and return null instead as its the //only valid value, which is not a reference Id. }elseif(isset($row[$field]) && $row[$field]==0){ $row[$field] = null; } } return $row; }
This line: $references = $meta->getReferenceFieldDetails(); returns something like this in the case of the Users module: