本文整理汇总了PHP中Vtiger_Util_Helper::checkRecordExistance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::checkRecordExistance方法的具体用法?PHP Vtiger_Util_Helper::checkRecordExistance怎么用?PHP Vtiger_Util_Helper::checkRecordExistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::checkRecordExistance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $this->getModule($request);
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
$relatedParentModule = $request->get('related_parent_module');
$relatedParentId = $request->get('related_parent_id');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
//Check whether the request is in multi select mode
$multiSelectMode = $request->get('multi_select');
if (empty($multiSelectMode)) {
$multiSelectMode = false;
}
if (empty($cvId)) {
$cvId = '0';
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (vglobal('popupAjax')) {
$pagingModel->set('noLimit', true);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$isRecordExists = Vtiger_Util_Helper::checkRecordExistance($relatedParentId);
if ($isRecordExists) {
$relatedParentModule = '';
$relatedParentId = '';
} else {
if ($isRecordExists === NULL) {
$relatedParentModule = '';
$relatedParentId = '';
}
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($relatedParentId, $relatedParentModule);
$listViewModel = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $moduleName, $label);
} else {
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
}
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$orderBy = $moduleInstance->default_order_by;
$sortOrder = $moduleInstance->default_sort_order;
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
$searchParmams = $request->get('search_params');
if (empty($searchParmams)) {
$searchParmams = array();
}
$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParmams, $moduleModel);
$listViewModel->set('search_params', $transformedSearchParams);
//To make smarty to get the details easily accesible
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$this->listViewHeaders = $listViewModel->getHeaders();
$models = $listViewModel->getEntries($pagingModel);
$noOfEntries = count($models);
foreach ($models as $recordId => $recordModel) {
foreach ($this->listViewHeaders as $fieldName => $fieldModel) {
$recordModel->set($fieldName, $recordModel->getDisplayValue($fieldName));
}
$models[$recordId] = $recordModel;
}
$this->listViewEntries = $models;
if (count($this->listViewEntries) > 0) {
$parent_related_records = true;
}
} else {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
//.........这里部分代码省略.........
示例2: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
$sourceRecord = $request->get('sourceRecord');
$sourceModule = $request->get('sourceModule');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('MODE', '');
//While Duplicating record, If the related record is deleted then we are removing related record info in record model
$mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
foreach ($mandatoryFieldModels as $fieldModel) {
if ($fieldModel->isReferenceField()) {
$fieldName = $fieldModel->get('name');
if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
$recordModel->set($fieldName, '');
}
}
}
} elseif (!empty($record)) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} elseif ($request->get('salesorder_id') || $request->get('quote_id')) {
if ($request->get('salesorder_id')) {
$referenceId = $request->get('salesorder_id');
} else {
$referenceId = $request->get('quote_id');
}
$parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId);
$currencyInfo = $parentRecordModel->getCurrencyInfo();
$taxes = $parentRecordModel->getProductTaxes();
$relatedProducts = $parentRecordModel->getProducts();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$recordModel->setRecordFieldValues($parentRecordModel);
} else {
$taxes = Inventory_Module_Model::getAllProductTaxes();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$viewer->assign('MODE', '');
//The creation of Inventory record from action and Related list of product/service detailview the product/service details will calculated by following code
if ($request->get('product_id') || $sourceModule === 'Products') {
if ($sourceRecord) {
$productRecordModel = Products_Record_Model::getInstanceById($sourceRecord);
} else {
$productRecordModel = Products_Record_Model::getInstanceById($request->get('product_id'));
}
$relatedProducts = $productRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($request->get('service_id') || $sourceModule === 'Services') {
if ($sourceRecord) {
$serviceRecordModel = Services_Record_Model::getInstanceById($sourceRecord);
} else {
$serviceRecordModel = Services_Record_Model::getInstanceById($request->get('service_id'));
}
$relatedProducts = $serviceRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($sourceRecord && ($sourceModule === 'Accounts' || $sourceModule === 'Contacts' || $sourceModule === 'Potentials' || $sourceModule === 'Vendors' && $moduleName === 'PurchaseOrder')) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
$recordModel->setParentRecordData($parentRecordModel);
}
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
//get the inventory terms and conditions
$inventoryRecordModel = Inventory_Record_Model::getCleanInstance($moduleName);
$termsAndConditions = $inventoryRecordModel->getInventoryTermsandConditions();
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);
$viewer->assign('VIEW_MODE', "fullForm");
$isRelationOperation = $request->get('relationOperation');
//if it is relation edit
$viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
if ($isRelationOperation) {
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
}
if (!empty($record) && $request->get('isDuplicate') == true) {
$viewer->assign('IS_DUPLICATE', true);
} else {
$viewer->assign('IS_DUPLICATE', false);
}
$currencies = Inventory_Module_Model::getAllCurrencies();
$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', $recordModel);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
//.........这里部分代码省略.........
示例3: 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 = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('MODE', '');
//While Duplicating record, If the related record is deleted then we are removing related record info in record model
$mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
foreach ($mandatoryFieldModels as $fieldModel) {
if ($fieldModel->isReferenceField()) {
$fieldName = $fieldModel->get('name');
if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
$recordModel->set($fieldName, '');
}
}
}
} else {
if (!empty($record)) {
$recordModel = $this->record ? $this->record : 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', '');
}
}
if (!$this->record) {
$this->record = $recordModel;
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
$specialField = false;
// We collate date and time part together in the EditView UI handling
// so a bit of special treatment is required if we come from QuickCreate
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
$specialField = true;
// Convert the incoming user-picked time to GMT time
// which will get re-translated based on user-time zone on EditForm
$fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
}
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
$startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
$startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
list($startDate, $startTime) = explode(' ', $startDateTime);
$fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
}
if ($fieldModel->isEditable() || $specialField) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
// SalesPlatform.ru begin Unifying method for EditView preparing
$recordModel = prepareEditView($recordModel, $_REQUEST, $viewer);
// SalesPlatform.ru end
// SalesPlatform.ru begin Set company
if ($request->get('relationOperation')) {
$sourceRecordModel = Vtiger_Record_Model::getInstanceById($request->get('sourceRecord'));
if ($sourceRecordModel->get('spcompany') != null && $sourceRecordModel->get('spcompany') != '') {
if ($recordModel->getField('spcompany')) {
$recordModel->set('spcompany', $sourceRecordModel->get('spcompany'));
}
}
}
// SalesPlatform.ru end
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
// SalesPlatform.ru begin Field Validation Information
$tabid = getTabid($moduleName);
$validationData = getDBValidationData($recordModel->get('tab_name'), $tabid);
$validationArray = split_validationdataArray($validationData);
$viewer->assign("VALIDATION_DATA_FIELDNAME", $validationArray['fieldname']);
$viewer->assign("VALIDATION_DATA_FIELDDATATYPE", $validationArray['datatype']);
$viewer->assign("VALIDATION_DATA_FIELDLABEL", $validationArray['fieldlabel']);
$viewer->assign('ID', $record);
// SalesPlatform.ru end
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('MODULE', $moduleName);
$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'));
// SalesPlatform.ru begin enable/disable button Import
$instance = Vtiger_Module::getInstance('SPSocialConnector');
$fl_import_button = true;
if (empty($record) || $instance->presence == 1) {
$fl_import_button = false;
}
//.........这里部分代码省略.........
示例4: 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 = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('MODE', '');
$recordModel->set('id', '');
//While Duplicating record, If the related record is deleted then we are removing related record info in record model
$mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
foreach ($mandatoryFieldModels as $fieldModel) {
if ($fieldModel->isReferenceField()) {
$fieldName = $fieldModel->get('name');
if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
$recordModel->set($fieldName, '');
}
}
}
} else {
if (!empty($record)) {
$recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$referenceId = $request->get('reference_id');
if ($referenceId) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($referenceId);
$recordModel->setRecordFieldValues($parentRecordModel);
}
$viewer->assign('MODE', '');
}
}
if (!$this->record) {
$this->record = $recordModel;
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
$specialField = false;
// We collate date and time part together in the EditView UI handling
// so a bit of special treatment is required if we come from QuickCreate
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
$specialField = true;
// Convert the incoming user-picked time to GMT time
// which will get re-translated based on user-time zone on EditForm
$fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
}
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
$startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
$startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
list($startDate, $startTime) = explode(' ', $startDateTime);
$fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
}
if ($fieldModel->isEditable() || $specialField) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$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('MODULE_TYPE', $moduleModel->getModuleType());
$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());
$viewer->assign('APIADDRESS', Settings_ApiAddress_Module_Model::getInstance('Settings:ApiAddress')->getConfig());
$viewer->assign('APIADDRESS_ACTIVE', Settings_ApiAddress_Module_Model::isActive());
$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);
}
示例5: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
$sourceRecord = $request->get('sourceRecord');
$sourceModule = $request->get('sourceModule');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$shippingTaxes = $recordModel->getShippingTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('MODE', '');
//While Duplicating record, If the related record is deleted then we are removing related record info in record model
$mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
foreach ($mandatoryFieldModels as $fieldModel) {
if ($fieldModel->isReferenceField()) {
$fieldName = $fieldModel->get('name');
if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
$recordModel->set($fieldName, '');
}
}
}
} elseif (!empty($record)) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$shippingTaxes = $recordModel->getShippingTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
// SalesPlatform.ru begin Relation between Invoice & Consignment
} elseif ($request->get('salesorder_id') || $request->get('quote_id') || $request->get('invoice_id')) {
//} elseif ($request->get('salesorder_id') || $request->get('quote_id') || $request->get('invoice_id')) {
// SalesPlatform.ru end
if ($request->get('salesorder_id')) {
$referenceId = $request->get('salesorder_id');
// SalesPlatform.ru begin Relation between Invoice & Consignment
} elseif ($request->get('invoice_id')) {
$referenceId = $request->get('invoice_id');
// SalesPlatform.ru end
} else {
$referenceId = $request->get('quote_id');
}
$parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId);
$currencyInfo = $parentRecordModel->getCurrencyInfo();
$taxes = $parentRecordModel->getProductTaxes();
$shippingTaxes = $parentRecordModel->getShippingTaxes();
$relatedProducts = $parentRecordModel->getProducts();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$recordModel->setRecordFieldValues($parentRecordModel);
/** EventHandler START */
$recordModel = EventHandler_Module_Model::do_filter('vtiger.filter.' . strtolower($moduleName) . '.convert', $recordModel, $parentRecordModel);
/** EventHandler ENDE */
} else {
$taxes = Inventory_Module_Model::getAllProductTaxes();
$shippingTaxes = Inventory_Module_Model::getAllShippingTaxes();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$viewer->assign('MODE', '');
//The creation of Inventory record from action and Related list of product/service detailview the product/service details will calculated by following code
if ($request->get('product_id') || $sourceModule === 'Products') {
if ($sourceRecord) {
$productRecordModel = Products_Record_Model::getInstanceById($sourceRecord);
} else {
$productRecordModel = Products_Record_Model::getInstanceById($request->get('product_id'));
}
$relatedProducts = $productRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($request->get('service_id') || $sourceModule === 'Services') {
if ($sourceRecord) {
$serviceRecordModel = Services_Record_Model::getInstanceById($sourceRecord);
} else {
$serviceRecordModel = Services_Record_Model::getInstanceById($request->get('service_id'));
}
$relatedProducts = $serviceRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($sourceRecord && ($sourceModule === 'Accounts' || $sourceModule === 'Contacts' || $sourceModule === 'Potentials' || $sourceModule === 'Vendors' && $moduleName === 'PurchaseOrder')) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
$recordModel->setParentRecordData($parentRecordModel);
}
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
//get the inventory terms and conditions
$inventoryRecordModel = Inventory_Record_Model::getCleanInstance($moduleName);
$termsAndConditions = $inventoryRecordModel->getInventoryTermsandConditions();
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
// SalesPlatform.ru begin Set default invoice status for SalesOrder
if ($moduleName == "SalesOrder") {
if (empty($record)) {
$recordModel->set("invoicestatus", "AutoCreated");
} else {
$checkbox = $recordModel->get("enable_recurring");
if ($checkbox != 1) {
$recordModel->set("invoicestatus", "AutoCreated");
//.........这里部分代码省略.........