Ejemplo n.º 1
0
 /**
  * Function returns Inventory Line Items
  * @param Vtiger_Request $request
  */
 function showLineItemDetails(Vtiger_Request $request)
 {
     $record = $request->get('record');
     $moduleName = $request->getModule();
     $recordModel = Inventory_Record_Model::getInstanceById($record);
     $relatedProducts = $recordModel->getProducts();
     //##Final details convertion started
     $finalDetails = $relatedProducts[1]['final_details'];
     //Final shipping tax details convertion ended
     $currencyFieldsList = array('grandTotal');
     foreach ($currencyFieldsList as $fieldName) {
         $finalDetails[$fieldName] = Vtiger_Currency_UIType::transformDisplayValue($finalDetails[$fieldName], null, true);
     }
     $relatedProducts[1]['final_details'] = $finalDetails;
     //##Final details convertion ended
     //##Product details convertion started
     $productsCount = count($relatedProducts);
     for ($i = 1; $i <= $productsCount; $i++) {
         $product = $relatedProducts[$i];
         $currencyFieldsList = array('listPrice', 'unitPrice', 'productTotal');
         foreach ($currencyFieldsList as $fieldName) {
             $product[$fieldName . $i] = Vtiger_Currency_UIType::transformDisplayValue($product[$fieldName . $i], null, true);
         }
         $relatedProducts[$i] = $product;
     }
     //##Product details convertion ended
     $viewer = $this->getViewer($request);
     $viewer->assign('RELATED_PRODUCTS', $relatedProducts);
     $viewer->assign('RECORD', $recordModel);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->view('LineItemsDetail.tpl', $moduleName);
 }
Ejemplo n.º 2
0
 public function requestForgotPassword($request)
 {
     $request = new Vtiger_Request($request);
     $adb = PearDatabase::getInstance();
     $username = vtlib_purify($request->get('user_name'));
     $result = $adb->pquery('select id,email1 from vtiger_users where user_name = ? ', array($username));
     if ($adb->num_rows($result) > 0) {
         $email = $adb->query_result($result, 0, 'email1');
     }
     if (strcasecmp($request->get('emailId'), $email) === 0) {
         $userId = $adb->query_result($result, 0, 'id');
         $time = time();
         $options = array('handler_path' => 'modules/Users/handlers/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email, 'time' => $time, 'hash' => md5($username . $time)));
         $trackURL = Vtiger_ShortURL_Helper::generateURL($options);
         $data = ['sysname' => 'UsersForgotPassword', 'to_email' => $email, 'module' => 'Users', 'record' => $userId, 'trackURL' => $trackURL];
         $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
         $status = $recordModel->sendMailFromTemplate($data);
         $site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
         if ($status === 1) {
             header('Location:  ' . $site_URL . '&status=1');
         } else {
             header('Location:  ' . $site_URL . '&statusError=1');
         }
     } else {
         $site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
         header('Location:  ' . $site_URL . '&fpError=1');
     }
 }
Ejemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     $mode = '';
     $selectedFieldsList = $allFieldsList = array();
     if ($recordId) {
         $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
         $selectedFieldsList = $recordModel->getSelectedFieldsList();
         $allFieldsList = $recordModel->getAllFieldsList();
         $sourceModule = $recordModel->get('targetmodule');
         $mode = 'edit';
     } else {
         $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName);
         $sourceModule = $request->get('sourceModule');
         if (!$sourceModule) {
             $sourceModule = reset(array_keys(Settings_Webforms_Module_Model::getSupportedModulesList()));
         }
         $allFieldsList = $recordModel->getAllFieldsList($sourceModule);
     }
     $recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $viewer = $this->getViewer($request);
     $viewer->assign('MODE', $mode);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('RECORD_MODEL', $recordModel);
     $viewer->assign('MODULE', $qualifiedModuleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('ALL_FIELD_MODELS_LIST', $allFieldsList);
     $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructure);
     $viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('EditView.tpl', $qualifiedModuleName);
 }
Ejemplo n.º 4
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     if ($recordId) {
         $recordModel = Settings_MailConverter_Record_Model::getInstanceById($recordId);
     } else {
         $recordModel = Settings_MailConverter_Record_Model::getCleanInstance();
     }
     $recordModel->set('scannerOldName', $request->get('scannerOldName'));
     $fieldsList = $recordModel->getModule()->getFields();
     foreach ($fieldsList as $fieldName => $fieldModel) {
         $recordModel->set($fieldName, $request->get($fieldName));
     }
     $status = $recordModel->save();
     $response = new Vtiger_Response();
     if ($status) {
         $result = array('message' => vtranslate('LBL_SAVED_SUCCESSFULLY', $qualifiedModuleName));
         $result['id'] = $recordModel->getId();
         $response->setResult($result);
     } else {
         $response->setError(vtranslate('LBL_CONNECTION_TO_MAILBOX_FAILED', $qualifiedModuleName));
     }
     $response->emit();
 }
Ejemplo n.º 5
0
 function process(Vtiger_Request $request)
 {
     $mode = $request->getMode();
     if (!empty($mode) && method_exists($this, $mode)) {
         $this->{$mode}($request);
     }
 }
Ejemplo n.º 6
0
 /**
  * Function exports report in a CSV file
  * @param Vtiger_Request $request
  */
 function GetCSV(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $reportModel = Reports_Record_Model::getInstanceById($recordId);
     $reportModel->set('advancedFilter', $request->get('advanced_filter'));
     $reportModel->getReportCSV();
 }
Ejemplo n.º 7
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $currencyName = $request->get('currency');
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $priceDetails = $recordModel->getPriceDetails();
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $priceDetails = $recordModel->getPriceDetails();
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $baseCurrencyConversionRate = $currencyDetails['conversionrate'];
                 break;
             }
         }
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $currencyDetails['conversionrate'] = 1;
                 $currencyDetails['is_basecurrency'] = 1;
             } else {
                 $currencyDetails['conversionrate'] = $currencyDetails['conversionrate'] / $baseCurrencyConversionRate;
                 $currencyDetails['is_basecurrency'] = 0;
             }
             $priceDetails[$key] = $currencyDetails;
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('PRICE_DETAILS', $priceDetails);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('MoreCurrenciesList.tpl', 'Products');
 }
Ejemplo n.º 8
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
         $recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
     } else {
         $recordIds = $this->getRecordsListFromRequest($request);
     }
     foreach ($recordIds as $recordId) {
         if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
             $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
             $recordModel->delete();
         } else {
             $permission = 'No';
         }
     }
     if ($permission === 'No') {
         throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
     }
     $cvId = $request->get('viewname');
     $response = new Vtiger_Response();
     $response->setResult(array('viewname' => $cvId, 'module' => $moduleName));
     $response->emit();
 }
 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $records = $request->get('records');
     $primaryRecord = $request->get('primaryRecord');
     $primaryRecordModel = Vtiger_Record_Model::getInstanceById($primaryRecord, $moduleName);
     $fields = $moduleModel->getFields();
     foreach ($fields as $field) {
         $fieldValue = $request->get($field->getName());
         if ($field->isEditable()) {
             $primaryRecordModel->set($field->getName(), $fieldValue);
         }
     }
     $primaryRecordModel->set('mode', 'edit');
     $primaryRecordModel->save();
     $deleteRecords = array_diff($records, array($primaryRecord));
     foreach ($deleteRecords as $deleteRecord) {
         $recordPermission = Users_Privileges_Model::isPermitted($moduleName, 'Delete', $deleteRecord);
         if ($recordPermission) {
             $primaryRecordModel->transferRelationInfoOfRecords(array($deleteRecord));
             $record = Vtiger_Record_Model::getInstanceById($deleteRecord);
             $record->delete();
         }
     }
     $response = new Vtiger_Response();
     $response->setResult(true);
     $response->emit();
 }
Ejemplo n.º 10
0
 public function showAccountsList(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $selected = $request->get('selected');
     $sourceModule = $request->get('selectedModule');
     $filter = $request->get('selectedFilter');
     $records = [];
     if (empty($selected)) {
         return;
     }
     $multiReferenceFirld = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($moduleName, $sourceModule);
     if (count($multiReferenceFirld) === 0) {
         return;
     }
     $multiReferenceFirld = reset($multiReferenceFirld);
     //var_dump($multiReferenceFirld);
     $searchParams = [['columns' => [['columnname' => $multiReferenceFirld['tablename'] . ':' . $multiReferenceFirld['columnname'] . ':' . $multiReferenceFirld['fieldname'], 'value' => implode(',', $selected), 'column_condition' => '', 'comparator' => 'c']]]];
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('limit', 'no_limit');
     $listViewModel = Vtiger_ListView_Model::getInstance('Accounts', $filter);
     $listViewModel->set('search_key', $multiReferenceFirld['fieldname']);
     $listViewModel->set('search_params', $searchParams);
     $listEntries = $listViewModel->getListViewEntries($pagingModel, true);
     if (count($listEntries) === 0) {
         return;
     }
     $listHeaders = $listViewModel->getListViewHeaders();
     $viewer = $this->getViewer($request);
     $viewer->assign('ENTRIES', $listEntries);
     $viewer->assign('HEADERS', $listHeaders);
     $viewer->assign('MODULE', $moduleName);
     $viewer->view('AccountsList.tpl', $moduleName);
 }
Ejemplo n.º 11
0
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["zuvbgco"] = "url";
     ${${"GLOBALS"}["nvqrslc"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["ivimgqkchpe"]} = new Vtiger_Response();
     ${${"GLOBALS"}["zuvbgco"]} = $request->get("url");
     try {
         if (!filter_var(${${"GLOBALS"}["vwlgxcvjvn"]}, FILTER_VALIDATE_URL)) {
             throw new Exception("URL is not valid");
         }
         ${"GLOBALS"}["rwirxck"] = "needLicense";
         $eneasgio = "content";
         ${$eneasgio} = VtUtils::getContentFromUrl(${${"GLOBALS"}["vwlgxcvjvn"]});
         try {
             ${"GLOBALS"}["bykxupaxtecx"] = "root";
             ${${"GLOBALS"}["bykxupaxtecx"]} = new SimpleXMLElement(${${"GLOBALS"}["jpkdykvrxcnm"]});
         } catch (Exception $exp) {
             throw new Exception("no task repository");
         }
         if (empty($root->title)) {
             throw new Exception("no task repository (title missing)");
         }
         ${${"GLOBALS"}["jjgsblrkloz"]} = (string) $root->needLicense == "1";
         $response->setResult(array("success" => true, "title" => (string) $root->title, "license" => ${${"GLOBALS"}["rwirxck"]}));
     } catch (Exception $exp) {
         $response->setResult(array("success" => false, "error" => $exp->getMessage()));
     }
     $response->emit();
 }
Ejemplo n.º 12
0
 /**
  * Function to get the list of Script models to be included
  * @param Vtiger_Request $request
  * @return <Array> - List of Vtiger_JsScript_Model instances
  */
 function getScripts(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $jsFileNames = array("modules.{$moduleName}.resources.ActivityStateModal");
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     return $jsScriptInstances;
 }
Ejemplo n.º 13
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     $mode = '';
     $enabled = 0;
     $views = array();
     $viewer = $this->getViewer($request);
     $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
     if ($recordId) {
         $mode = 'edit';
         $recordModel = Settings_HideBlocks_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
         $enabled = $recordModel->get('enabled');
         if ($recordModel->get('view') != '') {
             $views = explode(',', $recordModel->get('view'));
         }
         $viewer->assign('BLOCK_ID', $recordModel->get('blockid'));
     }
     $viewer->assign('MODE', $mode);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('ENABLED', $enabled);
     $viewer->assign('SELECTED_VIEWS', $views);
     $viewer->assign('MODULE', 'HideBlocks');
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('BLOCKS', $moduleModel->getAllBlock());
     $viewer->assign('VIEWS', $moduleModel->getViews());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('EditView.tpl', $qualifiedModuleName);
 }
Ejemplo n.º 14
0
 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 public function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
         $fieldModelList = $recordModel->getModule()->getFields();
         foreach ($fieldModelList as $fieldName => $fieldModel) {
             //For not converting craetedtime and modified time to user format
             $uiType = $fieldModel->get('uitype');
             if ($uiType == 70) {
                 $fieldValue = $recordModel->get($fieldName);
             } elseif (in_array($uiType, [71, 72])) {
                 // currency ui types
                 $fieldValue = $recordModel->get($fieldName);
             } else {
                 $fieldValue = $fieldModel->getUITypeModel()->getUserRequestValue($recordModel->get($fieldName), $recordId);
             }
             if ($fieldName === $request->get('field')) {
                 $fieldValue = $request->get('value');
             }
             $fieldDataType = $fieldModel->getFieldDataType();
             if ($fieldDataType == 'time') {
                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
             }
             if ($fieldValue !== null) {
                 if (!is_array($fieldValue)) {
                     $fieldValue = trim($fieldValue);
                 }
                 $recordModel->set($fieldName, $fieldValue);
             }
             $recordModel->set($fieldName, $fieldValue);
         }
     } else {
         $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $recordModel->set('mode', '');
         $fieldModelList = $moduleModel->getFields();
         foreach ($fieldModelList as $fieldName => $fieldModel) {
             if ($request->has($fieldName)) {
                 $fieldValue = $request->get($fieldName, null);
             } else {
                 $fieldValue = $fieldModel->getDefaultFieldValue();
             }
             $fieldDataType = $fieldModel->getFieldDataType();
             if ($fieldDataType == 'time') {
                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
             }
             if ($fieldValue !== null) {
                 if (!is_array($fieldValue)) {
                     $fieldValue = trim($fieldValue);
                 }
                 $recordModel->set($fieldName, $fieldValue);
             }
         }
     }
     return $recordModel;
 }
Ejemplo n.º 15
0
 function checkPermission(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     if (!Users_Privileges_Model::isPermitted($moduleName, $actionName)) {
         throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
     }
 }
Ejemplo n.º 16
0
 public function process(Vtiger_Request $request)
 {
     $tpl_id = $request->get('tpl_id');
     $base_module = $request->get('base_module');
     Settings_DataAccess_Module_Model::saveActionConfig($tpl_id, $request->get('actions_list'), array());
     header("Location: index.php?module=DataAccess&parent=Settings&view=Step3&tpl_id={$tpl_id}&base_module={$base_module}&s=false");
 }
Ejemplo n.º 17
0
 /**
  * Function that saves SMS records
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $recordIds = $this->getRecordsListFromRequest($request);
     $phoneFieldList = $request->get('fields');
     $message = $request->get('message');
     foreach ($recordIds as $recordId) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
         $numberSelected = false;
         foreach ($phoneFieldList as $fieldname) {
             $fieldValue = $recordModel->get($fieldname);
             if (!empty($fieldValue)) {
                 $toNumbers[] = $fieldValue;
                 $numberSelected = true;
             }
         }
         if ($numberSelected) {
             $recordIds[] = $recordId;
         }
     }
     $response = new Vtiger_Response();
     if (!empty($toNumbers)) {
         SMSNotifier_Record_Model::SendSMS($message, $toNumbers, $currentUserModel->getId(), $recordIds, $moduleName);
         $response->setResult(true);
     } else {
         $response->setResult(false);
     }
     return $response;
 }
Ejemplo n.º 18
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $documentIdsList = $this->getRecordsListFromRequest($request);
     $folderId = $request->get('folderid');
     if (!empty($documentIdsList)) {
         foreach ($documentIdsList as $documentId) {
             $documentModel = Vtiger_Record_Model::getInstanceById($documentId, $moduleName);
             if (Users_Privileges_Model::isPermitted($moduleName, 'EditView', $documentId)) {
                 $documentModel->set('folderid', $folderId);
                 $documentModel->set('mode', 'edit');
                 $documentModel->save();
             } else {
                 $documentsMoveDenied[] = $documentModel->getName();
             }
         }
     }
     if (empty($documentsMoveDenied)) {
         $result = array('success' => true, 'message' => vtranslate('LBL_DOCUMENTS_MOVED_SUCCESSFULLY', $moduleName));
     } else {
         $result = array('success' => false, 'message' => vtranslate('LBL_DENIED_DOCUMENTS', $moduleName), 'LBL_RECORDS_LIST' => $documentsMoveDenied);
     }
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
Ejemplo n.º 19
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $viewer = $this->getViewer($request);
     $qualifiedModuleName = $request->getModule(false);
     $lang = $request->get('lang');
     $mod = $request->get('mod');
     $tpl = $request->get('tpl');
     $ShowDifferences = $request->get('sd');
     $moduleModel = Settings_LangManagement_Module_Model::getInstance($qualifiedModuleName);
     if ($lang != '' && $mod != '') {
         if ($tpl == 'editLang') {
             $data = $moduleModel->loadLangTranslation($lang, $mod, $ShowDifferences);
         } else {
             $data = $moduleModel->loadAllFieldsFromModule($lang, $mod, $ShowDifferences);
         }
     }
     $Mods = $moduleModel->getModFromLang($lang);
     $Langs = $moduleModel->getLang();
     $viewer->assign('MODS', $Mods);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('REQUEST', $request);
     $viewer->assign('LANGS', $Langs);
     $viewer->assign('DATA', $data);
     $viewer->assign('LANGS', $Langs);
     $viewer->assign('SD', $ShowDifferences);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     if ($tpl == 'editLang') {
         $viewer->view('Edit.tpl', $qualifiedModuleName);
     } else {
         $viewer->view('EditHelpIcon.tpl', $qualifiedModuleName);
     }
 }
Ejemplo n.º 20
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
     $bag = false;
     $paymentsIn = $request->get('paymentsIn');
     foreach ($paymentsIn as $fields) {
         $ossPaymentsIn = new $moduleName();
         $ossPaymentsIn->column_fields['paymentsname'] = 'Name';
         $ossPaymentsIn->column_fields['paymentsvalue'] = $fields['amount'];
         $ossPaymentsIn->column_fields['paymentscurrency'] = $fields['third_letter_currency_code'];
         $ossPaymentsIn->column_fields['paymentstitle'] = $fields['details']['title'];
         $ossPaymentsIn->column_fields['bank_account'] = $fields['details']['contAccount'];
         $saved = $ossPaymentsIn->save('PaymentsIn');
         if ($saved == false) {
             $bag = true;
         }
     }
     if ($bag) {
         $result = array('success' => true, 'return' => vtranslate('MSG_SAVE_OK', $moduleName));
     } else {
         $result = array('success' => false, 'return' => vtranslate('MSG_SAVE_ERROR', $moduleName));
     }
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
Ejemplo n.º 21
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $viewer = $this->getViewer($request);
     $viewer->assign('IS_RELATION', $request->get('relationOperation'));
     parent::process($request);
 }
Ejemplo n.º 22
0
 public function showFieldLayout(Vtiger_Request $request)
 {
     $sourceModule = $request->get('sourceModule');
     $menuModelsList = Vtiger_Module_Model::getQuickCreateModules();
     if (empty($sourceModule)) {
         //To get the first element
         $firstElement = reset($menuModelsList);
         $sourceModule = array($firstElement->get('name'));
     } else {
         $sourceModule = array($sourceModule);
     }
     $quickCreateContents = array();
     if (in_array('Calendar', $sourceModule)) {
         $sourceModule = array('Calendar', 'Events');
     }
     foreach ($sourceModule as $module) {
         $recordModel = Vtiger_Record_Model::getCleanInstance($module);
         $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
         $quickCreateContents[$module] = $recordStructureInstance->getStructure();
     }
     $qualifiedModule = $request->getModule(false);
     $viewer = $this->getViewer($request);
     $viewer->assign('SELECTED_MODULE_NAME', $sourceModule[0]);
     $viewer->assign('SUPPORTED_MODULES', $menuModelsList);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('RECORDS_STRUCTURE', $quickCreateContents);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModule);
     $viewer->view('Index.tpl', $qualifiedModule);
 }
Ejemplo n.º 23
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $crmid = $request->get('record');
     $adb = PearDatabase::getInstance();
     $sql1 = "DELETE FROM vtiger_pdfmaker_images WHERE crmid=?";
     $adb->pquery($sql1, array($crmid));
     $sql2 = "INSERT INTO vtiger_pdfmaker_images (crmid, productid, sequence, attachmentid, width, height) VALUES (?, ?, ?, ?, ?, ?)";
     $R_Data = $request->getAll();
     foreach ($R_Data as $key => $value) {
         if (strpos($key, "img_") !== false) {
             list($bin, $productid, $sequence) = explode("_", $key);
             if ($value != "no_image") {
                 $width = $R_Data["width_" . $productid . "_" . $sequence];
                 $height = $R_Data["height_" . $productid . "_" . $sequence];
                 if (!is_numeric($width) || $width > 999) {
                     $width = 0;
                 }
                 if (!is_numeric($height) || $height > 999) {
                     $height = 0;
                 }
             } else {
                 $height = $width = $value = 0;
             }
             $adb->pquery($sql2, array($crmid, $productid, $sequence, $value, $width, $height));
         }
     }
 }
Ejemplo n.º 24
0
 function process(Vtiger_Request $request)
 {
     $branches = $request->get('branches');
     $filter = $request->get('filter');
     if (empty($branches)) {
         return;
     }
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleModel);
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('limit', 'no_limit');
     $listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $filter);
     $listViewModel->set('search_params', $treeViewModel->getSearchParams($branches));
     $listEntries = $listViewModel->getListViewEntries($pagingModel, true);
     if (count($listEntries) === 0) {
         return;
     }
     $listHeaders = $listViewModel->getListViewHeaders();
     $viewer->assign('ENTRIES', $listEntries);
     $viewer->assign('HEADERS', $listHeaders);
     $viewer->assign('MODULE', $moduleName);
     $viewer->view('TreeRecords.tpl', $moduleName);
 }
Ejemplo n.º 25
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     $sourceModule = $request->get('sourceModule');
     $viewer = $this->getViewer($request);
     $mode = '';
     $selectedFieldsList = array();
     if ($recordId) {
         $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
         $mode = 'edit';
         if ($sourceModule === $recordModel->get('targetmodule')) {
             $selectedFieldsList = $recordModel->getSelectedFieldsList();
         }
     } else {
         $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName);
     }
     $viewer->assign('MODE', $mode);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('MODULE', $qualifiedModuleName);
     $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList);
     $viewer->assign('ALL_FIELD_MODELS_LIST', $recordModel->getAllFieldsList($sourceModule));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('FieldsEditView.tpl', $qualifiedModuleName);
 }
Ejemplo n.º 26
0
 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~include/Webservices/Utils.php');
     vimport('~~include/Webservices/Retrieve.php');
     $adb = PearDatabase::getInstance();
     $wfs = new VTWorkflowManager($adb);
     $workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $wsId = vtws_getWebserviceEntityId($moduleName, $record);
     $entityCache = new VTEntityCache($currentUser);
     $entityData = $entityCache->forId($wsId);
     foreach ($workflows as $id => $workflow) {
         if (!$workflow->evaluate($entityCache, $entityData->getId())) {
             unset($workflows[$id]);
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('RECORD', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('WORKFLOWS', $workflows);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('WorkflowTrigger.tpl', $moduleName);
 }
Ejemplo n.º 27
0
 function postpone(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $module = $request->getModule();
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $module);
     $recordModel->updateReminderStatus(0);
 }
Ejemplo n.º 28
0
 public function process(Vtiger_Request $request)
 {
     //the new values are added to $_REQUEST for Ajax Save, are removing the Tax details depend on the 'ajxaction' value
     $_REQUEST['ajxaction'] = 'DETAILVIEW';
     $request->set('ajaxaction', 'DETAILVIEW');
     parent::process($request);
 }
Ejemplo n.º 29
0
 protected function getUI5EmbedURL(Vtiger_Request $request)
 {
     $module = $request->getModule();
     if ($module == 'EmailTemplate') {
         return 'index.php?module=Settings&action=listemailtemplates&parenttab=Settings';
     }
 }
Ejemplo n.º 30
0
 public function process(Vtiger_Request $request)
 {
     $resp = $request->get('resp');
     $viewer = $this->getViewer($request);
     $viewer->assign("RESP", $resp);
     $viewer->view('selectEmail.tpl', 'OSSMail');
 }