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


PHP Vtiger_Record_Model::getInstanceById方法代码示例

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


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

示例1: populateTo

 public function populateTo($request)
 {
     $viewer = $this->getViewer($request);
     $inventoryRecordId = $request->get('record');
     $recordModel = Vtiger_Record_Model::getInstanceById($inventoryRecordId, $request->getModule());
     $inventoryModule = $recordModel->getModule();
     $inventotyfields = $inventoryModule->getFields();
     $toEmailConsiderableFields = array('contact_id', 'account_id', 'vendor_id');
     $db = PearDatabase::getInstance();
     $to = array();
     $to_info = array();
     $toMailNamesList = array();
     foreach ($toEmailConsiderableFields as $fieldName) {
         if (!array_key_exists($fieldName, $inventotyfields)) {
             continue;
         }
         $fieldModel = $inventotyfields[$fieldName];
         if (!$fieldModel->isViewable()) {
             continue;
         }
         $fieldValue = $recordModel->get($fieldName);
         if (empty($fieldValue)) {
             continue;
         }
         $referenceList = $fieldModel->getReferenceList();
         $referenceModule = $referenceList[0];
         $fieldLabel = Vtiger_Util_Helper::getLabel($fieldValue);
         $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModule);
         $emailFields = $referenceModuleModel->getFieldsByType('email');
         if (count($emailFields) <= 0) {
             continue;
         }
         $current_user = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($referenceModule, $current_user);
         $queryGenerator->setFields(array_keys($emailFields));
         $query = $queryGenerator->getQuery();
         $query .= ' AND crmid = ' . $fieldValue;
         $result = $db->pquery($query, array());
         $num_rows = $db->num_rows($result);
         if ($num_rows <= 0) {
             continue;
         }
         foreach ($emailFields as $fieldName => $emailFieldModel) {
             $emailValue = $db->query_result($result, 0, $fieldName);
             if (!empty($emailValue)) {
                 $to[] = $emailValue;
                 $to_info[$fieldValue][] = $emailValue;
                 $toMailNamesList[$fieldValue][] = array('label' => $fieldLabel, 'value' => $emailValue);
                 break;
             }
         }
         if (!empty($to)) {
             break;
         }
     }
     $viewer->assign('TO', $to);
     $viewer->assign('TOMAIL_NAMES_LIST', $toMailNamesList);
     $viewer->assign('TOMAIL_INFO', $to_info);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:59,代码来源:SendEmail.php

示例2: process

 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $recordModel = $this->record;
     if (!$recordModel) {
         if (!empty($recordId)) {
             $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         }
         $this->record = $recordModel;
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails());
     $salutationFieldModel = Vtiger_Field_Model::getInstance('salutationtype', $recordModel->getModule());
     // Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7851
     $salutationType = $request->get('salutationtype');
     if (!empty($salutationType)) {
         $salutationFieldModel->set('fieldvalue', $request->get('salutationtype'));
     } else {
         $salutationFieldModel->set('fieldvalue', $recordModel->get('salutationtype'));
     }
     $viewer->assign('SALUTATION_FIELD_MODEL', $salutationFieldModel);
     parent::process($request);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:Edit.php

示例3: postpone

 function postpone(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $module = $request->getModule();
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $module);
     $recordModel->updateReminderStatus(0);
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:7,代码来源:ActivityReminder.php

示例4: process

 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $currencyName = $request->get('currency');
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $priceDetails = $recordModel->getPriceDetails();
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $priceDetails = $recordModel->getPriceDetails();
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $baseCurrencyConversionRate = $currencyDetails['conversionrate'];
                 break;
             }
         }
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $currencyDetails['conversionrate'] = 1;
                 $currencyDetails['is_basecurrency'] = 1;
             } else {
                 $currencyDetails['conversionrate'] = $currencyDetails['conversionrate'] / $baseCurrencyConversionRate;
                 $currencyDetails['is_basecurrency'] = 0;
             }
             $priceDetails[$key] = $currencyDetails;
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('PRICE_DETAILS', $priceDetails);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('MoreCurrenciesList.tpl', 'Products');
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:34,代码来源:MoreCurrenciesList.php

示例5: process

 /**
  * Function that saves SMS records
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $recordIds = $this->getRecordsListFromRequest($request);
     $phoneFieldList = $request->get('fields');
     $message = $request->get('message');
     foreach ($recordIds as $recordId) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
         $numberSelected = false;
         foreach ($phoneFieldList as $fieldname) {
             $fieldValue = $recordModel->get($fieldname);
             if (!empty($fieldValue)) {
                 $toNumbers[] = $fieldValue;
                 $numberSelected = true;
             }
         }
         if ($numberSelected) {
             $recordIds[] = $recordId;
         }
     }
     $response = new Vtiger_Response();
     if (!empty($toNumbers)) {
         SMSNotifier_Record_Model::SendSMS($message, $toNumbers, $currentUserModel->getId(), $recordIds, $moduleName);
         $response->setResult(true);
     } else {
         $response->setResult(false);
     }
     return $response;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:34,代码来源:MassSaveAjax.php

示例6: process

 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $records = $request->get('records');
     $primaryRecord = $request->get('primaryRecord');
     $primaryRecordModel = Vtiger_Record_Model::getInstanceById($primaryRecord, $moduleName);
     $fields = $moduleModel->getFields();
     foreach ($fields as $field) {
         $fieldValue = $request->get($field->getName());
         if ($field->isEditable()) {
             $primaryRecordModel->set($field->getName(), $fieldValue);
         }
     }
     $primaryRecordModel->set('mode', 'edit');
     $primaryRecordModel->save();
     $deleteRecords = array_diff($records, array($primaryRecord));
     foreach ($deleteRecords as $deleteRecord) {
         $recordPermission = Users_Privileges_Model::isPermitted($moduleName, 'Delete', $deleteRecord);
         if ($recordPermission) {
             $primaryRecordModel->transferRelationInfoOfRecords(array($deleteRecord));
             $record = Vtiger_Record_Model::getInstanceById($deleteRecord);
             $record->delete();
         }
     }
     $response = new Vtiger_Response();
     $response->setResult(true);
     $response->emit();
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:29,代码来源:ProcessDuplicates.php

示例7: getRecordModelFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 public function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
         $fieldModelList = $recordModel->getModule()->getFields();
         foreach ($fieldModelList as $fieldName => $fieldModel) {
             //For not converting craetedtime and modified time to user format
             $uiType = $fieldModel->get('uitype');
             if ($uiType == 70) {
                 $fieldValue = $recordModel->get($fieldName);
             } elseif (in_array($uiType, [71, 72])) {
                 // currency ui types
                 $fieldValue = $recordModel->get($fieldName);
             } else {
                 $fieldValue = $fieldModel->getUITypeModel()->getUserRequestValue($recordModel->get($fieldName), $recordId);
             }
             if ($fieldName === $request->get('field')) {
                 $fieldValue = $request->get('value');
             }
             $fieldDataType = $fieldModel->getFieldDataType();
             if ($fieldDataType == 'time') {
                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
             }
             if ($fieldValue !== null) {
                 if (!is_array($fieldValue)) {
                     $fieldValue = trim($fieldValue);
                 }
                 $recordModel->set($fieldName, $fieldValue);
             }
             $recordModel->set($fieldName, $fieldValue);
         }
     } else {
         $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $recordModel->set('mode', '');
         $fieldModelList = $moduleModel->getFields();
         foreach ($fieldModelList as $fieldName => $fieldModel) {
             if ($request->has($fieldName)) {
                 $fieldValue = $request->get($fieldName, null);
             } else {
                 $fieldValue = $fieldModel->getDefaultFieldValue();
             }
             $fieldDataType = $fieldModel->getFieldDataType();
             if ($fieldDataType == 'time') {
                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
             }
             if ($fieldValue !== null) {
                 if (!is_array($fieldValue)) {
                     $fieldValue = trim($fieldValue);
                 }
                 $recordModel->set($fieldName, $fieldValue);
             }
         }
     }
     return $recordModel;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:65,代码来源:SaveAjax.php

示例8: process

 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $records = $request->get('records');
     $template = $request->get('template');
     $targetModuleName = $request->get('target');
     $method = $request->get('method');
     $success = [];
     if (!empty($template)) {
         $templateRecord = Vtiger_MappedFields_Model::getInstanceById($template);
         foreach ($records as $recordId) {
             if ($templateRecord->checkFiltersForRecord(intval($recordId))) {
                 if ($method == 0) {
                     $recordModel = Vtiger_Record_Model::getCleanInstance($targetModuleName);
                     $parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId);
                     $recordModel->setRecordFieldValues($parentRecordModel);
                     if ($this->checkMandatoryFields($recordModel)) {
                         continue;
                     }
                     // TODO Add saving fields that exist in  advanced module
                     $recordModel->save();
                     if (isRecordExists($recordModel->getId())) {
                         $success[] = $recordId;
                     }
                 } else {
                     $success[] = $recordId;
                 }
             }
         }
     }
     $output = ['all' => count($records), 'ok' => $success, 'fail' => array_diff($records, $success)];
     $response = new Vtiger_Response();
     $response->setResult($output);
     $response->emit();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:35,代码来源:GenerateRecords.php

示例9: process

 function process(Vtiger_Request $request)
 {
     $currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     $viewer = $this->getViewer($request);
     $recordId = $request->get('record');
     $moduleName = $request->getModule();
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
     $moduleModel = $recordModel->getModule();
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);
     $viewer->assign('RECORD', $recordModel);
     $viewer->assign('CONVERT_LEAD_FIELDS', $recordModel->getConvertLeadFields());
     $assignedToFieldModel = $moduleModel->getField('assigned_user_id');
     $assignedToFieldModel->set('fieldvalue', $recordModel->get('assigned_user_id'));
     $viewer->assign('ASSIGN_TO', $assignedToFieldModel);
     $potentialModuleModel = Vtiger_Module_Model::getInstance('Potentials');
     $accountField = Vtiger_Field_Model::getInstance('related_to', $potentialModuleModel);
     $contactField = Vtiger_Field_Model::getInstance('contact_id', $potentialModuleModel);
     $viewer->assign('ACCOUNT_FIELD_MODEL', $accountField);
     $viewer->assign('CONTACT_FIELD_MODEL', $contactField);
     $contactsModuleModel = Vtiger_Module_Model::getInstance('Contacts');
     $accountField = Vtiger_Field_Model::getInstance('parent_id', $contactsModuleModel);
     $viewer->assign('CONTACT_ACCOUNT_FIELD_MODEL', $accountField);
     $state = Settings_Leads_ConvertToAccount_Model::getState();
     $viewer->assign('STATE', $state);
     $viewer->view('ConvertLead.tpl', $moduleName);
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:28,代码来源:ConvertLead.php

示例10: updateEvent

 public function updateEvent(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('id');
     $date_start = date('Y-m-d', strtotime($request->get('start')));
     $time_start = date('H:i:s', strtotime($request->get('start')));
     $succes = false;
     if (isPermitted($moduleName, 'EditView', $recordId) === 'no') {
         $succes = false;
     } else {
         if (!empty($recordId)) {
             try {
                 $delta = $request->get('delta');
                 $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
                 $recordData = $recordModel->entity->column_fields;
                 $end = self::changeDateTime($recordData['due_date'] . ' ' . $recordData['time_end'], $delta);
                 $due_date = $end['date'];
                 $time_end = $end['time'];
                 $recordModel->set('id', $recordId);
                 $recordModel->set('mode', 'edit');
                 $recordModel->set('date_start', $date_start);
                 $recordModel->set('time_start', $time_start);
                 $recordModel->set('due_date', $due_date);
                 $recordModel->set('time_end', $time_end);
                 $recordModel->save();
                 $succes = true;
             } catch (Exception $e) {
                 $succes = false;
             }
         }
     }
     $response = new Vtiger_Response();
     $response->setResult($succes);
     $response->emit();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:35,代码来源:Calendar.php

示例11: process

 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $relatedLoad = $request->get('relatedLoad');
     $data = '';
     if ($relatedLoad) {
         $postData = $request->get('postData');
         $relatedModuleName = $request->get('relatedModuleName');
         $selected_ids = json_decode($postData['selected_ids'], true);
         $OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
         $data = $OSSMailModel->getEmailsFromModule($selected_ids, $relatedModuleName);
     } else {
         $selectedFields = $request->get('selectedFields');
         $selected_ids = $request->get('selected_ids');
         foreach ($selected_ids as $key => $value) {
             $recordModel = Vtiger_Record_Model::getInstanceById($value);
             if ($data == '') {
                 $data = $recordModel->get($selectedFields[$key]);
             } else {
                 $data .= ',' . $recordModel->get($selectedFields[$key]);
             }
         }
     }
     $result = array('success' => true, 'data' => $data);
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:28,代码来源:GetEmail.php

示例12: createFile

 /**
  * Creates a new file in the directory
  *
  * Data will either be supplied as a stream resource, or in certain cases
  * as a string. Keep in mind that you may have to support either.
  *
  * After successful creation of the file, you may choose to return the ETag
  * of the new file here.
  *
  * The returned ETag must be surrounded by double-quotes (The quotes should
  * be part of the actual string).
  *
  * If you cannot accurately determine the ETag, you should not return it.
  * If you don't store the file exactly as-is (you're transforming it
  * somehow) you should also not return an ETag.
  *
  * This means that if a subsequent GET to this new file does not exactly
  * return the same contents of what was submitted here, you are strongly
  * recommended to omit the ETag.
  *
  * @param string $name Name of the file
  * @param resource|string $data Initial payload
  * @return null|string
  */
 function createFile($name, $data = null)
 {
     include_once 'include/main/WebUI.php';
     global $log, $adb, $current_user;
     $adb = \PearDatabase::getInstance();
     $log = \LoggerManager::getLogger('DavToCRM');
     $user = new \Users();
     $current_user = $user->retrieveCurrentUserInfoFromFile($this->exData->crmUserId);
     $path = trim($this->path, 'files') . '/' . $name;
     $hash = sha1($path);
     $pathParts = pathinfo($path);
     $localPath = $this->localPath . $name;
     $stmt = $this->exData->pdo->prepare('SELECT crmid, smownerid, deleted FROM vtiger_files INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_files.filesid WHERE vtiger_files.hash = ?;');
     $stmt->execute([$hash]);
     $rows = $stmt->fetch(\PDO::FETCH_ASSOC);
     if ($rows != false && ($rows['smownerid'] != $this->exData->crmUserId || $rows['deleted'] == 1)) {
         throw new DAV\Exception\Conflict('File with name ' . $file . ' could not be located');
     }
     file_put_contents($this->exData->localStorageDir . $localPath, $data);
     if ($rows) {
         $rekord = \Vtiger_Record_Model::getInstanceById($rows['crmid'], 'Files');
         $rekord->set('mode', 'edit');
     } else {
         $rekord = \Vtiger_Record_Model::getCleanInstance('Files');
         $rekord->set('assigned_user_id', $this->exData->crmUserId);
     }
     $rekord->set('title', $pathParts['filename']);
     $rekord->set('name', $pathParts['filename']);
     $rekord->set('path', $localPath);
     $rekord->save();
     $id = $rekord->getId();
     $stmt = $this->exData->pdo->prepare('UPDATE vtiger_files SET dirid=?,extension=?,size=?,hash=?,ctime=? WHERE filesid=?;');
     $stmt->execute([$this->dirid, $pathParts['extension'], filesize($this->exData->localStorageDir . $localPath), $hash, date('Y-m-d H:i:s'), $id]);
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:58,代码来源:WebDAV_Directory.php

示例13: process

 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record) && $request->get('isDuplicate') == true) {
         $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
         $viewer->assign('MODE', '');
     } else {
         if (!empty($record)) {
             $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
             $viewer->assign('RECORD_ID', $record);
             $viewer->assign('MODE', 'edit');
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $viewer->assign('MODE', '');
             $parentId = $request->get('parentId');
             $parentModule = $request->get('parentModule');
             if ($parentId && $parentModule === 'HelpDesk') {
                 $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $parentModule);
                 $recordModel = Faq_Record_Model::getInstanceFromHelpDesk($parentRecordModel);
             }
         }
     }
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         if ($fieldModel->isEditable()) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $viewMode = $request->get('view_mode');
     if (!empty($viewMode)) {
         $viewer->assign('VIEW_MODE', $viewMode);
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('RECORD', $recordModel);
     $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     if ($isRelationOperation) {
         $viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
         $viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
     }
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     $viewer->view('EditView.tpl', $moduleName);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:60,代码来源:Edit.php

示例14: getRecordModelsFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 public function getRecordModelsFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $recordIds = $this->getRecordsListFromRequest($request);
     $recordModels = array();
     $fieldModelList = $moduleModel->getFields();
     foreach ($recordIds as $recordId) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
         foreach ($fieldModelList as $fieldName => $fieldModel) {
             $fieldValue = $request->get($fieldName, null);
             $fieldDataType = $fieldModel->getFieldDataType();
             if ($fieldDataType == 'time') {
                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
             } else {
                 if ($fieldDataType === 'date') {
                     $fieldValue = $fieldModel->getUITypeModel()->getDBInsertValue($fieldValue);
                 }
             }
             if (isset($fieldValue) && $fieldValue != null && !is_array($fieldValue)) {
                 $fieldValue = trim($fieldValue);
                 $recordModel->set($fieldName, $fieldValue);
             }
         }
         $recordModels[$recordId] = $recordModel;
     }
     return $recordModels;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:35,代码来源:MassSave.php

示例15: markAsHeldCompleted

 public function markAsHeldCompleted(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
     $recordModel->set('mode', 'edit');
     $activityType = $recordModel->get('activitytype');
     $response = new Vtiger_Response();
     if ($activityType == 'Task') {
         $status = 'Completed';
         $recordModel->set('taskstatus', $status);
         $result = array("valid" => TRUE, "markedascompleted" => TRUE, "activitytype" => "Task");
     } else {
         //checking if the event can be marked as Held (status validation)
         $startDateTime[] = $recordModel->get('date_start');
         $startDateTime[] = $recordModel->get('time_start');
         $startDateTime = implode(' ', $startDateTime);
         $startDateTime = new DateTime($startDateTime);
         $currentDateTime = date("Y-m-d H:i:s");
         $currentDateTime = new DateTime($currentDateTime);
         if ($startDateTime > $currentDateTime) {
             $result = array("valid" => FALSE, "markedascompleted" => FALSE);
             $response->setResult($result);
             $response->emit();
             return;
         }
         $status = 'Held';
         $recordModel->set('eventstatus', $status);
         $result = array("valid" => TRUE, "markedascompleted" => TRUE, "activitytype" => "Event");
     }
     $recordModel->save();
     $response->setResult($result);
     $response->emit();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:34,代码来源:SaveFollowupAjax.php


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