当前位置: 首页>>代码示例>>PHP>>正文


PHP CRMEntity::isBulkSaveMode方法代码示例

本文整理汇总了PHP中CRMEntity::isBulkSaveMode方法的典型用法代码示例。如果您正苦于以下问题:PHP CRMEntity::isBulkSaveMode方法的具体用法?PHP CRMEntity::isBulkSaveMode怎么用?PHP CRMEntity::isBulkSaveMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRMEntity的用法示例。


在下文中一共展示了CRMEntity::isBulkSaveMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 public function create($elementType, $element)
 {
     $crmObject = new VtigerCRMObject($elementType, false);
     $element = DataTransform::sanitizeForInsert($element, $this->meta);
     $error = $crmObject->create($element);
     if (!$error) {
         throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
     }
     $id = $crmObject->getObjectId();
     // Bulk Save Mode
     if (CRMEntity::isBulkSaveMode()) {
         // Avoiding complete read, as during bulk save mode, $result['id'] is enough
         return array('id' => vtws_getId($this->meta->getEntityId(), $id));
     }
     $error = $crmObject->read($id);
     if (!$error) {
         throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
     }
     return DataTransform::filterAndSanitize($crmObject->getFields(), $this->meta);
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:20,代码来源:VtigerModuleOperation.php

示例2: insertIntoEntityTable

 /** Function to insert values in the specifed table for the specified module
  * @param $table_name -- table name:: Type varchar
  * @param $module -- module:: Type varchar
  */
 function insertIntoEntityTable($table_name, $module, $fileid = '')
 {
     global $log;
     global $current_user, $app_strings;
     $log->info("function insertIntoEntityTable " . $module . ' vtiger_table name ' . $table_name);
     global $adb;
     $insertion_mode = $this->mode;
     //Checkin whether an entry is already is present in the vtiger_table to update
     if ($insertion_mode == 'edit') {
         $tablekey = $this->tab_name_index[$table_name];
         // Make selection on the primary key of the module table to check.
         $check_query = "select {$tablekey} from {$table_name} where {$tablekey}=?";
         $check_result = $adb->pquery($check_query, array($this->id));
         $num_rows = $adb->num_rows($check_result);
         if ($num_rows <= 0) {
             $insertion_mode = '';
         }
     }
     $tabid = getTabid($module);
     if ($module == 'Calendar' && $this->column_fields["activitytype"] != null && $this->column_fields["activitytype"] != 'Task') {
         $tabid = getTabid('Events');
     }
     if ($insertion_mode == 'edit') {
         $update = array();
         $update_params = array();
         checkFileAccessForInclusion('user_privileges/user_privileges_' . $current_user->id . '.php');
         require 'user_privileges/user_privileges_' . $current_user->id . '.php';
         if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
             $sql = "select * from vtiger_field where tabid in (" . generateQuestionMarks($tabid) . ") and tablename=? and displaytype in (1,3) and presence in (0,2) group by columnname";
             $params = array($tabid, $table_name);
         } else {
             $profileList = getCurrentUserProfileList();
             if (count($profileList) > 0) {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 AND vtiger_profile2field.readonly = 0\n\t\t\t  \t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $profileList, $table_name);
             } else {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 AND vtiger_profile2field.readonly = 0\n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $table_name);
             }
         }
     } else {
         $table_index_column = $this->tab_name_index[$table_name];
         if ($table_index_column == 'id' && $table_name == 'vtiger_users') {
             $currentuser_id = $adb->getUniqueID("vtiger_users");
             $this->id = $currentuser_id;
         }
         $column = array($table_index_column);
         $value = array($this->id);
         $sql = "select * from vtiger_field where tabid=? and tablename=? and displaytype in (1,3,4) and vtiger_field.presence in (0,2)";
         $params = array($tabid, $table_name);
     }
     // Attempt to re-use the quer-result to avoid reading for every save operation
     // TODO Need careful analysis on impact ... MEMORY requirement might be more
     static $_privatecache = array();
     $cachekey = "{$insertion_mode}-" . implode(',', $params);
     if (!isset($_privatecache[$cachekey])) {
         $result = $adb->pquery($sql, $params);
         $noofrows = $adb->num_rows($result);
         if (CRMEntity::isBulkSaveMode()) {
             $cacheresult = array();
             for ($i = 0; $i < $noofrows; ++$i) {
                 $cacheresult[] = $adb->fetch_array($result);
             }
             $_privatecache[$cachekey] = $cacheresult;
         }
     } else {
         // Useful when doing bulk save
         $result = $_privatecache[$cachekey];
         $noofrows = count($result);
     }
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldname = $this->resolve_query_result_value($result, $i, "fieldname");
         $columname = $this->resolve_query_result_value($result, $i, "columnname");
         $uitype = $this->resolve_query_result_value($result, $i, "uitype");
         $generatedtype = $this->resolve_query_result_value($result, $i, "generatedtype");
         $typeofdata = $this->resolve_query_result_value($result, $i, "typeofdata");
         $typeofdata_array = explode("~", $typeofdata);
         $datatype = $typeofdata_array[0];
         $ajaxSave = false;
         if ($_REQUEST['file'] == 'DetailViewAjax' && $_REQUEST['ajxaction'] == 'DETAILVIEW' && isset($_REQUEST["fldName"]) && $_REQUEST["fldName"] != $fieldname || $_REQUEST['action'] == 'MassEditSave' && !isset($_REQUEST[$fieldname . "_mass_edit_check"])) {
             $ajaxSave = true;
         }
         if ($uitype == 4 && $insertion_mode != 'edit') {
             $fldvalue = '';
             // Bulk Save Mode: Avoid generation of module sequence number, take care later.
             // SalesPlatform.ru begin: Added separate numbering for self organizations
             if (!CRMEntity::isBulkSaveMode()) {
                 $modules = array('Invoice', 'Act', 'Consignment');
                 if (in_array($module, $modules) && isset($this->column_fields['spcompany'])) {
                     $fldvalue = $this->setModuleSeqNumber("increment", $module, '', '', $this->column_fields['spcompany']);
                 } else {
                     $fldvalue = $this->setModuleSeqNumber("increment", $module);
                 }
                 //$fldvalue = $this->setModuleSeqNumber("increment", $module);
             }
             // SalesPlatform.ru end
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:101,代码来源:CRMEntity.php

示例3: insertIntoEntityTable

 function insertIntoEntityTable($table_name, $module, $fileid = '')
 {
     global $log;
     global $current_user, $app_strings;
     global $adb;
     $log->debug("Entering PaymentManagement::insertIntoEntityTable(" . $table_name . ", " . $module . ", " . $fileid . ") method ...");
     $value_table = array();
     $insertion_mode = $this->mode;
     //Checkin whether an entry is already is present in the vtiger_table to update
     if ($insertion_mode == 'edit') {
         $tablekey = $this->tab_name_index[$table_name];
         // Make selection on the primary key of the module table to check.
         $check_query = "select {$tablekey} from {$table_name} where {$tablekey}=?";
         $check_result = $adb->pquery($check_query, array($this->id));
         $num_rows = $adb->num_rows($check_result);
         if ($num_rows <= 0) {
             $insertion_mode = '';
         }
     }
     $tabid = getTabid($module);
     if ($insertion_mode == 'edit') {
         $update = array();
         $update_params = array();
         checkFileAccessForInclusion('user_privileges/user_privileges_' . $current_user->id . '.php');
         require 'user_privileges/user_privileges_' . $current_user->id . '.php';
         if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
             $sql = "select * from vtiger_field where tabid in (" . generateQuestionMarks($tabid) . ") and tablename=? and displaytype in (1,3) and presence in (0,2) group by columnname";
             $params = array($tabid, $table_name);
         } else {
             $profileList = getCurrentUserProfileList();
             if (count($profileList) > 0) {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 AND vtiger_profile2field.readonly = 0\n\t\t\t  \t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $profileList, $table_name);
             } else {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 AND vtiger_profile2field.readonly = 0\n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $table_name);
             }
         }
     } else {
         $table_index_column = $this->tab_name_index[$table_name];
         if ($table_index_column == 'id' && $table_name == 'vtiger_users') {
             $currentuser_id = $adb->getUniqueID("vtiger_users");
             $this->id = $currentuser_id;
         }
         $columname = $table_index_column;
         $fldvalue = $this->id;
         $column = array($table_index_column);
         $value = array($this->id);
         // vtiger_payment_management のインデックスを登録 (2015/11/26)
         $columname = $table_index_column;
         // tao
         $fldvalue = $this->id;
         // tao
         $value_table[$columname] = $fldvalue;
         // tao
         $sql = "select * from vtiger_field where tabid=? and tablename=? and displaytype in (1,3,4) and vtiger_field.presence in (0,2)";
         $params = array($tabid, $table_name);
     }
     // Attempt to re-use the quer-result to avoid reading for every save operation
     // TODO Need careful analysis on impact ... MEMORY requirement might be more
     static $_privatecache = array();
     $cachekey = "{$insertion_mode}-" . implode(',', $params);
     if (!isset($_privatecache[$cachekey])) {
         $result = $adb->pquery($sql, $params);
         $noofrows = $adb->num_rows($result);
         if (CRMEntity::isBulkSaveMode()) {
             $cacheresult = array();
             for ($i = 0; $i < $noofrows; ++$i) {
                 $cacheresult[] = $adb->fetch_array($result);
             }
             $_privatecache[$cachekey] = $cacheresult;
         }
     } else {
         // Useful when doing bulk save
         $result = $_privatecache[$cachekey];
         $noofrows = count($result);
     }
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldname = $this->resolve_query_result_value($result, $i, "fieldname");
         $columname = $this->resolve_query_result_value($result, $i, "columnname");
         $uitype = $this->resolve_query_result_value($result, $i, "uitype");
         $generatedtype = $this->resolve_query_result_value($result, $i, "generatedtype");
         $typeofdata = $this->resolve_query_result_value($result, $i, "typeofdata");
         $typeofdata_array = explode("~", $typeofdata);
         $datatype = $typeofdata_array[0];
         $ajaxSave = false;
         // uitype == 2
         if ($_REQUEST['file'] == 'DetailViewAjax' && $_REQUEST['ajxaction'] == 'DETAILVIEW' && isset($_REQUEST["fldName"]) && $_REQUEST["fldName"] != $fieldname || $_REQUEST['action'] == 'MassEditSave' && !isset($_REQUEST[$fieldname . "_mass_edit_check"])) {
             $ajaxSave = true;
         }
         if ($uitype == 4 && $insertion_mode != 'edit') {
             $fldvalue = '';
             // Bulk Save Mode: Avoid generation of module sequence number, take care later.
             if (!CRMEntity::isBulkSaveMode()) {
                 $fldvalue = $this->setModuleSeqNumber("increment", $module);
             }
             $this->column_fields[$fieldname] = $fldvalue;
         }
         if (isset($this->column_fields[$fieldname])) {
             if ($uitype == 56) {
//.........这里部分代码省略.........
开发者ID:cin-system,项目名称:cinrepo,代码行数:101,代码来源:PaymentManagement.php

示例4: vtws_listtypes

function vtws_listtypes($fieldTypeList, $user)
{
    // Bulk Save Mode: For re-using information
    static $webserviceEntities = false;
    // END
    static $types = array();
    if (!empty($fieldTypeList)) {
        $fieldTypeList = array_map(strtolower, $fieldTypeList);
        sort($fieldTypeList);
        $fieldTypeString = implode(',', $fieldTypeList);
    } else {
        $fieldTypeString = 'all';
    }
    if (!empty($types[$user->id][$fieldTypeString])) {
        return $types[$user->id][$fieldTypeString];
    }
    try {
        global $log;
        /**
         * @var PearDatabase
         */
        $db = PearDatabase::getInstance();
        vtws_preserveGlobal('current_user', $user);
        //get All the modules the current user is permitted to Access.
        $allModuleNames = getPermittedModuleNames();
        if (array_search('Calendar', $allModuleNames) !== false) {
            array_push($allModuleNames, 'Events');
        }
        if (!empty($fieldTypeList)) {
            $sql = "SELECT distinct(vtiger_field.tabid) as tabid FROM vtiger_field LEFT JOIN vtiger_ws_fieldtype ON " . "vtiger_field.uitype=vtiger_ws_fieldtype.uitype\n\t\t\t\t INNER JOIN vtiger_profile2field ON vtiger_field.fieldid = vtiger_profile2field.fieldid\n\t\t\t\t INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t\t INNER JOIN vtiger_role2profile ON vtiger_profile2field.profileid = vtiger_role2profile.profileid\n\t\t\t\t INNER JOIN vtiger_user2role ON vtiger_user2role.roleid = vtiger_role2profile.roleid\n\t\t\t\t where vtiger_profile2field.visible=0 and vtiger_def_org_field.visible = 0\n\t\t\t\t and vtiger_field.presence in (0,2)\n\t\t\t\t and vtiger_user2role.userid=? and fieldtype in (" . generateQuestionMarks($fieldTypeList) . ')';
            $params = array();
            $params[] = $user->id;
            foreach ($fieldTypeList as $fieldType) {
                $params[] = $fieldType;
            }
            $result = $db->pquery($sql, $params);
            $it = new SqlResultIterator($db, $result);
            $moduleList = array();
            foreach ($it as $row) {
                $moduleList[] = getTabModuleName($row->tabid);
            }
            $allModuleNames = array_intersect($moduleList, $allModuleNames);
            $params = $fieldTypeList;
            $sql = "select name from vtiger_ws_entity inner join vtiger_ws_entity_tables on " . "vtiger_ws_entity.id=vtiger_ws_entity_tables.webservice_entity_id inner join " . "vtiger_ws_entity_fieldtype on vtiger_ws_entity_fieldtype.table_name=" . "vtiger_ws_entity_tables.table_name where fieldtype=(" . generateQuestionMarks($fieldTypeList) . ')';
            $result = $db->pquery($sql, $params);
            $it = new SqlResultIterator($db, $result);
            $entityList = array();
            foreach ($it as $row) {
                $entityList[] = $row->name;
            }
        }
        //get All the CRM entity names.
        if ($webserviceEntities === false || !CRMEntity::isBulkSaveMode()) {
            // Bulk Save Mode: For re-using information
            $webserviceEntities = vtws_getWebserviceEntities();
        }
        $accessibleModules = array_values(array_intersect($webserviceEntities['module'], $allModuleNames));
        $entities = $webserviceEntities['entity'];
        $accessibleEntities = array();
        if (empty($fieldTypeList)) {
            foreach ($entities as $entity) {
                $webserviceObject = VtigerWebserviceObject::fromName($db, $entity);
                $handlerPath = $webserviceObject->getHandlerPath();
                $handlerClass = $webserviceObject->getHandlerClass();
                require_once $handlerPath;
                $handler = new $handlerClass($webserviceObject, $user, $db, $log);
                $meta = $handler->getMeta();
                if ($meta->hasAccess() === true) {
                    array_push($accessibleEntities, $entity);
                }
            }
        }
    } catch (WebServiceException $exception) {
        throw $exception;
    } catch (Exception $exception) {
        throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "An Database error occured while performing the operation");
    }
    $default_language = VTWS_PreserveGlobal::getGlobal('default_language');
    global $current_language;
    if (empty($current_language)) {
        $current_language = $default_language;
    }
    $current_language = vtws_preserveGlobal('current_language', $current_language);
    $appStrings = return_application_language($current_language);
    $appListString = return_app_list_strings_language($current_language);
    vtws_preserveGlobal('app_strings', $appStrings);
    vtws_preserveGlobal('app_list_strings', $appListString);
    $informationArray = array();
    foreach ($accessibleModules as $module) {
        $vtigerModule = $module == 'Events' ? 'Calendar' : $module;
        $informationArray[$module] = array('isEntity' => true, 'label' => getTranslatedString($module, $vtigerModule), 'singular' => getTranslatedString('SINGLE_' . $module, $vtigerModule));
    }
    foreach ($accessibleEntities as $entity) {
        $label = isset($appStrings[$entity]) ? $appStrings[$entity] : $entity;
        $singular = isset($appStrings['SINGLE_' . $entity]) ? $appStrings['SINGLE_' . $entity] : $entity;
        $informationArray[$entity] = array('isEntity' => false, 'label' => $label, 'singular' => $singular);
    }
    VTWS_PreserveGlobal::flush();
    $types[$user->id][$fieldTypeString] = array("types" => array_merge($accessibleModules, $accessibleEntities), 'information' => $informationArray);
    return $types[$user->id][$fieldTypeString];
//.........这里部分代码省略.........
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:101,代码来源:ModuleTypes.php

示例5: retrieveMetaForBlock

 private function retrieveMetaForBlock($block)
 {
     global $adb;
     $tabid = $this->getTabId();
     require 'user_privileges/user_privileges_' . $this->user->id . '.php';
     if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
         $sql = "select *, '0' as readonly from vtiger_field where tabid =? and block in (" . generateQuestionMarks($block) . ") and displaytype in (1,2,3,4)";
         $params = array($tabid, $block);
     } else {
         $profileList = getCurrentUserProfileList();
         if (count($profileList) > 0) {
             $sql = "SELECT vtiger_field.*, vtiger_profile2field.readonly\n\t\t\t\t\t\tFROM vtiger_field\n\t\t\t\t\t\tINNER JOIN vtiger_profile2field\n\t\t\t\t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t\t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t\t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t\t\t\tWHERE vtiger_field.tabid =? AND vtiger_profile2field.visible = 0 \n\t\t\t\t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\n\t\t\t\t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3,4) and vtiger_field.presence in (0,2) group by columnname";
             $params = array($tabid, $profileList, $block);
         } else {
             $sql = "SELECT vtiger_field.*, vtiger_profile2field.readonly\n\t\t\t\t\t\tFROM vtiger_field\n\t\t\t\t\t\tINNER JOIN vtiger_profile2field\n\t\t\t\t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t\t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t\t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t\t\t\tWHERE vtiger_field.tabid=? \n\t\t\t\t\t\tAND vtiger_profile2field.visible = 0 \n\t\t\t\t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3,4) and vtiger_field.presence in (0,2) group by columnname";
             $params = array($tabid, $block);
         }
     }
     // Bulk Save Mode: Group by is not required!?
     if (CRMEntity::isBulkSaveMode()) {
         $sql = preg_replace("/group by [^ ]*/", " ", $sql);
     }
     // END
     $result = $adb->pquery($sql, $params);
     $noofrows = $adb->num_rows($result);
     $referenceArray = array();
     $knownFieldArray = array();
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldname = $adb->query_result($result, $i, "fieldname");
         if (strcasecmp($fieldname, 'imagename') === 0) {
             continue;
         }
         $webserviceField = WebserviceField::fromQueryResult($adb, $result, $i);
         $this->moduleFields[$webserviceField->getFieldName()] = $webserviceField;
     }
 }
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:36,代码来源:VtigerCRMObjectMeta.php

示例6: saveInventoryData

 /**
  * Save the inventory data
  */
 public function saveInventoryData()
 {
     //Event triggering code
     require_once "include/events/include.inc";
     $db = PearDatabase::getInstance();
     $log = vglobal('log');
     $log->debug('Entering ' . __CLASS__ . '::' . __METHOD__);
     $moduleName = $this->getModuleName();
     $inventory = Vtiger_InventoryField_Model::getInstance($moduleName);
     $table = $inventory->getTableName('data');
     if ($this->has('inventoryData')) {
         $request = $this->get('inventoryData');
     } else {
         $request = new Vtiger_Request($_REQUEST, $_REQUEST);
     }
     $numRow = $request->get('inventoryItemsNo');
     //In Bulk mode stop triggering events
     if (!CRMEntity::isBulkSaveMode()) {
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $em->triggerEvent('entity.inventory.beforesave', [$this, $inventory, $this->inventoryData]);
     }
     $db->delete($table, 'id = ?', [$this->getId()]);
     foreach ($this->inventoryData as $insertData) {
         $insertData['id'] = $this->getId();
         $db->insert($table, $insertData);
     }
     if ($em) {
         //Event triggering code
         $em->triggerEvent('entity.inventory.aftersave', [$this, $inventory, $this->inventoryData]);
     }
     $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:37,代码来源:Record.php

示例7: saveInventoryData

 /**
  * Save the inventory data
  */
 public function saveInventoryData()
 {
     //Event triggering code
     require_once "include/events/include.inc";
     $db = PearDatabase::getInstance();
     $log = vglobal('log');
     $log->debug('Entering ' . __CLASS__ . '::' . __METHOD__);
     $moduleName = $this->getModuleName();
     $inventory = Vtiger_InventoryField_Model::getInstance($moduleName);
     $fields = $inventory->getColumns();
     $table = $inventory->getTableName('data');
     $summaryFields = $inventory->getSummaryFields();
     $insertDataTemp = $summary = [];
     $request = new Vtiger_Request($_REQUEST, $_REQUEST);
     $numRow = $request->get('inventoryItemsNo');
     //In Bulk mode stop triggering events
     if (!CRMEntity::isBulkSaveMode()) {
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $em->triggerEvent('entity.inventory.beforesave', [$this, $inventory]);
     }
     $db->pquery("delete from {$table} where id = ?", [$this->getId()]);
     for ($i = 1; $i <= $numRow; $i++) {
         if (!$request->has(reset($fields)) && !$request->has(reset($fields) . $i)) {
             continue;
         }
         $insertData = ['id' => $this->getId(), 'seq' => $request->get('seq' . $i)];
         foreach ($fields as $field) {
             $value = $insertData[$field] = $inventory->getValueForSave($request, $field, $i);
             if (in_array($field, $summaryFields)) {
                 $summary[$field] += $value;
             }
         }
         $db->insert($table, $insertData);
         $insertDataTemp[] = $insertData;
     }
     foreach ($summary as $fieldName => $fieldValue) {
         if ($this->has($fieldName)) {
             $this->set($fieldName, CurrencyField::convertToUserFormat($fieldValue, null, true));
         }
     }
     if ($em) {
         //Event triggering code
         $em->triggerEvent('entity.inventory.aftersave', [$this, $inventory, $insertDataTemp, $summary]);
     }
     $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__);
 }
开发者ID:ecommercepoint,项目名称:YetiForceCRM,代码行数:51,代码来源:Record.php


注:本文中的CRMEntity::isBulkSaveMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。