Vtiger_Request PHP Class Code Examples

This page contains top rated real world PHP examples of class Vtiger_Request extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: MiniList.php Project: cin-system/cinrepo
0
 public function process(Vtiger_Request $request, $widget = NULL)
 {
     global $log;
     $log->debug("Entering ./dashboards/MiniList.php::process");
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     // Initialize Widget to the right-state of information
     if ($widget && !$request->has('widgetid')) {
         $widgetId = $widget->get('id');
     } else {
         $widgetId = $request->get('widgetid');
     }
     $widget = Vtiger_Widget_Model::getInstanceWithWidgetId($widgetId, $currentUser->getId());
     $minilistWidgetModel = new Vtiger_MiniList_Model();
     $minilistWidgetModel->setWidgetModel($widget);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('MINILIST_WIDGET_MODEL', $minilistWidgetModel);
     $viewer->assign('BASE_MODULE', $minilistWidgetModel->getTargetModule());
     $viewer->assign('SCRIPTS', $this->getHeaderScripts());
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/MiniListContents.tpl', $moduleName);
     } else {
         $widget->set('title', $minilistWidgetModel->getTitle());
         $viewer->view('dashboards/MiniList.tpl', $moduleName);
     }
 }
Example #2
Show file File: Export.php Project: awflu/YetiForceCRM
0
 function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $source_module = $request->getModule();
     $viewId = $request->get('viewname');
     $selectedIds = $request->get('selected_ids');
     $excludedIds = $request->get('excluded_ids');
     $page = $request->get('page');
     $viewer->assign('SELECTED_IDS', $selectedIds);
     $viewer->assign('EXCLUDED_IDS', $excludedIds);
     $viewer->assign('VIEWID', $viewId);
     $viewer->assign('PAGE', $page);
     $viewer->assign('SOURCE_MODULE', $source_module);
     $viewer->assign('MODULE', 'Export');
     $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);
     }
     $viewer->assign('SEARCH_PARAMS', $request->get('search_params'));
     $viewer->view('Export.tpl', $source_module);
 }
Example #3
Show file File: ActivityReminder.php Project: cannking/vtigercrm-debug
0
 function postpone(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $module = $request->getModule();
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $module);
     $recordModel->updateReminderStatus(0);
 }
Example #4
Show file File: ForgotPassword.php Project: awflu/YetiForceCRM
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');
     }
 }
Example #5
Show file File: FindDuplicatesAjax.php Project: Bergdahls/YetiForceCRM
0
 function process(Vtiger_Request $request)
 {
     $mode = $request->getMode();
     if (!empty($mode) && method_exists($this, $mode)) {
         $this->{$mode}($request);
     }
 }
Example #6
Show file File: Edit2.php Project: Bergdahls/YetiForceCRM
0
 public function process(Vtiger_Request $request)
 {
     $moduleSettingsName = $request->getModule(false);
     $moduleName = $request->getModule();
     $baseModule = $request->get('module_name');
     $idTpl = $request->get('tpl_id');
     $viewer = $this->getViewer($request);
     if ($idTpl) {
         $docInfo = Settings_OSSDocumentControl_Module_Model::getDocInfo($idTpl);
         $viewer->assign('BASE_INFO', $docInfo['basic_info']);
         //var_dump($docInfo['required_conditions']);
         for ($i = 0; $i < count($docInfo['required_conditions']); $i++) {
             $fieldModel = Vtiger_Field_Model::getInstance($docInfo['required_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
             $docInfo['required_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
         }
         $viewer->assign('REQUIRED_CONDITIONS', $docInfo['required_conditions']);
         for ($i = 0; $i < count($docInfo['optional_conditions']); $i++) {
             $fieldModel = Vtiger_Field_Model::getInstance($docInfo['optional_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
             $docInfo['optional_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
         }
         $viewer->assign('OPTIONAL_CONDITIONS', $docInfo['optional_conditions']);
         $viewer->assign('TPL_ID', $idTpl);
         //$fieldModel = Vtiger_Field_Model::getInstance($value->get('name'), $baseModuleModel);
     }
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('SUMMARY', $request->get('summary'));
     $viewer->assign('BASE_MODULE', $baseModule);
     $viewer->assign('QUALIFIED_MODULE', $moduleSettingsName);
     $viewer->assign('FIELD_LIST', Settings_OSSDocumentControl_Module_Model::getListBaseModuleField($baseModule));
     //$viewer->assign('FOLDER_LIST', Documents_Module_Model::getAllFolders());
     $viewer->assign('CONDITION_BY_TYPE', Settings_OSSDocumentControl_Module_Model::getConditionByType());
     echo $viewer->view('Edit2.tpl', $moduleSettingsName, true);
 }
Example #7
Show file File: FunnelAmount.php Project: cannking/vtigercrm-debug
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $data = $moduleModel->getPotentialTotalAmountBySalesStage();
     $listViewUrl = $moduleModel->getListViewUrl();
     for ($i = 0; $i < count($data); $i++) {
         $data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][1]);
     }
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('DATA', $data);
     $viewer->assign('STYLES', $this->getHeaderCss($request));
     $viewer->assign('CURRENTUSER', $currentUser);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/FunnelAmount.tpl', $moduleName);
     }
 }
Example #8
Show file File: SavePDFImages.php Project: cin-system/cinrepo
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));
         }
     }
 }
Example #9
Show file File: Edit.php Project: xrstf/vtiger-mirror
0
 /**
  * Funtioin to process the Edit view
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record)) {
         $recordModel = EmailTemplates_Record_Model::getInstanceById($record);
         $viewer->assign('RECORD_ID', $record);
         $viewer->assign('MODE', 'edit');
     } else {
         $recordModel = new EmailTemplates_Record_Model();
         $viewer->assign('MODE', '');
         $recordModel->set('templatename', '');
         $recordModel->set('description', '');
         $recordModel->set('subject', '');
         $recordModel->set('body', '');
     }
     $recordModel->setModule('EmailTemplates');
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $allFiledsOptions = $this->record->getEmailTemplateFields();
     $viewer->assign('RECORD', $this->record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('ALL_FIELDS', $allFiledsOptions);
     $viewer->view('EditView.tpl', $moduleName);
 }
Example #10
Show file File: Calendar.php Project: Bergdahls/YetiForceCRM
0
 function postProcess(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $viewer->view('CalendarViewPostProcess.tpl', $moduleName);
     parent::postProcess($request);
 }
Example #11
Show file File: QuickCreateAjax.php Project: Bergdahls/YetiForceCRM
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $viewer = $this->getViewer($request);
     $viewer->assign('IS_RELATION', $request->get('relationOperation'));
     parent::process($request);
 }
Example #12
Show file File: Detail.php Project: nikdejan/YetiForceCRM
0
 function showRelatedProductsServices(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $moduleName = $request->getModule();
     if (!$this->record) {
         $this->record = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
     }
     $recordModel = $this->record->getRecord();
     $detailViewLinkParams = array('MODULE' => $moduleName, 'RECORD' => $recordId);
     $detailViewLinks = $this->record->getDetailViewLinks($detailViewLinkParams);
     $viewer = $this->getViewer($request);
     $viewer->assign('RECORDID', $recordId);
     $viewer->assign('RECORD', $recordModel);
     //$viewer->assign('MODULE_SUMMARY', $this->showModuleSummaryView($request));
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('IS_AJAX_ENABLED', $this->isAjaxEnabled($recordModel));
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('LIMIT', 'no_limit');
     $recordStrucure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_DETAIL);
     $structuredValues = $recordStrucure->getStructure();
     $moduleModel = $recordModel->getModule();
     $viewer->assign('RECORD_STRUCTURE', $structuredValues);
     $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
     echo $viewer->view('DetailViewProductsServicesContents.tpl', $moduleName, true);
 }
Example #13
Show file File: TimeControl.php Project: Bergdahls/YetiForceCRM
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $loggedUserId = $currentUser->get('id');
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $user = $request->get('user');
     $time = $request->get('time');
     if ($time == NULL) {
         $time['start'] = date('Y-m-d', strtotime("-1 week"));
         $time['end'] = date("Y-m-d");
     } else {
         // date parameters passed, convert them to YYYY-mm-dd
         $time['start'] = Vtiger_Functions::currentUserDisplayDate($time['start']);
         $time['end'] = Vtiger_Functions::currentUserDisplayDate($time['end']);
     }
     if ($user == NULL) {
         $user = $loggedUserId;
     }
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $data = $this->getWidgetTimeControl($user, $time);
     $daysAmount = count($data['ticks']);
     $listViewUrl = 'index.php?module=OSSTimeControl&view=List';
     for ($i = 0; $i < $daysAmount; $i++) {
         $data['links'][$i][0] = $i;
         $data['links'][$i][1] = $listViewUrl . $this->getSearchParams($user, $data['days'][$i]);
     }
     $publicHolidays = Settings_PublicHoliday_Module_Model::getHolidayGroupType([$time['start'], $time['end']]);
     if ($publicHolidays) {
         foreach ($publicHolidays as $key => $value) {
             $upperCase = strtoupper($key);
             $viewer->assign($upperCase, $value);
         }
     }
     $TCPModuleModel = Settings_TimeControlProcesses_Module_Model::getCleanInstance();
     $viewer->assign('TCPMODULE_MODEL', $TCPModuleModel->getConfigInstance());
     $viewer->assign('USERID', $user);
     $viewer->assign('DTIME', $time);
     $viewer->assign('WORKDAYS', $data['workDays']);
     $viewer->assign('WORKEDDAYS', $data['daysWorked']);
     $viewer->assign('HOLIDAYDAYS', $data['holiayDays']);
     $viewer->assign('AVERAGEBREAKTIME', $data['sumBreakTime']);
     $viewer->assign('WORKINGDAYS', $data['workingDays']);
     $viewer->assign('WEEKENDDAYS', $data['weekends']);
     $viewer->assign('AVERAGEWORKTIME', $data['averageWorkingTime']);
     $viewer->assign('ALLDAYS', $data['allDays']);
     $viewer->assign('DATA', $data);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('CURRENTUSER', $currentUser);
     $viewer->assign('LOGGEDUSERID', $loggedUserId);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/TimeControlContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/TimeControl.tpl', $moduleName);
     }
 }
Example #14
Show file File: ExportData.php Project: cannking/vtigercrm-debug
0
 /**
  * Function returns the export type - This can be extended to support different file exports
  * @param Vtiger_Request $request
  * @return <String>
  */
 function getExportContentType(Vtiger_Request $request)
 {
     $type = $request->get('export_type');
     if (empty($type)) {
         return 'text/csv';
     }
 }
Example #15
Show file File: Holiday.php Project: Bergdahls/YetiForceCRM
0
 /**
  * Save date
  * @param <Object> $request
  * @return true if saved, false otherwise
  */
 public function save(Vtiger_Request $request)
 {
     $response = new Vtiger_Response();
     $moduleName = 'Settings:' . $request->getModule();
     try {
         $id = $request->get('holidayId');
         $date = DateTimeField::convertToDBFormat($request->get('holidayDate'));
         $name = $request->get('holidayName');
         $type = $request->get('holidayType');
         if (empty($name) || empty($date)) {
             $response->setResult(array('success' => false, 'message' => vtranslate('LBL_FILL_FORM_ERROR', $moduleName)));
         } else {
             if (!empty($id)) {
                 if (Settings_PublicHoliday_Module_Model::edit($id, $date, $name, $type)) {
                     $response->setResult(array('success' => true, 'message' => vtranslate('LBL_EDIT_DATE_OK', $moduleName)));
                 } else {
                     $response->setResult(array('success' => false, 'message' => vtranslate('LBL_EDIT_DATE_ERROR', $moduleName)));
                 }
             } else {
                 if (Settings_PublicHoliday_Module_Model::save($date, $name, $type)) {
                     $response->setResult(array('success' => true, 'message' => vtranslate('LBL_NEW_DATE_OK', $moduleName)));
                 } else {
                     $response->setResult(array('success' => false, 'message' => vtranslate('LBL_NEW_DATE_ERROR', $moduleName)));
                 }
             }
         }
     } catch (Exception $e) {
         $response->setError($e->getCode(), $e->getMessage());
     }
     $response->emit();
 }
Example #16
Show file File: Check.php Project: cin-system/cinrepo
0
 public function process(Vtiger_Request $request)
 {
     $this->dirToArray(vglobal("root_directory") . "modules/Workflow2/");
     $this->dirToArray(vglobal("root_directory") . "modules/Settings/Workflow2/");
     $this->dirToArray(vglobal("root_directory") . "layouts/vlayout/modules/Workflow2/");
     echo "<p><strong>FINISHED</strong></p>";
 }
Example #17
Show file File: MoreCurrenciesList.php Project: Bergdahls/YetiForceCRM
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');
 }
Example #18
Show file File: LeadsCreated.php Project: Bergdahls/YetiForceCRM
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $createdTime = $request->get('createdtime');
     $owner = $request->get('owner');
     //Date conversion from user to database format
     if (!empty($createdTime)) {
         $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
         $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
     }
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $data = $moduleModel->getLeadsCreated($owner, $dates);
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     //Include special script and css needed for this widget
     $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('DATA', $data);
     $viewer->assign('CURRENTUSER', $currentUser);
     $accessibleUsers = $currentUser->getAccessibleUsersForModule('Leads');
     $viewer->assign('ACCESSIBLE_USERS', $accessibleUsers);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/LeadsCreated.tpl', $moduleName);
     }
 }
Example #19
Show file File: GroupedBySalesPerson.php Project: cannking/vtigercrm-debug
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $data = $moduleModel->getPotentialsCountBySalesPerson();
     $listViewUrl = $moduleModel->getListViewUrl();
     for ($i = 0; $i < count($data); $i++) {
         $data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i]["last_name"], $data[$i]["sales_stage"]);
     }
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('DATA', $data);
     //Include special script and css needed for this widget
     $viewer->assign('STYLES', $this->getHeaderCss($request));
     $viewer->assign('CURRENTUSER', $currentUser);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/GroupBySalesPerson.tpl', $moduleName);
     }
 }
Example #20
Show file File: GetSourceModuleFields.php Project: Bergdahls/YetiForceCRM
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $moduleName = $request->getModule();
     $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('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('MODE', $mode);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('MODULE', $moduleName);
     $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);
 }
Example #21
Show file File: Save.php Project: awflu/YetiForceCRM
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
  */
 protected function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('mode', '');
     }
     $fieldModelList = $moduleModel->getFields();
     foreach ($fieldModelList as $fieldName => $fieldModel) {
         $fieldValue = $request->get($fieldName, null);
         $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;
 }
Example #22
Show file File: FindDuplicate.php Project: Bergdahls/YetiForceCRM
0
 public function getMassDeleteRecords(Vtiger_Request $request)
 {
     $db = PearDatabase::getInstance();
     $module = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($module);
     $fields = $request->get('fields');
     $ignoreEmpty = $request->get('ignoreEmpty');
     $ignoreEmptyValue = false;
     if ($ignoreEmpty == 'on') {
         $ignoreEmptyValue = true;
     }
     $fieldModels = $moduleModel->getFields();
     if (is_array($fields)) {
         foreach ($fields as $fieldName) {
             $fieldModel = $fieldModels[$fieldName];
             $tableColumns[] = $fieldModel->get('table') . '.' . $fieldModel->get('column');
         }
     }
     $focus = CRMEntity::getInstance($module);
     $query = $focus->getQueryForDuplicates($module, $tableColumns, '', $ignoreEmpty);
     $result = $db->query($query);
     $recordIds = [];
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $recordIds[] = $db->query_result($result, $i, 'recordid');
     }
     $excludedIds = $request->get('excluded_ids');
     $recordIds = array_diff($recordIds, $excludedIds);
     return $recordIds;
 }
Example #23
Show file File: MassSaveAjax.php Project: yozhi/YetiForceCRM
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;
 }
Example #24
Show file File: SaveAjax.php Project: Bergdahls/YetiForceCRM
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);
 }
Example #25
Show file File: WorkflowTrigger.php Project: awflu/YetiForceCRM
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);
 }
Example #26
Show file File: GenerateRecords.php Project: awflu/YetiForceCRM
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();
 }
Example #27
Show file File: MoveDocuments.php Project: awflu/YetiForceCRM
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();
 }
Example #28
Show file File: ForgotPassword.php Project: xrstf/vtiger-mirror
0
 public function changePassword($request)
 {
     $request = new Vtiger_Request($request);
     $viewer = Vtiger_Viewer::getInstance();
     $userName = $request->get('username');
     $newPassword = $request->get('password');
     $confirmPassword = $request->get('confirmPassword');
     $shortURLID = $request->get('shorturl_id');
     $secretHash = $request->get('secret_hash');
     $shortURLModel = Vtiger_ShortURL_Helper::getInstance($shortURLID);
     $secretToken = $shortURLModel->handler_data['secret_token'];
     $validateData = array('username' => $userName, 'secret_token' => $secretToken, 'secret_hash' => $secretHash);
     $valid = $shortURLModel->compareEquals($validateData);
     if ($valid) {
         $userId = getUserId_Ol($userName);
         $user = Users::getActiveAdminUser();
         $wsUserId = vtws_getWebserviceEntityId('Users', $userId);
         vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
     } else {
         $viewer->assign('ERROR', true);
     }
     $shortURLModel->delete();
     $viewer->assign('USERNAME', $userName);
     $viewer->assign('PASSWORD', $newPassword);
     $viewer->view('FPLogin.tpl', 'Users');
 }
Example #29
Show file File: Save.php Project: yozhi/YetiForceCRM
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");
 }
Example #30
Show file File: ListUI5.php Project: cannking/vtigercrm-debug
0
 protected function getUI5EmbedURL(Vtiger_Request $request)
 {
     $module = $request->getModule();
     if ($module == 'EmailTemplate') {
         return 'index.php?module=Settings&action=listemailtemplates&parenttab=Settings';
     }
 }