Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function process(Vtiger_Request $request)
 {
     global $log;
     $log->debug("Entering ./views/QuickCreateAjax.php::process");
     $moduleName = $request->getModule();
     $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
     $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_QUICKCREATE);
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer = $this->getViewer($request);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     echo $viewer->view('QuickCreate.tpl', $moduleName, true);
 }
Ejemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleList = array('Calendar', 'Events');
     $quickCreateContents = array();
     foreach ($moduleList as $module) {
         $info = array();
         $recordModel = Vtiger_Record_Model::getCleanInstance($module);
         $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_QUICKCREATE);
         $info['recordStructureModel'] = $recordStructureInstance;
         $info['recordStructure'] = $recordStructureInstance->getStructure();
         $info['moduleModel'] = $moduleModel;
         $quickCreateContents[$module] = $info;
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer = $this->getViewer($request);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUICK_CREATE_CONTENTS', $quickCreateContents);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
     $viewer->view('QuickCreate.tpl', $moduleName);
 }
 public function process(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     // get min, max, allow_chars from vtiger_passwords_config
     $result = $adb->query("SELECT * FROM vtiger_passwords_config WHERE 1 LIMIT 1", true);
     $min = $adb->query_result($result, 0, 'pass_length_min');
     $max = $adb->query_result($result, 0, 'pass_length_max');
     $allow_chars = $adb->query_result($result, 0, 'pass_allow_chars');
     $moduleName = $request->getModule();
     $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
     $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_QUICKCREATE);
     $recordStructure = $recordStructureInstance->getStructure();
     $sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
     foreach ($sourceRelatedField as $field => $value) {
         if (isset($recordStructure[$field])) {
             $fieldvalue = $recordStructure[$field]->get('fieldvalue');
             if (empty($fieldvalue)) {
                 $recordStructure[$field]->set('fieldvalue', $value);
                 unset($sourceRelatedField[$field]);
             }
         }
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $relatedModule = 'OSSPasswords';
     $viewer = $this->getViewer($request);
     $viewer->assign('RELATEDMODULE', $relatedModule);
     $viewer->assign('GENERATEPASS', 'Generate Password');
     $viewer->assign('VIEW', $request->get('view'));
     $viewer->assign('GENERATEONCLICK', 'generate_password(' . $min . ',' . $max . ',\'' . $allow_chars . '\'); return false;');
     $viewer->assign('VALIDATE_STRINGS', vtranslate('Very Weak', $relatedModule) . ',' . vtranslate('Weak', $relatedModule) . ',' . vtranslate('Better', $relatedModule) . ',' . vtranslate('Medium', $relatedModule) . ',' . vtranslate('Strong', $relatedModule) . ',' . vtranslate('Very Strong', $relatedModule));
     $viewer->assign('Very Weak', 'Very Weak');
     $viewer->assign('Weak', 'Weak');
     $viewer->assign('Better', 'Better');
     $viewer->assign('Medium', 'Medium');
     $viewer->assign('Strong', 'Strong');
     $viewer->assign('Very Strong', 'Very Strong');
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructure);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
     echo $viewer->view('QuickCreate.tpl', $moduleName, true);
 }
Ejemplo n.º 5
0
 public function checkCyclicDependency(Vtiger_Request $request)
 {
     $module = $request->get('sourceModule');
     $sourceField = $request->get('sourcefield');
     $targetField = $request->get('targetfield');
     $result = Vtiger_DependencyPicklist::checkCyclicDependency($module, $sourceField, $targetField);
     $response = new Vtiger_Response();
     $response->setResult(array('result' => $result));
     $response->emit();
 }
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleList = ['Calendar', 'Events'];
     $quickCreateContents = [];
     foreach ($moduleList as $module) {
         $info = [];
         $recordModel = Vtiger_Record_Model::getCleanInstance($module);
         $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_QUICKCREATE);
         $recordStructure = $recordStructureInstance->getStructure();
         $sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
         foreach ($sourceRelatedField as $field => $value) {
             if (isset($recordStructure[$field])) {
                 $fieldvalue = $recordStructure[$field]->get('fieldvalue');
                 if (empty($fieldvalue)) {
                     $recordStructure[$field]->set('fieldvalue', $value);
                     unset($sourceRelatedField[$field]);
                 }
             }
         }
         $info['recordStructureModel'] = $recordStructureInstance;
         $info['recordStructure'] = $recordStructure;
         $info['moduleModel'] = $moduleModel;
         $quickCreateContents[$module] = $info;
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer = $this->getViewer($request);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('SOURCE_RELATED_FIELD', $sourceRelatedField);
     $viewer->assign('PREVIOUSDATE', date('Y-n-j', strtotime('yesterday')));
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('NEXTDATE', date('Y-n-j', strtotime('tomorrow')));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUICK_CREATE_CONTENTS', $quickCreateContents);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
     $viewer->view('QuickCreate.tpl', $moduleName);
 }
Ejemplo n.º 7
0
 /**
  * Function returns the mass edit form
  * @param Vtiger_Request $request
  */
 function showMassEditForm(Vtiger_Request $request)
 {
     global $log;
     $log->debug("Entering ./views/MassActionAjax.php::showMassEditForm");
     $moduleName = $request->getModule();
     $cvId = $request->get('viewname');
     $selectedIds = $request->get('selected_ids');
     $excludedIds = $request->get('excluded_ids');
     $viewer = $this->getViewer($request);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_MASSEDIT);
     $fieldInfo = array();
     $fieldList = $moduleModel->getFields();
     foreach ($fieldList as $fieldName => $fieldModel) {
         $fieldInfo[$fieldName] = $fieldModel->getFieldInfo();
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODE', 'massedit');
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CVID', $cvId);
     $viewer->assign('SELECTED_IDS', $selectedIds);
     $viewer->assign('EXCLUDED_IDS', $excludedIds);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('MASS_EDIT_FIELD_DETAILS', $fieldInfo);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     $operator = $request->get('operator');
     if (!empty($operator)) {
         $viewer->assign('OPERATOR', $operator);
         $viewer->assign('ALPHABET_VALUE', $searchValue);
         $viewer->assign('SEARCH_KEY', $searchKey);
     }
     $searchParams = $request->get('search_params');
     if (!empty($searchParams)) {
         $viewer->assign('SEARCH_PARAMS', $searchParams);
     }
     echo $viewer->view('MassEditForm.tpl', $moduleName, true);
 }
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
     $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_QUICKCREATE);
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer = $this->getViewer($request);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $recordStructure = $recordStructureInstance->getStructure();
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
     foreach ($sourceRelatedField as $field => &$value) {
         if (isset($recordStructure[$field])) {
             $fieldvalue = $recordStructure[$field]->get('fieldvalue');
             if (empty($fieldvalue)) {
                 $recordStructure[$field]->set('fieldvalue', $value);
                 unset($sourceRelatedField[$field]);
             }
         }
     }
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('SOURCE_RELATED_FIELD', $sourceRelatedField);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructure);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('VIEW', $request->get('view'));
     $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     echo $viewer->view('QuickCreate.tpl', $moduleName, true);
 }
Ejemplo n.º 9
0
 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel)
 {
     $forModule = $this->get('formodule');
     $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($forModule);
     $noOfRecords = count($dependentPicklists);
     $recordModelClass = Vtiger_Loader::getComponentClassName('Model', 'Record', 'Settings:PickListDependency');
     $listViewRecordModels = array();
     for ($i = 0; $i < $noOfRecords; $i++) {
         $record = new $recordModelClass();
         $module = $dependentPicklists[$i]['module'];
         unset($dependentPicklists[$i]['module']);
         $record->setData($dependentPicklists[$i]);
         $record->set('sourceModule', $module);
         $record->set('sourceLabel', vtranslate($module, $module));
         $listViewRecordModels[] = $record;
     }
     $pagingModel->calculatePageRange($listViewRecordModels);
     return $listViewRecordModels;
 }
Ejemplo n.º 10
0
 function Events($request, $moduleName)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $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('MODE', 'edit');
             $viewer->assign('RECORD_ID', $record);
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $viewer->assign('MODE', '');
         }
     }
     $eventModule = Vtiger_Module_Model::getInstance($moduleName);
     $recordModel->setModuleFromInstance($eventModule);
     $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 (empty($record) && ($fieldName == 'time_start' || $fieldName == 'time_end') && !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 (empty($record) && ($fieldName == 'date_start' || $fieldName == 'due_date') && !empty($fieldValue)) {
             if ($fieldName == 'date_start') {
                 $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);
             } else {
                 $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_end']);
                 $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $endTime);
                 list($endDate, $endTime) = explode(' ', $endDateTime);
                 $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($endDate);
             }
         }
         if ($fieldModel->isEditable() || $specialField) {
             $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);
     }
     $userChangedEndDateTime = $request->get('userChangedEndDateTime');
     //If followup value is passed from request to process the value and sent to client
     $requestFollowUpDate = $request->get('followup_date_start');
     $requestFollowUpTime = $request->get('followup_time_start');
     $followUpStatus = $request->get('followup');
     $eventStatus = $request->get('eventstatus');
     if (!empty($requestFollowUpDate)) {
         $followUpDate = $requestFollowUpDate;
     }
     if (!empty($requestFollowUpTime)) {
         $followUpTime = $requestFollowUpTime;
     }
     if ($followUpStatus == 'on') {
         $viewer->assign('FOLLOW_UP_STATUS', TRUE);
     }
     if ($eventStatus == 'Held') {
         $viewer->assign('SHOW_FOLLOW_UP', TRUE);
     } else {
         $viewer->assign('SHOW_FOLLOW_UP', FALSE);
     }
     $viewer->assign('USER_CHANGED_END_DATE_TIME', $userChangedEndDateTime);
     $viewer->assign('FOLLOW_UP_DATE', $followUpDate);
     $viewer->assign('FOLLOW_UP_TIME', $followUpTime);
     $viewer->assign('RECURRING_INFORMATION', $recordModel->getRecurrenceInformation());
     $viewer->assign('TOMORROWDATE', Vtiger_Date_UIType::getDisplayDateValue(date('Y-m-d', time() + 86400)));
     $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());
     $existingRelatedContacts = $recordModel->getRelatedContactInfo();
     //To add contact ids that is there in the request . Happens in gotoFull form mode of quick create
     $requestContactIdValue = $request->get('contact_id');
     if (!empty($requestContactIdValue)) {
         $existingRelatedContacts[] = array('name' => Vtiger_Util_Helper::getRecordName($requestContactIdValue), 'id' => $requestContactIdValue);
     }
     $viewer->assign('RELATED_CONTACTS', $existingRelatedContacts);
     $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'));
     }
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $accessibleUsers = $currentUser->getAccessibleUsers();
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $viewer->assign('ACCESSIBLE_USERS', $accessibleUsers);
     $viewer->assign('INVITIES_SELECTED', $recordModel->getInvities());
     $viewer->assign('CURRENT_USER', $currentUser);
     $viewer->view('EditView.tpl', $moduleName);
 }
Ejemplo n.º 11
0
 public function delete()
 {
     Vtiger_DependencyPicklist::deletePickListDependencies($this->get('sourceModule'), $this->get('sourcefield'), $this->get('targetfield'));
     return true;
 }
Ejemplo n.º 12
0
 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());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('RELATED_PRODUCTS', $relatedProducts);
     $viewer->assign('TAXES', $taxes);
     $viewer->assign('CURRENCINFO', $currencyInfo);
     $viewer->assign('CURRENCIES', $currencies);
     $viewer->assign('TERMSANDCONDITIONS', $termsAndConditions);
     $productModuleModel = Vtiger_Module_Model::getInstance('Products');
     $viewer->assign('PRODUCT_ACTIVE', $productModuleModel->isActive());
     $serviceModuleModel = Vtiger_Module_Model::getInstance('Services');
     $viewer->assign('SERVICE_ACTIVE', $serviceModuleModel->isActive());
     $viewer->assign('APIADDRESS', Settings_ApiAddress_Module_Model::getInstance('Settings:ApiAddress')->getConfig(false));
     $viewer->view('EditView.tpl', 'Inventory');
 }
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
    $smarty->assign("viewOption", vtlib_purify($_REQUEST['viewOption']));
}
if (isset($_REQUEST['subtab']) && $_REQUEST['subtab'] != '') {
    $smarty->assign("subtab", vtlib_purify($_REQUEST['subtab']));
}
if (isset($_REQUEST['maintab']) && $_REQUEST['maintab'] != '') {
    $smarty->assign("maintab", vtlib_purify($_REQUEST['maintab']));
}
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']);
$smarty->assign("ID", $focus->id);
$tabid = getTabid($tab_type);
$validationData = getDBValidationData($focus->tab_name, $tabid);
$data = split_validationdataArray($validationData);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("DUPLICATE", vtlib_purify($_REQUEST['isDuplicate']));
if ($activity_mode == 'Task') {
    $custom_fields_data = getCalendarCustomFields(getTabid('Calendar'), 'edit', $focus->column_fields);
} else {
    $custom_fields_data = getCalendarCustomFields(getTabid('Events'), 'edit', $focus->column_fields);
}
$smarty->assign("CUSTOM_FIELDS_DATA", $custom_fields_data);
$smarty->assign("REPEAT_LIMIT_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($tab_type);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
// END
$smarty->display("ActivityEditView.tpl");
Ejemplo n.º 15
0
</div>
<script>
	//for move addEventUI
	var theEventHandle = document.getElementById("moveEvent");
	var theEventRoot   = document.getElementById("addEvent");
	Drag.init(theEventHandle, theEventRoot);

	//for move addToDo
	var theTodoHandle = document.getElementById("moveTodo");
	var theTodoRoot   = document.getElementById("createTodo");
	Drag.init(theTodoHandle, theTodoRoot);
</script>

<?php 
$picklistDependencyDSEvents = Vtiger_DependencyPicklist::getPicklistDependencyDatasource('Events');
$picklistDependencyDSCalendar = Vtiger_DependencyPicklist::getPicklistDependencyDatasource('Calendar');
?>
<script type="text/javascript" src="include/js/FieldDependencies.js"></script>
<script type="text/javascript" src="modules/com_vtiger_workflow/resources/jquery-1.2.6.js"></script>
<script type="text/javascript">
	jQuery.noConflict();
</script>
<script type="text/javascript">
	jQuery(document).ready(function() { 
		<?php 
if (!empty($picklistDependencyDSEvents)) {
    ?>
		(new FieldDependencies(<?php 
    echo Zend_Json::encode($picklistDependencyDSEvents);
    ?>
)).init();
                    $sourceFieldValues[htmlentities($value, ENT_QUOTES, 'UTF-8')] = $value;
                }
                $smarty->assign("SOURCE_VALUES", $sourceFieldValues);
                $smarty->assign("TARGET_VALUES", $targetFieldValues);
                $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($fld_module);
                $smarty->assign("DEPENDENT_PICKLISTS", $dependentPicklists);
                $dependencyMap = Vtiger_DependencyPicklist::getPickListDependency($fld_module, $sourceField, $targetField);
            }
            $smarty->assign("DEPENDENCY_MAP", $dependencyMap);
            $smarty->display("modules/PickList/PickListDependencyContents.tpl");
        }
    } else {
        if ($subMode == 'savedependency') {
            $dependencyMapping = vtlib_purify($_REQUEST['dependencymapping']);
            $json = new Zend_Json();
            $dependencyMappingData = $json->decode($dependencyMapping);
            Vtiger_DependencyPicklist::savePickListDependencies($fld_module, $dependencyMappingData);
        } elseif ($subMode == 'deletedependency') {
            $sourceField = vtlib_purify($_REQUEST['sourcefield']);
            $targetField = vtlib_purify($_REQUEST['targetfield']);
            Vtiger_DependencyPicklist::deletePickListDependencies($fld_module, $sourceField, $targetField);
        }
        $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($fld_module);
        $smarty->assign("DEPENDENT_PICKLISTS", $dependentPicklists);
        $smarty->display("modules/PickList/PickListDependencyList.tpl");
    }
} else {
    $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($fld_module);
    $smarty->assign("DEPENDENT_PICKLISTS", $dependentPicklists);
    $smarty->display("modules/PickList/PickListDependencySetup.tpl");
}
Ejemplo n.º 17
0
    $tax_details = getAllTaxes('available');
    $sh_tax_details = getAllTaxes('available', 'sh');
} else {
    $tax_details = getAllTaxes('available', '', $focus->mode, $focus->id);
    $sh_tax_details = getAllTaxes('available', 'sh', 'edit', $focus->id);
}
$smarty->assign('GROUP_TAXES', $tax_details);
$smarty->assign('SH_TAXES', $sh_tax_details);
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if ($focus->mode == 'edit') {
    $inventory_cur_info = getInventoryCurrencyInfo('PurchaseOrder', $focus->id);
    $smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
    $smarty->assign("INV_CURRENCY_ID", $currencyid);
}
$smarty->assign('CREATEMODE', vtlib_purify($_REQUEST['createmode']));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($currentModule);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
//Get Service or Product by default when create
$smarty->assign('PRODUCT_OR_SERVICE', GlobalVariable::getVariable('product_service_default', 'Products', $currentModule, $current_user->id));
//Set taxt type group or individual by default when create
$smarty->assign('TAX_TYPE', GlobalVariable::getVariable('Tax_Type_Default', 'individual', $currentModule, $current_user->id));
//Show or not the Header to copy address to left or right
$smarty->assign('SHOW_COPY_ADDRESS', GlobalVariable::getVariable('Show_Copy_Adress_Header', 'yes', $currentModule, $current_user->id));
if ($focus->mode == 'edit') {
    $smarty->display('Inventory/InventoryEditView.tpl');
} else {
    $smarty->display('Inventory/InventoryCreateView.tpl');
}
Ejemplo n.º 18
0
 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;
     }
     $viewer->assign("FL_IMPORT_BUTTON", $fl_import_button);
     // SalesPlatform.ru end
     $viewer->view('EditView.tpl', $moduleName);
 }
Ejemplo n.º 19
0
 public function process(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     $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', '');
     } 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));
         }
     }
     $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('BLOCK_LIST', $moduleModel->getBlocks());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('RECORD_MODEL', $recordModel);
     $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', vglobal('upload_maxsize') / 1000000);
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     // check if passwords are encrypted
     if (file_exists('modules/OSSPasswords/config.ini')) {
         // encryption key exists so passwords are encrypted
         $config = parse_ini_file('modules/OSSPasswords/config.ini');
         // let smarty know that passwords are encrypted
         $viewer->assign('ENCRYPTED', true);
         $viewer->assign('ENC_KEY', $config['key']);
         $viewer->assign('RECORD', $_GET['record']);
         $viewer->assign('VIEW', $_GET['view']);
     } else {
         $viewer->assign('ENCRYPTED', false);
         $viewer->assign('ENC_KEY', '');
         $viewer->assign('RECORD', $_GET['record']);
         $viewer->assign('VIEW', $_GET['view']);
     }
     // widget button
     // get min, max, allow_chars from vtiger_passwords_config
     $result = $adb->query("SELECT * FROM vtiger_passwords_config WHERE 1 LIMIT 1", true);
     $min = $adb->query_result($result, 0, 'pass_length_min');
     $max = $adb->query_result($result, 0, 'pass_length_max');
     $allow_chars = $adb->query_result($result, 0, 'pass_allow_chars');
     $GenerateButton = 'Generate Password';
     $ConfigureButton = 'LBL_ConfigurePass';
     $viewer = $this->getViewer($request);
     $viewer->assign('GENERATEPASS', $GenerateButton);
     $viewer->assign('GENERATEONCLICK', 'generate_password(' . $min . ',' . $max . ',\'' . $allow_chars . '\');');
     $viewer->view('EditView.tpl', $moduleName);
 }
Ejemplo n.º 20
0
 public static function getAvailablePicklists($module)
 {
     return Vtiger_DependencyPicklist::getAvailablePicklists($module);
 }
Ejemplo n.º 21
0
    public function addRecords()
    {
        global $log, $adb;
        $log->debug("Entering VT620_to_YT::addRecords() method ...");
        //include('config/config.inc.php');
        global $dbconfig;
        $assigned_user_id = $this->adminId;
        $user = new Users();
        $current_user = $user->retrieveCurrentUserInfoFromFile($assigned_user_id);
        $moduleName = 'OSSMailTemplates';
        vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
        $records = array();
        $records[] = array(35, 'Notify Owner On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(36, 'Notify Account On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(37, 'Notify Contact On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(38, 'Notify Account On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(39, 'Notify Contact On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(40, 'Notify Account On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(41, 'Notify Contact On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(42, 'Notify Owner On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(43, 'Notify Owner On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(44, 'Customer Portal Login Details', 'Contacts', 'Customer Portal Login Details', '<p>#s#LogoImage#sEnd# </p><p>Dear #a#67#aEnd#  #a#70#aEnd#</p><p>Created for your account in the customer portal, below sending data access.</p><p>Login: #a#80#aEnd#<br />Password: #s#ContactsPortalPass#sEnd#</p><p>Regards</p>', 'PLL_RECORD');
        $records[] = array(45, 'Send invitations', 'Events', '#a#267#aEnd#:  #a#255#aEnd#', '<table border="0" cellpadding="8" cellspacing="0" style="width:100%;font-family:Arial, \'Sans-serif\';border:1px solid #ccc;border-width:1px 2px 2px 1px;background-color:#fff;" summary=""><tbody><tr><td style="background-color:#f6f6f6;color:#888;border-bottom:1px solid #ccc;font-family:Arial, \'Sans-serif\';font-size:11px;">
			<h3 style="padding:0 0 6px 0;margin:0;font-family:Arial, \'Sans-serif\';font-size:16px;font-weight:bold;color:#222;"><span>#a#255#aEnd#</span></h3>
			</td>
		</tr><tr><td>
			<div style="padding:2px;">
			<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="padding:0 1em 10px 0;font-family:Arial,\'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#257#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#257#aEnd# #a#258#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#259#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#259#aEnd# #a#260#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#264#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#264#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#277#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#277#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#267#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#267#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#271#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#271#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#268#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top"><span><span>#a#268#aEnd#</span><span dir="ltr"> (<a href="https://maps.google.pl/maps?q=%23a%23268%23aEnd%23" style="color:#20c;white-space:nowrap;">mapa</a>)</span></span></td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#265#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#265#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#275#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#275#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#256#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#256#aEnd#</td>
					</tr></tbody></table></div>
			</td>
		</tr><tr><td style="background-color:#f6f6f6;color:#888;border-top:1px solid #ccc;font-family:Arial, \'Sans-serif\';font-size:11px;">
			<p>YetiForce CRM - Notification activities on the calendar</p>
			</td>
		</tr></tbody></table>', 'PLL_RECORD');
        $records[] = array(46, 'Send Notification Email to Record Owner', 'Calendar', 'Task :  #a#231#aEnd#', '#a#232#aEnd#<br /><br />Activity Notification Details:<br />Subject : #a#231#aEnd#<br />Start date and time : #a#233#aEnd# #a#234#aEnd#<br />End date and time : #a#235#aEnd# #a#236#aEnd#<br />Status : #a#239#aEnd#<br />Priority : #a#241#aEnd#<br />Related To : #a#237#aEnd#<br />Contacts List : #a#238#aEnd#<br />Location : #a#250#aEnd#<br />Description : #a#247#aEnd#', 'PLL_RECORD');
        $records[] = array(93, 'Activity Reminder Notification', 'Calendar', 'Reminder:  #a#231#aEnd#', 'This is a reminder notification for the Activity:<br />Subject: #a#231#aEnd#<br />Date & Time: #a#233#aEnd# #a#234#aEnd#<br /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Contact Name: </span>#a#238#aEnd#<br style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\" /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Related To: </span>#a#237#aEnd#<br style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\" /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Description: </span>#a#247#aEnd#', 'PLL_RECORD');
        $records[] = array(94, 'Activity Reminder Notification', 'Events', 'Reminder: #a#255#aEnd#', '<span style=\\"line-height:20.7999992370605px;\\">This is a reminder notification for the Activity:</span><br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;\\">Subject:</span>#a#255#aEnd#<br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;\\">Date & Time: </span>#a#257#aEnd# #a#258#aEnd#<br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Contact Name: </span>#a#277#aEnd#<br style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Related To: </span>#a#264#aEnd#<br style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Description: </span>#a#275#aEnd#', 'PLL_RECORD');
        $records[] = array(95, 'Test mail about the mail server configuration.', 'Users', 'Test mail about the mail server configuration.', '<span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Dear </span>#a#478#aEnd# #a#479#aEnd#<span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">, </span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><b style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">This is a test mail sent to confirm if a mail is actually being sent through the smtp server that you have configured. </b><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Feel free to delete this mail. </span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Thanks and Regards,</span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Team YetiForce</span>', 'PLL_RECORD');
        $records[] = array(103, 'ForgotPassword', 'Users', 'Request: ForgotPassword', 'Dear user,<br /><br />\\r\\nYou recently requested a password reset for your YetiForce CRM.<br />\\r\\nTo create a new password, click on the link #s#LinkToForgotPassword#sEnd#.<br /><br />\\r\\nThis request was made on #s#CurrentDateTime#sEnd# and will expire in next 24 hours.<br /><br />\\r\\nRegards,<br />\\r\\nYetiForce CRM Support Team.', 'PLL_RECORD');
        $records[] = array(104, 'Customer Portal - ForgotPassword', 'Contacts', 'Request: ForgotPassword', 'Dear #a#67#aEnd# #a#70#aEnd#,<br /><br />
You recently requested a reminder of your access data for the YetiForce Portal.<br /><br />
You can login by entering the following data:<br /><br />
Your username: #a#80#aEnd#<br />
Your password: #s#ContactsPortalPass#sEnd#<br /><br /><br />
Regards,<br />
YetiForce CRM Support Team.', 'PLL_RECORD');
        $records[] = array(105, 'New comment added to ticket from portal', 'ModComments', 'New comment added to ticket from portal', 'Dear User,<br />
A new comment has been added to the ticket.<br />
#b#597#bEnd# #a#597#aEnd#<br /><br />
 ', 'PLL_RECORD');
        $records[] = array(106, 'New comment added to ticket', 'ModComments', 'New comment added to ticket', '<span class="value">Dear User,<br />
A new comment has been added to the ticket.<br />
#b#597#bEnd# #a#597#aEnd#</span>', 'PLL_RECORD');
        $records[] = array(107, 'Security risk has been detected - Brute Force', 'Contacts', 'Security risk has been detected', '<span class="value">Dear user,<br />
Failed login attempts have been detected. </span>', 'PLL_MODULE');
        $records[] = array(108, 'Backup has been made', 'Contacts', 'Backup has been made notification', 'Dear User,<br />
Backup has been made.', 'PLL_MODULE');
        foreach ($records as $record) {
            try {
                $instance = new $moduleName();
                $instance->column_fields['assigned_user_id'] = $assigned_user_id;
                $instance->column_fields['name'] = $record[1];
                $instance->column_fields['oss_module_list'] = $record[2];
                $instance->column_fields['subject'] = $record[3];
                $instance->column_fields['content'] = $record[4];
                $instance->column_fields['ossmailtemplates_type'] = $record[5];
                $save = $instance->save($moduleName);
                if ($record[1] == 'Test mail about the mail server configuration.') {
                    self::changeOutgoingServerFile($instance->id);
                }
                if ($record[1] == 'ForgotPassword') {
                    self::updateForgotPassword($instance->id);
                }
            } catch (Exception $e) {
                Install_InitSchema_Model::addMigrationLog('addRecords ' . $e->getMessage(), 'error');
            }
        }
        //vtiger_osspdf
        $moduleName = 'OSSPdf';
        vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
        $records = array();
        $records[] = array('Quotes PDF', '20', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function#</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Offer #quote_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_validtill#: </strong>#validtill#<br />
<strong>#label_shipping#: </strong>#shipping#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| Podgląd');
        $records[] = array('Sales Order PDF', '22', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function#
			</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Sales Order #salesorder_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>#Quotes_label_quote_no#: </strong>#Quotes_quote_no#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| Podgląd');
        $records[] = array('Invoice PDF', '23', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#label_invoicedate#: #invoicedate#
			</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Invoice #invoice_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_invoicedate#: </strong>#invoicedate#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>Sales Order: </strong>#SalesOrder_salesorder_no#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| Podgląd');
        $records[] = array('Purchase Order PDF', '21', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function# </span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Vendors_vendorname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Vendors_label_vat_id#: #Vendors_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Order confirmation #purchaseorder_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">Thank you for your order. Herewith we are pleased to confirm it as follows.<br />
#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| Podgląd');
        $records[] = array('Calculation PDF', '70', 'A4', 'Portrait', '', '', '', '10', '10', '10', '10', 'No', 'No', '', '<title></title>
<table width="537px">
	<tbody>
		<tr>
			<td colspan="6" rowspan="2"><img src="#special_function#siteUrl#end_special_function#storage/Logo/logo_yetiforce.png" style="width: 200px;" width="200" /></td>
			<td colspan="4"><span style="font-size:6px;">#company_organizationname# #company_address# #company_code# #company_city#. VAT:#company_vatid#</span></td>
		</tr>
		<tr>
			<td colspan="5">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Calculation confirmation: <strong>#calculations_no#</strong></span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Date: #special_function#CreatedDateTime#end_special_function#</span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="7">&nbsp;</td>
			<td colspan="5" rowspan="2">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="5">
							<tbody>
								<tr>
									<td>
									<table cellpadding="0" style="font-size:8px;">
										<tbody>
											<tr>
												<td colspan="2">Issued by:</td>
												<td colspan="3">#Users_first_name# #Users_last_name#</td>
											</tr>
											<tr>
												<td colspan="2">Email:</td>
												<td colspan="3">#Users_email1#</td>
											</tr>
										</tbody>
									</table>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="3">
			<table>
				<tbody>
					<tr>
						<td><span style="font-size:10px;">&nbsp;<span style="font-size:8px;">#Accounts_account_no#</span></span></td>
					</tr>
					<tr>
						<td>
						<table>
							<tbody>
								<tr>
									<td>
									<p><span style="font-size:10px;">#Accounts_accountname#<br />
									<span style="font-size:8px;">#Accounts_addresslevel8b# #Accounts_buildingnumberb# #Accounts_localnumberb#<br />
									#Accounts_addresslevel7b#, #Accounts_addresslevel5b#<br />
									<span style="font-size:10px;">#Accounts_addresslevel1b#</span><br />
									#Accounts_vat_id#<br />
									#Contacts_email#</span></span></p>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
			<td colspan="3">&nbsp;</td>
		</tr>
	</tbody>
</table>
&nbsp;

<table>
	<tbody>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>#special_function#replaceProductTable#end_special_function#</td>
		</tr>
	</tbody>
</table>', 'No', '1', '1', '0', 'Lista |##| Podgląd');
        foreach ($records as $record) {
            try {
                $instance = new $moduleName();
                $instance->column_fields['assigned_user_id'] = $assigned_user_id;
                $instance->column_fields['title'] = $record[0];
                $instance->column_fields['moduleid'] = $record[1];
                $instance->column_fields['osspdf_pdf_format'] = $record[2];
                $instance->column_fields['osspdf_pdf_orientation'] = $record[3];
                $instance->column_fields['content'] = $record[4];
                $instance->column_fields['constraints'] = $record[5];
                $instance->column_fields['filename'] = $record[6];
                $instance->column_fields['left_margin'] = $record[7];
                $instance->column_fields['right_margin'] = $record[8];
                $instance->column_fields['top_margin'] = $record[9];
                $instance->column_fields['bottom_margin'] = $record[10];
                $instance->column_fields['osspdf_enable_footer'] = $record[11];
                $instance->column_fields['osspdf_enable_header'] = $record[12];
                $instance->column_fields['header_content'] = $record[13];
                $instance->column_fields['footer_content'] = $record[14];
                $instance->column_fields['osspdf_enable_numbering'] = $record[15];
                $instance->column_fields['height_header'] = $record[16];
                $instance->column_fields['height_footer'] = $record[17];
                $instance->column_fields['selected'] = $record[18];
                $instance->column_fields['osspdf_view'] = $record[19];
                $saved = $instance->save($moduleName);
            } catch (Exception $e) {
                Install_InitSchema_Model::addMigrationLog('addRecords ' . $e->getMessage(), 'error');
            }
        }
        // vtiger_picklist_dependency
        $sql = "SELECT * FROM `vtiger_picklist_dependency_seq`;";
        $result = $adb->query($sql);
        $num = $adb->num_rows($result);
        if (!$num) {
            $adb->pquery('insert  into `vtiger_picklist_dependency_seq`(`id`) values (?);', array(0));
        }
        $moduleName = 'Leads';
        $dependencyMap['sourcefield'] = 'industry';
        $dependencyMap['targetfield'] = 'subindustry';
        $targetvalues = '["Ministry","Chancellery","Voivodeship Office","Marshal Office","Poviat","City\\/Township\\/District","Social Welfare Centre","Water and Sewerage Company","Voivodeship Job Centre","Poviat Job Centre","Court of justice","Attorney General\'s Office","Other"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Administration', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Deweloperzy","Real Estate"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Construction Industry', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Primary Schools","High Schools"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Education', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Power Industry', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Banking","Capital Market","Financial Services","Investments","Insurance"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Finance', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Retail","Wholesale","Resale"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Trade', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Hotels and Restaurants', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Health Care', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Automotive","Plastics","Chamical","Raw material","Fuel","Wood and paper","Electromechanical","Pharmaceutical","Building Materials","Metal","Light","Food industry","Recycling"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Industry / Manufacturing', 'targetvalues' => $targetvalues);
        $targetvalues = '["Army","Police"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Uniformed Services', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Transport & Logistics', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Information Technology","Telecommunication","Media"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Technologies', 'targetvalues' => $targetvalues);
        Vtiger_DependencyPicklist::savePickListDependencies($moduleName, $dependencyMap);
        //info on migration
        $adb->pquery("INSERT INTO yetiforce_updates (`time`, `user`, `name`, `from_version`, `to_version`, `result`) VALUES  (?, ?, ?, ?, ?, ?)", array(date('Y-m-d H:i:s'), $this->adminId, 'migration', $this->name, 'Yetiforce CRM 1.0.0', 1));
        $log->debug("Exiting VT620_to_YT::addRecords() method ...");
    }
Ejemplo n.º 22
0
 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");
             }
         }
     }
     // SalesPlatform.ru end
     // SalesPlatform.ru begin Unifying method for EditView preparing
     $recordModel = prepareEditView($recordModel, $_REQUEST, $viewer);
     // SalesPlatform.ru end
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     // 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('VIEW_MODE', "fullForm");
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     //SalesPlatform.ru begin add relation create for Act from Invoice
     $isFromInvoiceCreate = $request->get('convertFromInvoice');
     $viewer->assign('IS_FROM_INVOICE_CREATE', $isFromInvoiceCreate);
     //SalesPlatform.ru end
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     //SalesPlatform.ru begin add relation create for Act from Invoice
     if ($isRelationOperation || $isFromInvoiceCreate) {
         //if($isRelationOperation)
         //SalesPlatform.ru end
         $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));
     $viewer->assign('RECORD', $recordModel);
     $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());
     $viewer->assign('RELATED_PRODUCTS', $relatedProducts);
     $viewer->assign('SHIPPING_TAXES', $shippingTaxes);
     $viewer->assign('TAXES', $taxes);
     $viewer->assign('CURRENCINFO', $currencyInfo);
     $viewer->assign('CURRENCIES', $currencies);
     $viewer->assign('TERMSANDCONDITIONS', $termsAndConditions);
     $productModuleModel = Vtiger_Module_Model::getInstance('Products');
     $viewer->assign('PRODUCT_ACTIVE', $productModuleModel->isActive());
     $serviceModuleModel = Vtiger_Module_Model::getInstance('Services');
     $viewer->assign('SERVICE_ACTIVE', $serviceModuleModel->isActive());
     $viewer->view('EditView.tpl', 'Inventory');
 }
Ejemplo n.º 23
0
 function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $recordId = $request->get('record');
     $moduleName = $request->getModule();
     if (!$this->record) {
         $this->record = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
     }
     $recordModel = $this->record->getRecord();
     $recordStrucure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_DETAIL);
     $summaryInfo = array();
     // Take first block information as summary information
     $stucturedValues = $recordStrucure->getStructure();
     foreach ($stucturedValues as $blockLabel => $fieldList) {
         $summaryInfo[$blockLabel] = $fieldList;
         break;
     }
     $detailViewLinkParams = array('MODULE' => $moduleName, 'RECORD' => $recordId);
     $detailViewLinks = $this->record->getDetailViewLinks($detailViewLinkParams);
     $this->record->getWidgets($detailViewLinkParams);
     $navigationInfo = ListViewSession::getListViewNavigation($recordId);
     $viewer = $this->getViewer($request);
     $viewer->assign('RECORD', $recordModel);
     $viewer->assign('NAVIGATION', $navigationInfo);
     $viewer->assign('COLORLISTHANDLERS', Settings_DataAccess_Module_Model::executeColorListHandlers($moduleName, $recordId, false));
     //Intially make the prev and next records as null
     $prevRecordId = null;
     $nextRecordId = null;
     $found = false;
     if ($navigationInfo) {
         foreach ($navigationInfo as $page => $pageInfo) {
             foreach ($pageInfo as $index => $record) {
                 //If record found then next record in the interation
                 //will be next record
                 if ($found) {
                     $nextRecordId = $record;
                     break;
                 }
                 if ($record == $recordId) {
                     $found = true;
                 }
                 //If record not found then we are assiging previousRecordId
                 //assuming next record will get matched
                 if (!$found) {
                     $prevRecordId = $record;
                 }
             }
             //if record is found and next record is not calculated we need to perform iteration
             if ($found && !empty($nextRecordId)) {
                 break;
             }
         }
     }
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if (!empty($prevRecordId)) {
         $viewer->assign('PREVIOUS_RECORD_URL', $moduleModel->getDetailViewUrl($prevRecordId));
     }
     if (!empty($nextRecordId)) {
         $viewer->assign('NEXT_RECORD_URL', $moduleModel->getDetailViewUrl($nextRecordId));
     }
     $viewer->assign('MODULE_MODEL', $this->record->getModule());
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('DETAILVIEW_WIDGETS', $this->record->widgets);
     $viewer->assign('IS_EDITABLE', $this->record->getRecord()->isEditable($moduleName));
     $viewer->assign('IS_DELETABLE', $this->record->getRecord()->isDeletable($moduleName));
     $linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
     $linkModels = $this->record->getSideBarLinks($linkParams);
     $viewer->assign('QUICK_LINKS', $linkModels);
     $viewer->assign('MODULE_NAME', $moduleName);
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $viewer->assign('DEFAULT_RECORD_VIEW', $currentUserModel->get('default_record_view'));
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer->assign('PICKLIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
 static function getJSPicklistDependencyDatasource($module)
 {
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($module);
     return Zend_Json::encode($picklistDependencyDatasource);
 }