示例#1
0
 function sanitizeData($newRow, $meta, $t = null)
 {
     $newRow = DataTransform::sanitizeReferences($newRow, $meta);
     $newRow = DataTransform::sanitizeOwnerFields($newRow, $meta, $t);
     $newRow = DataTransform::sanitizeFields($newRow, $meta);
     return $newRow;
 }
示例#2
0
 static function sanitizeData($newRow, $meta, $t = null)
 {
     $newRow = DataTransform::sanitizeReferences($newRow, $meta);
     $newRow = DataTransform::sanitizeOwnerFields($newRow, $meta, $t);
     $newRow = DataTransform::sanitizeFields($newRow, $meta);
     //$newRow = DataTransform::sanitizeCurrencyFieldsForDisplay($newRow,$meta);
     return $newRow;
 }
示例#3
0
function vtws_createEntity($recordid, $originMod, $targetMod)
{
    global $adb, $current_user, $log;
    $return = 0;
    $newEntityInfo = CRMEntity::getInstance($targetMod);
    $mapfound = false;
    foreach ($originMod as $modName) {
        if ($recordid[$modName]) {
            $oldEntityInfo = CRMEntity::getInstance($modName);
            $oldEntityInfo->retrieve_entity_info(vtws_getIdComponents($recordid[$modName])[1], $modName);
            $map_name = $modName . '2' . $targetMod;
            $cbMapid = GlobalVariable::getVariable('BusinessMapping_' . $map_name, cbMap::getMapIdByName($map_name));
            if ($cbMapid) {
                $mapfound = true;
                $cbMap = cbMap::getMapByID($cbMapid);
                $newEntityInfo->column_fields = $cbMap->Mapping($oldEntityInfo->column_fields, $newEntityInfo->column_fields);
            }
        }
    }
    if ($mapfound) {
        try {
            $webserviceObject = VtigerWebserviceObject::fromName($adb, $targetMod);
            $handlerPath = $webserviceObject->getHandlerPath();
            $handlerClass = $webserviceObject->getHandlerClass();
            require_once $handlerPath;
            $handler = new $handlerClass($webserviceObject, $current_user, $adb, $log);
            $meta = $handler->getMeta();
            $values = DataTransform::sanitizeReferences($newEntityInfo->column_fields, $meta);
            $values = DataTransform::sanitizeOwnerFields($values, $meta);
            $return = vtws_create($targetMod, $values, $current_user);
        } catch (Exception $e) {
            throw new WebServiceException(WebServiceErrorCode::$UNKNOWNOPERATION, $e->getMessage() . ' : ' . $targetMod);
        }
    }
    return $return;
}