Example #1
0
 public function process(Vtiger_Request $request)
 {
     $mode = $request->get('mode');
     if (!empty($mode)) {
         $this->invokeExposedMethod($mode, $request);
         return;
     }
     $recordModel = $this->saveRecord($request);
     $settingsModuleModel = Settings_Users_Module_Model::getInstance();
     $settingsModuleModel->refreshSwitchUsers();
     $fieldModelList = $recordModel->getModule()->getFields();
     $result = array();
     foreach ($fieldModelList as $fieldName => $fieldModel) {
         $fieldValue = $displayValue = Vtiger_Util_Helper::toSafeHTML($recordModel->get($fieldName));
         if ($fieldModel->getFieldDataType() !== 'currency') {
             $displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId());
         }
         if ($fieldName == 'language') {
             $displayValue = Vtiger_Language_Handler::getLanguageLabel($fieldValue);
         }
         if (($fieldName == 'currency_decimal_separator' || $fieldName == 'currency_grouping_separator') && $displayValue == ' ') {
             $displayValue = vtranslate('LBL_SPACE', 'Users');
         }
         $result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue);
     }
     $result['_recordLabel'] = $recordModel->getName();
     $result['_recordId'] = $recordModel->getId();
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     $response->setResult($result);
     $response->emit();
 }
Example #2
0
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $adb = PearDatabase::getInstance();
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     $viewer = $this->getViewer($request);
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     list($oLabels, $languages) = $PDFMaker->GetCustomLabels();
     $currLang = array();
     foreach ($languages as $langId => $langVal) {
         if ($langVal["prefix"] == $currentLanguage) {
             $currLang["id"] = $langId;
             $currLang["name"] = $langVal["name"];
             $currLang["label"] = $langVal["label"];
             $currLang["prefix"] = $langVal["prefix"];
             break;
         }
     }
     $viewLabels = array();
     foreach ($oLabels as $lblId => $oLabel) {
         $viewLabels[$lblId]["key"] = $oLabel->GetKey();
         $viewLabels[$lblId]["lang_values"] = $oLabel->GetLangValsArr();
     }
     $viewer->assign("LABELS", $viewLabels);
     $viewer->assign("LANGUAGES", $languages);
     $viewer->assign("CURR_LANG", $currLang);
     $viewer->view('CustomLabels.tpl', 'PDFMaker');
 }
Example #3
0
 public function process(Vtiger_Request $request)
 {
     $mode = $request->get('mode');
     if (!empty($mode)) {
         $this->invokeExposedMethod($mode, $request);
         return;
     }
     $recordModel = $this->saveRecord($request);
     $fieldModelList = $recordModel->getModule()->getFields();
     $result = array();
     foreach ($fieldModelList as $fieldName => $fieldModel) {
         $fieldValue = $displayValue = Vtiger_Util_Helper::toSafeHTML($recordModel->get($fieldName));
         if ($fieldModel->getFieldDataType() !== 'currency') {
             $displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId());
         }
         if ($fieldName == 'language') {
             $displayValue = Vtiger_Language_Handler::getLanguageLabel($fieldValue);
         }
         $result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue);
     }
     $result['_recordLabel'] = $recordModel->getName();
     $result['_recordId'] = $recordModel->getId();
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     $response->setResult($result);
     $response->emit();
 }
Example #4
0
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($value)
 {
     if ($value == 1 || $value == '1' || strtolower($value) == 'on') {
         return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
     }
     return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
 }
Example #5
0
 protected function _getFile($id, $moduleName, $crmid)
 {
     $current_user = \Users_Record_Model::getCurrentUserModel();
     $useUser = \Users::getActiveAdminUser();
     $oldUser = vglobal('current_user');
     vglobal('current_user', $useUser);
     $tmpFilename = $this->_getTmpFilename();
     $mpdf = "";
     $language = $current_user->language;
     if (empty($language)) {
         $language = \Vtiger_Language_Handler::getLanguage();
     }
     $Records = array($crmid);
     // $request = $_REQUEST;
     // $_REQUEST['search'] = true;
     //$_REQUEST['submode'] = true;
     \Vtiger_Loader::autoLoad('PDFMaker_PDFMaker_Model');
     $PDFMaker = new \PDFMaker_PDFMaker_Model();
     $name = $PDFMaker->GetPreparedMPDF($mpdf, $Records, array($id), $moduleName, $language);
     $name = $PDFMaker->generate_cool_uri($name);
     if ($name != "") {
         $name = $name . ".pdf";
     }
     $mpdf->Output($tmpFilename);
     vglobal('current_user', $oldUser);
     $filetype = "application/pdf";
     //$_REQUEST = $request;
     return array('path' => $tmpFilename, 'name' => $name, 'type' => $filetype);
 }
Example #6
0
 public function preProcess(Vtiger_Request $request)
 {
     date_default_timezone_set('Europe/London');
     // to overcome the pre configuration settings
     // Added to redirect to default module if already installed
     $request->set('module', 'Install');
     $configFileName = 'config/config.inc.php';
     if (is_file($configFileName) && filesize($configFileName) > 0) {
         $defaultModule = vglobal('default_module');
         $defaultModuleInstance = Vtiger_Module_Model::getInstance($defaultModule);
         $defaultView = $defaultModuleInstance->getDefaultViewName();
         header('Location:../index.php?module=' . $defaultModule . '&view=' . $defaultView);
         exit;
     }
     $request = $this->setLanguage($request);
     $_SESSION['default_language'] = $defaultLanguage = $request->get('lang') ? $request->get('lang') : 'en_us';
     vglobal('default_language', $defaultLanguage);
     $viewer = new Vtiger_Viewer();
     $viewer->setTemplateDir('install/tpl/');
     $viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
     $viewer->assign('HTMLLANG', Vtiger_Language_Handler::getShortLanguageName());
     define('INSTALLATION_MODE', true);
     define('INSTALLATION_MODE_DEBUG', $this->debug);
     echo $viewer->fetch('InstallPreProcess.tpl');
 }
Example #7
0
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($value)
 {
     global $log;
     $log->debug("Entering ./uitypes/Boolean.php::getDisplayValue");
     if ($value == 1 || $value == '1' || strtolower($value) == 'on') {
         return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
     }
     return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
 }
Example #8
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 getHeaderScripts(Vtiger_Request $request)
 {
     $headerScriptInstances = parent::getHeaderScripts($request);
     $moduleName = $request->getModule();
     $jsFileNames = array('libraries.bootstrap.js.eternicode-bootstrap-datepicker.js.bootstrap-datepicker', '~libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/locales/bootstrap-datepicker.' . Vtiger_Language_Handler::getShortLanguageName() . '.js', '~libraries/jquery/timepicker/jquery.timepicker.min.js', 'modules.Vtiger.resources.Popup', "modules.{$moduleName}.resources.Popup", 'modules.Vtiger.resources.BaseList', "modules.{$moduleName}.resources.BaseList", 'libraries.jquery.jquery_windowmsg', 'modules.Vtiger.resources.validator.BaseValidator', 'modules.Vtiger.resources.validator.FieldValidator', "modules.{$moduleName}.resources.validator.FieldValidator");
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
     return $headerScriptInstances;
 }
Example #9
0
 public static function vtranslateMenu($key, $module)
 {
     $language = Vtiger_Language_Handler::getLanguage();
     $moduleStrings = Vtiger_Language_Handler::getModuleStringsFromFile($language, 'Menu');
     if (array_key_exists($key, $moduleStrings['languageStrings'])) {
         return stripslashes($moduleStrings['languageStrings'][$key]);
     }
     return vtranslate($key, $module);
 }
Example #10
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 getFooterScripts(Vtiger_Request $request)
 {
     $headerScriptInstances = parent::getFooterScripts($request);
     $moduleName = $request->getModule();
     $jsFileNames = array('libraries.bootstrap.js.eternicode-bootstrap-datepicker.js.bootstrap-datepicker', '~libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/locales/bootstrap-datepicker.' . Vtiger_Language_Handler::getShortLanguageName() . '.js', '~libraries/jquery/timepicker/jquery.timepicker.min.js', '~libraries/jquery/inputmask/jquery.inputmask.js', '~libraries/jquery/mousetrap/mousetrap.min.js', 'modules.Vtiger.resources.Menu', 'modules.Vtiger.resources.Header', 'modules.Vtiger.resources.Edit', "modules.{$moduleName}.resources.Edit", 'modules.Vtiger.resources.Popup', "modules.{$moduleName}.resources.Popup", 'modules.Vtiger.resources.Field', "modules.{$moduleName}.resources.Field", 'modules.Vtiger.resources.validator.BaseValidator', 'modules.Vtiger.resources.validator.FieldValidator', "modules.{$moduleName}.resources.validator.FieldValidator", 'libraries.jquery.jquery_windowmsg', 'modules.Vtiger.resources.BasicSearch', "modules.{$moduleName}.resources.BasicSearch", 'modules.Vtiger.resources.AdvanceFilter', "modules.{$moduleName}.resources.AdvanceFilter", 'modules.Vtiger.resources.SearchAdvanceFilter', "modules.{$moduleName}.resources.SearchAdvanceFilter", 'modules.Vtiger.resources.AdvanceSearch', "modules.{$moduleName}.resources.AdvanceSearch", 'modules.Vtiger.resources.Mobile', 'modules.Settings.DataAccess.resources.SaveResult');
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
     return $headerScriptInstances;
 }
Example #11
0
	/**
	 * Function to get the Display Value, for the current field type with given DB Insert Value
	 * @param <Object> $value
	 * @return <Object>
	 */
	public function getDisplayValue($value)
	{
		if ($value === 1 || $value === '1' || strtolower($value) === 'on' || strtolower($value) === 'yes' || true === $value) {
			return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
		} else if ($value === 0 || $value === '0' || strtolower($value) === 'off' || strtolower($value) === 'no' || false === $value) {
			return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
		}

		return $value;
	}
Example #12
0
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($value, $record = false, $recordInstance = false, $rawText = false)
 {
     $value = explode(' |##| ', $value);
     $trValue = array();
     for ($i = 0; $i < count($value); $i++) {
         $trValue[] = Vtiger_Language_Handler::getTranslatedString($value[$i], $this->get('field')->getModuleName());
     }
     if (is_array($trValue)) {
         $trValue = implode(' |##| ', $trValue);
     }
     return str_ireplace(' |##| ', ', ', $trValue);
 }
 public function preProcess(Vtiger_Request $request, $display = true)
 {
     if ($this->checkPermission($request)) {
         $viewer = $this->getViewer($request);
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $selectedModule = $request->getModule();
         $companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
         $companyLogo = $companyDetails->getLogo();
         $currentDate = Vtiger_Date_UIType::getDisplayDateValue(date('Y-n-j'));
         $viewer->assign('CURRENTDATE', $currentDate);
         $viewer->assign('MODULE', $selectedModule);
         $viewer->assign('MODULE_NAME', $selectedModule);
         $viewer->assign('QUALIFIED_MODULE', $selectedModule);
         $viewer->assign('PARENT_MODULE', $request->get('parent'));
         $viewer->assign('MENUS', Vtiger_Menu_Model::getAll(true));
         $viewer->assign('VIEW', $request->get('view'));
         $viewer->assign('COMPANY_LOGO', $companyLogo);
         $viewer->assign('USER_MODEL', $currentUser);
         $homeModuleModel = Vtiger_Module_Model::getInstance('Home');
         $viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
         $viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
         $viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
         $viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
         $viewer->assign('CHAT_ACTIVE', vtlib_isModuleActive('AJAXChat'));
         //Additional parameters
         $recordId = $request->get('record');
         $moduleName = $request->getModule();
         $detailViewModel = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
         $recordModel = $detailViewModel->getRecord();
         $detailViewLinkParams = array('MODULE' => $moduleName, 'RECORD' => $recordId);
         $detailViewLinks = $detailViewModel->getDetailViewLinks($detailViewLinkParams);
         $viewer->assign('RECORD', $recordModel);
         $viewer->assign('MODULE_MODEL', $detailViewModel->getModule());
         $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
         $viewer->assign('IS_EDITABLE', $detailViewModel->getRecord()->isEditable($moduleName));
         $viewer->assign('IS_DELETABLE', $detailViewModel->getRecord()->isDeletable($moduleName));
         $linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
         $linkModels = $detailViewModel->getSideBarLinks($linkParams);
         $viewer->assign('QUICK_LINKS', $linkModels);
         $viewer->assign('PAGETITLE', $this->getPageTitle($request));
         $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
         $viewer->assign('STYLES', $this->getHeaderCss($request));
         $viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
         $viewer->assign('CURRENT_VIEW', $request->get('view'));
         $viewer->assign('SKIN_PATH', Vtiger_Theme::getCurrentUserThemePath());
         $viewer->assign('HTMLLANG', Vtiger_Language_Handler::getShortLanguageName());
         $viewer->assign('LANGUAGE', $currentUser->get('language'));
         if ($display) {
             $this->preProcessDisplay($request);
         }
     }
 }
Example #14
0
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["pcjpcgy"] = "current_user";
     global $root_directory;
     ${"GLOBALS"}["qnnpnmctvkh"] = "adb";
     ${"GLOBALS"}["sbwrerrdfpiq"] = "viewer";
     ${${"GLOBALS"}["pcjpcgy"]} = ${${"GLOBALS"}["enwvewqev"]} = Users_Record_Model::getCurrentUserModel();
     ${${"GLOBALS"}["myvnqjtagyw"]} = Vtiger_Language_Handler::getLanguage();
     ${${"GLOBALS"}["qnnpnmctvkh"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["sbwrerrdfpiq"]} = $this->getViewer(${${"GLOBALS"}["klrvtdauww"]});
     $viewer->assign("lastUrl", $_SESSION["_url_before_import"]);
     $viewer->view("ImporterStep3.tpl", "Workflow2");
 }
Example #15
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $settings_block = $request->get('block');
     $settings_fieldid = $request->get('fieldid');
     $viewer->assign('LANGUAGES', Vtiger_Language_Handler::getAllLanguages());
     $viewer->assign('ALL_MODULES', Vtiger_Module_Model::getEntityModules());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SETTINGS_BLOCK', $settings_block);
     $viewer->assign('SETTINGS_FIELDID', $settings_fieldid);
     echo $viewer->view('List.tpl', $qualifiedModuleName, true);
 }
	public function preProcess(Vtiger_Request $request, $display = true)
	{
		if ($this->checkPermission($request)) {
			$currentUser = Users_Record_Model::getCurrentUserModel();
			$viewer = $this->getViewer($request);

			$selectedModule = $request->getModule();
			$companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
			$companyLogo = $companyDetails->getLogo();
			$currentDate = Vtiger_Date_UIType::getDisplayDateValue(date('Y-n-j'));
			$viewer->assign('CURRENTDATE', $currentDate);
			$viewer->assign('MODULE', $selectedModule);
			$viewer->assign('MODULE_NAME', $selectedModule);
			$viewer->assign('QUALIFIED_MODULE', $selectedModule);
			$viewer->assign('PARENT_MODULE', $request->get('parent'));
			$viewer->assign('MENUS', Vtiger_Menu_Model::getAll(true));
			$viewer->assign('VIEW', $request->get('view'));
			$viewer->assign('COMPANY_LOGO', $companyLogo);
			$viewer->assign('USER_MODEL', $currentUser);

			$homeModuleModel = Vtiger_Module_Model::getInstance('Home');
			$viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
			$viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
			$viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
			$viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
			$viewer->assign('CHAT_ACTIVE', vtlib_isModuleActive('AJAXChat'));

			//Additional parameters
			$viewer->assign('CURRENT_VIEW', $request->get('view'));
			$viewer->assign('PAGETITLE', $this->getPageTitle($request));
			$viewer->assign('FOOTER_SCRIPTS', $this->getFooterScripts($request));
			$viewer->assign('STYLES', $this->getHeaderCss($request));
			$viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
			$viewer->assign('SKIN_PATH', Vtiger_Theme::getCurrentUserThemePath());
			$viewer->assign('IS_PREFERENCE', true);
			$viewer->assign('HTMLLANG', Vtiger_Language_Handler::getShortLanguageName());
			$viewer->assign('LANGUAGE', $currentUser->get('language'));

			$allUsers = Users_Record_Model::getAll(true);
			$sharedUsers = Calendar_Module_Model::getCaledarSharedUsers($currentUser->id);
			$sharedType = Calendar_Module_Model::getSharedType($currentUser->id);
			$viewer->assign('ALL_USERS', $allUsers);
			$viewer->assign('SHAREDUSERS', $sharedUsers);
			$viewer->assign('SHARED_TYPE', $sharedType);
			$viewer->assign('HEADER_SCRIPTS', $this->getHeaderScripts($request));
			if ($display) {
				$this->preProcessDisplay($request);
			}
		}
	}
Example #17
0
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $adb = PearDatabase::getInstance();
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     $viewer = $this->getViewer($request);
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     $sql = "SELECT * FROM vtiger_pdfmaker_productbloc_tpl";
     $result = $adb->pquery($sql, array());
     while ($row = $adb->fetchByAssoc($result)) {
         $templates[$row["id"]]["name"] = $row["name"];
         $templates[$row["id"]]["body"] = html_entity_decode($row["body"], ENT_QUOTES);
     }
     $viewer->assign("PB_TEMPLATES", $templates);
     $viewer->view('ProductBlocks.tpl', 'PDFMaker');
 }
Example #18
0
 public static function its4You_is_in_vtiger_php($language, $key, $module = '')
 {
     //    $moduleStrings = array();
     $is_in_vtiger = 0;
     //if $key is in global->vtiger.php return 1(true)
     $module = str_replace(':', '.', $module);
     $moduleStrings = Vtiger_Language_Handler::getModuleStringsFromFile($language, $module);
     if (!empty($moduleStrings['languageStrings'][$key])) {
         //return $moduleStrings['languageStrings'][$key];
         return $is_in_vtiger = 0;
     }
     $commonStrings = Vtiger_Language_Handler::getModuleStringsFromFile($language);
     if (!empty($commonStrings['languageStrings'][$key])) {
         //return $commonStrings['languageStrings'][$key];
         return $is_in_vtiger = 1;
     }
     return $is_in_vtiger;
 }
 public function process(Vtiger_Request $request)
 {
     $current_user = $cu_model = Users_Record_Model::getCurrentUserModel();
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     $adb = PearDatabase::getInstance();
     $viewer = $this->getViewer($request);
     $module = $request->get('source_module');
     $crmid = (int) $request->get('record');
     $tabid = getTabid($module);
     $sidebar_id = intval($_REQUEST["sID"]);
     $sql = "SELECT content FROM vtiger_tools_sidebar WHERE id = " . intval($sidebar_id) . " AND tabid = " . $tabid;
     $result = $adb->query($sql);
     $sidebar = $adb->fetchByAssoc($result);
     \SwVtTools\VTEntity::setUser($current_user);
     $context = \SwVtTools\VTEntity::getForId($crmid, $_POST["return_module"]);
     $content = \SwVtTools\VTTemplate::parse(html_entity_decode($sidebar["content"], ENT_QUOTES, 'UTF-8'), $context);
     echo $content;
 }
Example #20
0
 public function process(Vtiger_Request $request)
 {
     $erkmdzn = "current_user";
     ${"GLOBALS"}["mikcukceq"] = "currentLanguage";
     $hiiwti = "cu_model";
     ${"GLOBALS"}["uamgnjdvbvfm"] = "viewer";
     ${$erkmdzn} = ${$hiiwti} = Users_Record_Model::getCurrentUserModel();
     ${${"GLOBALS"}["mikcukceq"]} = Vtiger_Language_Handler::getLanguage();
     ${${"GLOBALS"}["ussanpzh"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["uamgnjdvbvfm"]} = $this->getViewer(${${"GLOBALS"}["egducrxosoh"]});
     $jvnhnmr = "workflows";
     ${${"GLOBALS"}["qtdwase"]} = $request->get("source_module");
     ${${"GLOBALS"}["lmznaofkdcm"]} = new Workflow2();
     ${$jvnhnmr} = $objWorkflow->getWorkflowsForModule(${${"GLOBALS"}["qtdwase"]}, 1, "WF2_IMPORTER");
     $_SESSION["_url_before_import"] = $request->get("currentUrl");
     $viewer->assign("workflows", ${${"GLOBALS"}["gbtyficqodq"]});
     $viewer->view("ImporterStep1.tpl", "Workflow2");
 }
Example #21
0
 function editCustomLabel(Vtiger_Request $request)
 {
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     $viewer = $this->getViewer($request);
     $slabelid = $request->get('labelid');
     $slangid = $request->get('langid');
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     $moduleName = $request->getModule();
     $viewer->assign('MODULE', $moduleName);
     list($oLabels, $languages) = $PDFMaker->GetCustomLabels();
     $currLang = array();
     foreach ($languages as $langId => $langVal) {
         if ($langId == $slangid && $slangid != "" || $slangid == "" && $langVal["prefix"] == $currentLanguage) {
             $currLang["id"] = $langId;
             $currLang["name"] = $langVal["name"];
             $currLang["label"] = $langVal["label"];
             $currLang["prefix"] = $langVal["prefix"];
             break;
         }
     }
     if ($slangid == "") {
         $slangid = $currLang["id"];
     }
     $viewer->assign('LABELID', $slabelid);
     $viewer->assign('LANGID', $slangid);
     $viewLabels = array();
     foreach ($oLabels as $lblId => $oLabel) {
         if ($slabelid == $lblId) {
             $l_key = substr($oLabel->GetKey(), 2);
             $l_values = $oLabel->GetLangValsArr();
             //echo "id=".$currLang["id"];
             $viewer->assign("CUSTOM_LABEL_KEY", $l_key);
             $viewer->assign("CUSTOM_LABEL_VALUE", $l_values[$currLang["id"]]);
             break;
         }
     }
     $viewer->assign("CURR_LANG", $currLang);
     echo $viewer->view('EditCustomLabel.tpl', 'PDFMaker', true);
 }
Example #22
0
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["dpplygv"] = "module";
     $gdtleqjpkdsh = "crmid";
     ${"GLOBALS"}["auyafnnce"] = "waitingRST";
     $haauhnidlo = "sql";
     $ltqivoyu = "adb";
     $tislpkpngsol = "request";
     $itkrgfcibt = "waiting";
     $brgjuxus = "crmid";
     $ihjgddsfo = "cu_model";
     ${${"GLOBALS"}["pxuwujbkkm"]} = ${$ihjgddsfo} = Users_Record_Model::getCurrentUserModel();
     ${"GLOBALS"}["yemuhpxpdnq"] = "viewer";
     ${${"GLOBALS"}["kaqzwjtnc"]} = Vtiger_Language_Handler::getLanguage();
     ${$ltqivoyu} = PearDatabase::getInstance();
     ${${"GLOBALS"}["yemuhpxpdnq"]} = $this->getViewer(${$tislpkpngsol});
     ${${"GLOBALS"}["dpplygv"]} = $request->get("source_module");
     ${${"GLOBALS"}["nfzomvg"]} = (int) $request->get("crmid");
     $lpkmsdfy = "row";
     ${$haauhnidlo} = "SELECT\n                    *\n                FROM\n                    vtiger_wf_entityddata\n                WHERE\n                    vtiger_wf_entityddata.crmid = " . ${$gdtleqjpkdsh} . "";
     $jvcckdhwm = "waitingRST";
     ${${"GLOBALS"}["auyafnnce"]} = $adb->query(${${"GLOBALS"}["csoiribry"]}, true);
     ${$itkrgfcibt} = array();
     while (${$lpkmsdfy} = $adb->fetchByAssoc(${$jvcckdhwm})) {
         $qhlgfswqh = "row";
         $nhzoipi = "row";
         $kgtwmjpd = "row";
         ${"GLOBALS"}["zxbipozhknd"] = "row";
         ${$nhzoipi}["modified"] = DateTimeField::convertToUserFormat(${${"GLOBALS"}["zxbipozhknd"]}["modified"]);
         ${${"GLOBALS"}["llcomooxgjot"]}["value"] = @unserialize(html_entity_decode(${$qhlgfswqh}["value"]));
         ${${"GLOBALS"}["jyvlypyp"]}[] = ${$kgtwmjpd};
     }
     $viewer->assign("crmid", ${$brgjuxus});
     $viewer->assign("entityData", ${${"GLOBALS"}["jyvlypyp"]});
     $viewer->view("EntityData.tpl", "Workflow2");
 }
Example #23
0
 function process(Vtiger_Request $request)
 {
     vglobal('log', LoggerManager::getLogger('System'));
     Vtiger_Session::init();
     $forceSSL = vglobal('forceSSL');
     if ($forceSSL && !Vtiger_Functions::getBrowserInfo()->https) {
         header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
     }
     // Better place this here as session get initiated
     //skipping the csrf checking for the forgot(reset) password
     $csrfProtection = vglobal('csrfProtection');
     if ($csrfProtection) {
         if ($request->get('mode') != 'reset' && $request->get('action') != 'Login') {
             require_once 'libraries/csrf-magic/csrf-magic.php';
         }
         require_once 'config/csrf_config.php';
     }
     // TODO - Get rid of global variable $current_user
     // common utils api called, depend on this variable right now
     $currentUser = $this->getLogin();
     vglobal('current_user', $currentUser);
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     vglobal('current_language', $currentLanguage);
     $module = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     if ($currentUser && $qualifiedModuleName) {
         $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage, $qualifiedModuleName);
         vglobal('mod_strings', $moduleLanguageStrings['languageStrings']);
     }
     if ($currentUser) {
         $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage);
         vglobal('app_strings', $moduleLanguageStrings['languageStrings']);
     }
     $view = $request->get('view');
     $action = $request->get('action');
     $response = false;
     try {
         if ($this->isInstalled() === false && $module != 'Install') {
             header('Location:install/Install.php');
             exit;
         }
         if (empty($module)) {
             if ($this->hasLogin()) {
                 $defaultModule = vglobal('default_module');
                 if (!empty($defaultModule) && $defaultModule != 'Home') {
                     $module = $defaultModule;
                     $qualifiedModuleName = $defaultModule;
                     $view = 'List';
                     if ($module == 'Calendar') {
                         // To load MyCalendar instead of list view for calendar
                         //TODO: see if it has to enhanced and get the default view from module model
                         $view = 'Calendar';
                     }
                 } else {
                     $module = 'Home';
                     $qualifiedModuleName = 'Home';
                     $view = 'DashBoard';
                 }
             } else {
                 $module = 'Users';
                 $qualifiedModuleName = 'Settings:Users';
                 $view = 'Login';
             }
             $request->set('module', $module);
             $request->set('view', $view);
         }
         if (!empty($action)) {
             $componentType = 'Action';
             $componentName = $action;
         } else {
             $componentType = 'View';
             if (empty($view)) {
                 $view = 'Index';
             }
             $componentName = $view;
         }
         $handlerClass = Vtiger_Loader::getComponentClassName($componentType, $componentName, $qualifiedModuleName);
         $handler = new $handlerClass();
         if ($handler) {
             vglobal('currentModule', $module);
             $csrfProtection = vglobal('csrfProtection');
             if ($csrfProtection) {
                 // Ensure handler validates the request
                 $handler->validateRequest($request);
             }
             if ($handler->loginRequired()) {
                 $this->checkLogin($request);
             }
             //TODO : Need to review the design as there can potential security threat
             $skipList = array('Users', 'Home', 'CustomView', 'Import', 'Export', 'Inventory', 'Vtiger', 'PriceBooks', 'Migration', 'Install');
             if (!in_array($module, $skipList) && stripos($qualifiedModuleName, 'Settings') === false) {
                 $this->triggerCheckPermission($handler, $request);
             }
             // Every settings page handler should implement this method
             if (stripos($qualifiedModuleName, 'Settings') === 0 || $module == 'Users') {
                 $handler->checkPermission($request);
             }
             $notPermittedModules = array('ModComments', 'Integration', 'DashBoard');
             if (in_array($module, $notPermittedModules) && $view == 'List') {
                 header('Location:index.php?module=Home&view=DashBoard');
             }
             $this->triggerPreProcess($handler, $request);
             $response = $handler->process($request);
             $this->triggerPostProcess($handler, $request);
         } else {
             throw new AppException(vtranslate('LBL_HANDLER_NOT_FOUND'));
         }
     } catch (Exception $e) {
         if ($view) {
             // Log for developement.
             error_log($e->getTraceAsString(), E_NOTICE);
             Vtiger_Functions::throwNewException($e->getMessage());
         } else {
             $response = new Vtiger_Response();
             $response->setEmitType(Vtiger_Response::$EMIT_JSON);
             $response->setError($e->getMessage());
             //Vtiger_Functions::throwNewException($e->getMessage());
         }
     }
     if ($response) {
         $response->emit();
     }
 }
Example #24
0
${"\x47\x4cO\x42\x41\x4cS"}["\x78v\x69\x76\x75\x78q"]="j\x73S\x63\x72\x69\x70\x74Ins\x74\x61\x6e\x63\x65\x73";${"G\x4c\x4f\x42A\x4c\x53"}["mwk\x69\x78t\x6cp"]="h\x65\x61\x64\x65\x72Scri\x70\x74In\x73\x74\x61\x6e\x63es";${"\x47L\x4f\x42A\x4cS"}["\x79n\x68\x6b\x6e\x74\x62\x66\x75"]="\x74m\x70";${"\x47\x4cO\x42\x41L\x53"}["b\x70x\x6e\x77\x64\x6b"]="k\x65\x79\x73";${"\x47\x4c\x4f\x42\x41L\x53"}["\x71\x6b\x7aqrx\x6dh\x75"]="\x61\x63t\x69o\x6es\x42as\x65\x41r\x72\x61\x79";${"\x47\x4cO\x42\x41LS"}["\x6e\x73\x71\x6alg\x63\x6e"]="l\x61n\x67\x75\x61g\x65";${"\x47\x4c\x4f\x42A\x4c\x53"}["\x64qt\x62\x64\x72\x65\x75\x6b\x6cx"]="\x73\x74\x79\x6c\x65\x41rr\x61\x79";${"G\x4cO\x42\x41\x4cS"}["x\x68ezc\x6f\x6c"]="u\x69\x74y\x70\x65\x73";${"G\x4c\x4fBA\x4cS"}["\x6fxhv\x65a\x70v"]="edi\x74\x43\x6f\x6e\x66\x69\x67";${"\x47\x4c\x4f\x42\x41\x4cS"}["\x6fnr\x77\x62k\x75\x62n\x6e"]="\x65\x64it\x52e\x63o\x72\x64";${"G\x4c\x4fB\x41L\x53"}["ym\x70\x67\x73\x65m"]="\x66\x69\x65\x6c\x64\x49\x6e\x64\x65x";${"\x47\x4cO\x42A\x4cS"}["\x78\x6ad\x67w\x70zq\x76\x68\x65c"]="\x62loc\x6bI\x6e\x64ex";${"\x47\x4cO\x42ALS"}["\x6amv\x79j\x6cm\x73"]="\x66\x69e\x6c\x64\x56al\x75e";${"\x47\x4c\x4fB\x41L\x53"}["\x76\x6f\x75\x65\x63nyb"]="\x62\x6c\x6f\x63\x6b\x56\x61\x6cu\x65";${"\x47L\x4f\x42\x41\x4cS"}["\x63\x6a\x78t\x6c\x65\x6b\x65"]="\x62\x6c\x6f\x63\x6b\x41n\x64F\x69e\x6c\x64s";${"G\x4c\x4f\x42\x41\x4c\x53"}["\x77\x72l\x62\x62\x67\x63\x64v\x6ds"]="\x6e\x65w\x4do\x64\x75le";${"GL\x4f\x42\x41\x4cS"}["\x64a\x6ce\x66s\x77rv\x62"]="v\x69e\x77\x65\x72";${"\x47\x4cO\x42\x41L\x53"}["iqzu\x6f\x63\x76\x71"]="\x71\x75\x61l\x69\x66\x69\x65d\x4do\x64\x75\x6c\x65\x4e\x61\x6d\x65";${"\x47\x4c\x4fBA\x4cS"}["\x71\x6b\x72t\x6ddw\x77\x73p"]="m\x6f\x64ul\x65\x4d\x6f\x64\x65\x6c";global$root_directory;$ohrjcmnruxi="r\x6fo\x74\x5fdi\x72\x65ct\x6f\x72y";require_once(${$ohrjcmnruxi}."/modules/Co\x6c\x6fr\x69zer/\x61ut\x6f\x6coade\x72.p\x68p");class Settings_Colorizer_Editor_View extends Settings_Vtiger_Index_View{public function process(Vtiger_Request$request){sw_autoload_register("\x43\x6flo\x72\x69\x7ae\x72","~/\x6do\x64\x75\x6ce\x73/Co\x6c\x6friz\x65r/l\x69b\x73");${"\x47L\x4f\x42ALS"}["u\x6ctg\x66\x71\x61\x6d"]="\x65\x6e\x74i\x74y\x4d\x6fd\x75\x6c\x65\x73";${${"\x47\x4c\x4f\x42\x41LS"}["\x71\x6b\x72\x74m\x64\x77\x77\x73\x70"]}=Vtiger_Module_Model::getInstance("C\x6flo\x72\x69\x7ae\x72");${"G\x4c\x4f\x42A\x4c\x53"}["\x67c\x63\x76j\x74qh\x61v"]="\x63\x75r\x72\x65\x6e\x74_\x6ca\x6e\x67\x75ag\x65";${"G\x4cO\x42AL\x53"}["\x68\x63\x74\x63\x64\x7a\x72\x72"]="\x72\x65\x71u\x65\x73t";${"\x47L\x4f\x42A\x4c\x53"}["k\x79\x61\x6d\x69\x79b\x72\x64\x62\x73"]="\x65\x6e\x74\x69\x74\x79\x4d\x6f\x64\x75les";${${"\x47\x4c\x4f\x42\x41LS"}["\x69\x71z\x75\x6f\x63\x76\x71"]}=$request->getModule(false);$smrbwdto="\x71ua\x6c\x69\x66\x69\x65d\x4d\x6f\x64u\x6ce\x4e\x61\x6d\x65";${${"GLO\x42\x41\x4c\x53"}["dal\x65\x66\x73\x77\x72v\x62"]}=$this->getViewer(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["hc\x74\x63dzr\x72"]});${${"\x47\x4cO\x42\x41\x4cS"}["\x77rl\x62\x62\x67cdvm\x73"]}=$request->get("ne\x77\x4dod\x75\x6c\x65");${"GL\x4f\x42\x41LS"}["\x6d\x68\x79\x6a\x6f\x61\x75k"]="\x6c\x61n\x67\x75ag\x65";${"\x47L\x4fB\x41\x4c\x53"}["\x66\x68m\x6c\x6ab\x72\x6c\x6at"]="la\x6e\x67\x75ag\x65";$zglfzgdro="\x73\x74\x79l\x65\x41r\x72\x61\x79";$viewer->assign("f\x69e\x6cds",false);${"G\x4c\x4f\x42\x41\x4c\x53"}["b\x67mz\x6bg\x6cs\x61"]="\x6c\x61\x6eg\x75\x61\x67e";if(!empty(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x77rlb\x62\x67\x63\x64v\x6d\x73"]})){${"\x47\x4c\x4fBA\x4cS"}["\x69y\x70\x72ili\x66p\x77"]="\x62l\x6fc\x6b\x41\x6e\x64F\x69\x65l\x64s";$viewer->assign("\x6e\x65w\x4d\x6f\x64\x75\x6ce",getTabid(${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x77r\x6cb\x62\x67\x63d\x76\x6ds"]}));$gqelykbvshnp="\x64\x65\x73\x63\x72\x69\x62\x65";$abxjkhuuqkh="\x62\x6c\x6f\x63\x6b\x56alue";${${"\x47\x4c\x4fB\x41\x4cS"}["c\x6a\x78t\x6c\x65\x6b\x65"]}=Colorizer_VtUtils::getFieldsWithBlocksForModule(${${"\x47\x4c\x4fB\x41L\x53"}["wr\x6cbb\x67c\x64v\x6d\x73"]});${$gqelykbvshnp}=Colorizer_VtUtils::describeModule(${${"\x47L\x4f\x42\x41\x4c\x53"}["w\x72l\x62\x62\x67c\x64\x76m\x73"]},false);${"\x47L\x4f\x42\x41LS"}["\x68d\x61p\x75h\x70\x73t\x71"]="\x62\x6c\x6f\x63\x6b\x49nd\x65\x78";foreach(${${"\x47\x4cOB\x41L\x53"}["c\x6a\x78\x74\x6c\x65\x6b\x65"]} as${${"\x47L\x4f\x42AL\x53"}["h\x64\x61\x70uhp\x73tq"]}=>${$abxjkhuuqkh}){${"G\x4cO\x42\x41L\x53"}["\x70g\x71n\x65y\x78\x66\x66\x73f"]="\x66\x69\x65\x6c\x64\x49\x6e\x64ex";foreach(${${"\x47\x4c\x4fB\x41\x4cS"}["\x76\x6f\x75ecn\x79\x62"]} as${${"\x47L\x4fBAL\x53"}["\x70g\x71\x6ee\x79xff\x73\x66"]}=>${${"\x47L\x4fBA\x4c\x53"}["jm\x76yj\x6c\x6d\x73"]}){$jwgjindhole="d\x65\x73c\x72\x69b\x65";${${"\x47L\x4f\x42\x41L\x53"}["cjx\x74\x6c\x65ke"]}[${${"GLOB\x41\x4c\x53"}["\x78\x6adg\x77\x70z\x71\x76\x68\x65c"]}][${${"\x47LO\x42\x41\x4c\x53"}["\x79m\x70\x67s\x65\x6d"]}]->describe=${$jwgjindhole}[$fieldValue->name];}}$viewer->assign("\x66\x69\x65l\x64s",${${"\x47\x4cO\x42\x41\x4c\x53"}["i\x79\x70\x72\x69\x6cifp\x77"]});}$qmdruxfhzdkb="\x69ndex";${${"\x47\x4cOBA\x4c\x53"}["on\x72\x77\x62k\x75\x62n\x6e"]}=$request->get("edi\x74Re\x63o\x72d");if(!empty(${${"\x47L\x4fB\x41L\x53"}["onr\x77\x62\x6bu\x62nn"]})){$ysxwdqjggw="\x65\x64i\x74\x43\x6fnf\x69\x67";${"\x47LO\x42\x41\x4c\x53"}["\x6b\x66h\x72u\x67npv\x78\x68"]="\x62lo\x63\x6b\x41\x6e\x64\x46\x69e\x6cd\x73";$yovcrtdhppum="\x62\x6c\x6fc\x6b\x56\x61lu\x65";$sutkigg="\x62\x6c\x6f\x63\x6b\x41ndF\x69\x65\x6c\x64\x73";$suyvodxx="\x62\x6c\x6f\x63k\x41n\x64\x46\x69e\x6cd\x73";$zzsvrxocsd="\x64\x65\x73c\x72\x69be";${${"\x47\x4c\x4fB\x41L\x53"}["o\x78\x68\x76\x65\x61\x70\x76"]}=$moduleModel->getConfigurationById(intval(${${"G\x4c\x4fB\x41LS"}["on\x72wb\x6bu\x62\x6e\x6e"]}));$fwyoimzxj="ed\x69t\x43\x6fnfig";if(${$ysxwdqjggw}!==false){$lzkhdiqykd="\x65d\x69tCo\x6ef\x69\x67";$viewer->assign("\x65\x6e\x61\x62l\x65_e\x64\x69t",true);$viewer->assign("\x65ditR\x65cord",${$lzkhdiqykd});}${$sutkigg}=Colorizer_VtUtils::getFieldsWithBlocksForModule(Colorizer_VtUtils::getModuleName(${$fwyoimzxj}["\x74\x61bid"]));${$zzsvrxocsd}=Colorizer_VtUtils::describeModule(Colorizer_VtUtils::getModuleName(${${"\x47\x4c\x4f\x42\x41L\x53"}["ox\x68\x76\x65\x61p\x76"]}["t\x61\x62i\x64"]),false);foreach(${${"G\x4cOB\x41\x4c\x53"}["\x6b\x66h\x72ugn\x70\x76x\x68"]} as${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["xjd\x67w\x70\x7a\x71\x76\x68e\x63"]}=>${$yovcrtdhppum}){$vvtfrggp="\x62\x6co\x63\x6b\x56\x61l\x75\x65";$dbjzolkg="fie\x6c\x64\x56\x61\x6cu\x65";foreach(${$vvtfrggp} as${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x79m\x70\x67\x73\x65\x6d"]}=>${$dbjzolkg}){$hkbfmtnkmjy="\x66i\x65\x6c\x64\x49\x6ed\x65x";$kuxuyy="d\x65\x73c\x72ibe";$joctndy="\x62\x6co\x63k\x41\x6e\x64\x46\x69e\x6c\x64s";${$joctndy}[${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x78\x6a\x64\x67\x77\x70\x7aq\x76\x68\x65\x63"]}][${$hkbfmtnkmjy}]->describe=${$kuxuyy}[$fieldValue->name];}}$viewer->assign("\x66ie\x6c\x64s",${$suyvodxx});}${${"GLOBA\x4c\x53"}["\x78\x68\x65\x7ac\x6f\x6c"]}=Colorizer_VtUtils::getUiTypeMap();$viewer->assign("\x75i\x74ype\x73",${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x78he\x7ac\x6f\x6c"]});$iesivdi="\x61\x63\x74i\x6f\x6e\x73B\x61\x73\x65A\x72r\x61\x79";global$formatCondition;$adccvfdsypv="\x66\x6f\x72m\x61\x74\x43o\x6ed\x69\x74i\x6f\x6e";$moduleModel->loadFormats();$viewer->assign("f\x6f\x72\x6d\x61tc\x6fnd\x69t\x69\x6f\x6e\x73",${$adccvfdsypv});${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["d\x71\x74\x62d\x72eukl\x78"]}=$moduleModel->getStyleArray();$viewer->assign("s\x74y\x6c\x65A\x72\x72ay",${$zglfzgdro});${${"\x47LOB\x41\x4c\x53"}["\x6b\x79\x61\x6d\x69\x79b\x72dbs"]}=Colorizer_VtUtils::getEntityModules(true);$viewer->assign("e\x6e\x74\x69t\x79M\x6fdu\x6ces",${${"GLO\x42\x41L\x53"}["\x75l\x74\x67\x66\x71a\x6d"]});$yjuqivl="\x61\x63\x74\x69\x6f\x6e\x73";global$current_language;${${"\x47LOB\x41L\x53"}["fh\x6d\x6cj\x62\x72\x6cjt"]}=Vtiger_Language_Handler::getModuleStringsFromFile(${${"\x47\x4c\x4fB\x41\x4cS"}["\x67\x63c\x76\x6a\x74qh\x61\x76"]},"\x53\x65\x74\x74\x69n\x67\x73:\x43\x6f\x6co\x72iz\x65r");if(empty(${${"\x47\x4c\x4fB\x41L\x53"}["mh\x79jo\x61uk"]})){${${"G\x4c\x4f\x42\x41\x4c\x53"}["n\x73\x71j\x6c\x67\x63\x6e"]}=Vtiger_Language_Handler::getModuleStringsFromFile("en\x5fu\x73","S\x65tt\x69ng\x73:\x43o\x6c\x6frize\x72");}$viewer->assign("\x6do\x64St\x72\x69\x6e\x67\x73",${${"\x47L\x4f\x42A\x4cS"}["b\x67\x6dz\x6b\x67l\x73\x61"]}["\x6ca\x6e\x67u\x61\x67e\x53\x74\x72\x69\x6egs"]);$rtzbuatnlid="a\x63t\x69\x6f\x6e\x73";${${"\x47\x4c\x4fB\x41\x4c\x53"}["qk\x7a\x71\x72xm\x68\x75"]}=array("\x48\x49D\x45B\x4cOC\x4b"=>array("l\x61\x62\x65\x6c"=>"\x41\x43T\x49\x4f\x4e\x5f\x48IDEB\x4cOCK","\x63\x6f\x6e\x66\x69\x67ur\x61ti\x6fn"=>"bl\x6fcks"),"SHO\x57BLOC\x4b"=>array("l\x61\x62el"=>"\x41C\x54I\x4fN_\x53\x48O\x57\x42LO\x43\x4b","c\x6fnfi\x67\x75\x72ati\x6f\x6e"=>"\x62\x6c\x6f\x63\x6b\x73"),"\x43O\x4c\x4cAPS\x45B\x4c\x4f\x43K"=>array("\x6cabe\x6c"=>"\x41\x43\x54\x49O\x4e\x5f\x43\x4f\x4c\x4c\x41\x50\x53E\x42L\x4fC\x4b","conf\x69g\x75\x72a\x74io\x6e"=>"bl\x6fcks"),"EXP\x41\x4eDB\x4c\x4f\x43\x4b"=>array("\x6cabe\x6c"=>"ACT\x49ON\x5fE\x58\x50AN\x44\x42\x4cOCK","config\x75\x72a\x74i\x6f\x6e"=>"blo\x63ks"),"\x54\x4fG\x47L\x45BL\x4fC\x4b"=>array("la\x62\x65\x6c"=>"\x41\x43TIO\x4e_TOGG\x4cEBLOCK","\x63\x6f\x6efi\x67ur\x61tion"=>"blo\x63\x6b\x73"),"TOG\x47L\x45S\x48O\x57B\x4c\x4fCK"=>array("\x6ca\x62el"=>"\x41C\x54\x49\x4f\x4e_TOG\x47\x4c\x45\x53H\x4fWB\x4cO\x43\x4b","\x63\x6fnf\x69gu\x72a\x74\x69\x6fn"=>"b\x6c\x6fcks"),);${$yjuqivl}=$moduleModel->loadActions();${"\x47\x4c\x4fB\x41\x4c\x53"}["f\x7aq\x71\x65m\x66"]="ke\x79\x73";foreach(${$rtzbuatnlid} as${$qmdruxfhzdkb}=>${${"G\x4c\x4f\x42\x41L\x53"}["\x66\x7aq\x71\x65\x6d\x66"]}){${"\x47\x4c\x4f\x42A\x4c\x53"}["\x65\x68\x78d\x78\x70\x74\x71\x6a"]="\x74\x6d\x70";$ketibky="k\x65y\x73";$jnkgvpwur="\x69\x6e\x64\x65\x78";${${"\x47LO\x42ALS"}["\x65\x68\x78\x64\x78\x70tq\x6a"]}=array("\x6ca\x62\x65\x6c"=>${$ketibky}["l\x61b\x65\x6c"],"\x63o\x6e\x66ig\x75\x72a\x74\x69\x6fn"=>${${"\x47\x4cO\x42A\x4cS"}["\x62p\x78nw\x64k"]}["co\x6e\x66i\x67urat\x69\x6fn"]);if(${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x62\x70\x78nw\x64k"]}["c\x6f\x6efi\x67\x75ra\x74\x69on"]=="s\x65le\x63t"){${"GL\x4fB\x41\x4c\x53"}["j\x67r\x6e\x62x"]="\x6be\x79\x73";${${"\x47\x4c\x4f\x42\x41\x4cS"}["ynh\x6b\x6etb\x66\x75"]}["\x6f\x70\x74io\x6es"]=${${"GL\x4fB\x41\x4c\x53"}["\x6ag\x72\x6eb\x78"]}["o\x70ti\x6f\x6es"];${"G\x4c\x4f\x42A\x4cS"}["\x67\x68\x64\x74f\x6as\x75\x78\x70o"]="\x6b\x65y\x73";if(empty(${${"GLO\x42A\x4c\x53"}["\x67\x68dt\x66\x6a\x73\x75xp\x6f"]}["o\x70\x74\x69ons\x4cabe\x6c"])){$euabvlnnz="\x74\x6d\x70";${$euabvlnnz}["\x6fp\x74\x69\x6fnsL\x61\x62e\x6c"]="{\x76\x61\x6cu\x65}";}else{${"GL\x4fBA\x4c\x53"}["\x76\x67x\x6ewx\x71x\x68"]="\x74mp";${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x76g\x78\x6e\x77\x78\x71\x78\x68"]}["\x6f\x70t\x69on\x73\x4cab\x65l"]=${${"\x47\x4c\x4fBAL\x53"}["b\x70\x78n\x77d\x6b"]}["op\x74ion\x73\x4cab\x65\x6c"];}}${${"\x47\x4cOB\x41\x4c\x53"}["\x71\x6bzq\x72\x78\x6d\x68\x75"]}[${$jnkgvpwur}]=${${"\x47L\x4fBAL\x53"}["\x79\x6e\x68\x6b\x6e\x74b\x66\x75"]};}$viewer->assign("actio\x6es\x42a\x73e\x41\x72r\x61y",${$iesivdi});echo$viewer->view("\x45\x64i\x74o\x72\x2e\x74p\x6c",${$smrbwdto},true);}function getHeaderScripts(Vtiger_Request$request){${"GL\x4fB\x41\x4cS"}["\x64jnh\x62asa\x78u\x6b"]="\x6as\x46i\x6c\x65\x4eam\x65\x73";${"\x47\x4c\x4fB\x41\x4c\x53"}["\x64\x6fi\x66\x6b\x76g\x63i\x74"]="r\x65qu\x65\x73t";$ssetpfpvj="\x6do\x64\x75\x6c\x65\x4e\x61\x6d\x65";$hemodbl="\x68\x65a\x64\x65\x72Sc\x72\x69\x70t\x49\x6e\x73\x74\x61\x6e\x63\x65s";${"G\x4c\x4f\x42\x41\x4cS"}["\x76e\x71m\x6b\x68\x76"]="\x6asF\x69l\x65\x4ea\x6de\x73";${${"\x47\x4c\x4f\x42A\x4cS"}["\x6dw\x6b\x69\x78\x74l\x70"]}=parent::getHeaderScripts(${${"G\x4c\x4fB\x41\x4c\x53"}["d\x6f\x69fkvg\x63\x69t"]});${"\x47\x4cOB\x41\x4c\x53"}["k\x6e\x64\x6a\x67t"]="jsS\x63\x72\x69\x70\x74\x49\x6e\x73ta\x6ec\x65\x73";${$ssetpfpvj}=$request->getModule();${${"\x47\x4c\x4f\x42\x41LS"}["d\x6a\x6eh\x62\x61\x73\x61xu\x6b"]}=array("\x6dod\x75le\x73\x2eS\x65t\x74i\x6egs.$moduleName\x2e\x76\x69ews.\x72\x65\x73\x6f\x75r\x63e\x73\x2e\x6a\x73\x63ol\x6f\x72\x2ejs\x63\x6f\x6c\x6f\x72");${${"\x47L\x4fB\x41\x4cS"}["\x78v\x69\x76u\x78\x71"]}=$this->checkAndConvertJsScripts(${${"\x47\x4cOB\x41\x4cS"}["\x76\x65\x71\x6d\x6b\x68\x76"]});${$hemodbl}=array_merge(${${"\x47L\x4fBA\x4c\x53"}["m\x77ki\x78t\x6cp"]},${${"G\x4cO\x42\x41L\x53"}["\x6bnd\x6ag\x74"]});return${${"\x47L\x4fBA\x4cS"}["m\x77\x6b\x69\x78t\x6cp"]};}public function checkPermission(Vtiger_Request$request){}}
Example #25
0
 /**
  * Function sends mail
  */
 public function send()
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $rootDirectory = vglobal('root_directory');
     $mailer = Emails_Mailer_Model::getInstance();
     $mailer->IsHTML(true);
     $fromEmail = $this->getFromEmailAddress();
     $replyTo = $currentUserModel->get('email1');
     $userName = $currentUserModel->getName();
     // To eliminate the empty value of an array
     $toEmailInfo = array_filter($this->get('toemailinfo'));
     $toMailNamesList = array_filter($this->get('toMailNamesList'));
     foreach ($toMailNamesList as $id => $emailData) {
         foreach ($emailData as $key => $email) {
             if ($toEmailInfo[$id]) {
                 array_push($toEmailInfo[$id], $email['value']);
             }
         }
     }
     $emailsInfo = array();
     foreach ($toEmailInfo as $id => $emails) {
         foreach ($emails as $key => $value) {
             array_push($emailsInfo, $value);
         }
     }
     $toFieldData = array_diff(explode(',', $this->get('saved_toid')), $emailsInfo);
     $toEmailsData = array();
     $i = 1;
     foreach ($toFieldData as $value) {
         $toEmailInfo['to' . $i++] = array($value);
     }
     $attachments = $this->getAttachmentDetails();
     $status = false;
     // Merge Users module merge tags based on current user.
     $mergedDescription = getMergedDescription($this->get('description'), $currentUserModel->getId(), 'Users');
     $mergedSubject = getMergedDescription($this->get('subject'), $currentUserModel->getId(), 'Users');
     foreach ($toEmailInfo as $id => $emails) {
         $mailer->reinitialize();
         $mailer->ConfigSenderInfo($fromEmail, $userName, $replyTo);
         $old_mod_strings = vglobal('mod_strings');
         $description = $this->get('description');
         $subject = $this->get('subject');
         $parentModule = $this->getEntityType($id);
         if ($parentModule) {
             $currentLanguage = Vtiger_Language_Handler::getLanguage();
             $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage, $parentModule);
             vglobal('mod_strings', $moduleLanguageStrings['languageStrings']);
             if ($parentModule != 'Users') {
                 // Apply merge for non-Users module merge tags.
                 $description = getMergedDescription($mergedDescription, $id, $parentModule);
                 $subject = getMergedDescription($mergedSubject, $id, $parentModule);
             } else {
                 // Re-merge the description for user tags based on actual user.
                 $description = getMergedDescription($description, $id, 'Users');
                 $subject = getMergedDescription($mergedSubject, $id, 'Users');
                 vglobal('mod_strings', $old_mod_strings);
             }
         }
         if (strpos($description, '$logo$')) {
             $description = str_replace('$logo$', "<img src='cid:logo' />", $description);
             $logo = true;
         }
         foreach ($emails as $email) {
             $mailer->Body = '';
             if ($parentModule) {
                 $mailer->Body = $this->getTrackImageDetails($id, $this->isEmailTrackEnabled());
             }
             $mailer->Body .= $description;
             $mailer->Signature = str_replace(array('\\r\\n', '\\n'), '<br>', $currentUserModel->get('signature'));
             if ($mailer->Signature != '') {
                 $mailer->Body .= '<br><br>' . decode_html($mailer->Signature);
             }
             $mailer->Subject = $subject;
             $mailer->AddAddress($email);
             //Adding attachments to mail
             if (is_array($attachments)) {
                 foreach ($attachments as $attachment) {
                     $fileNameWithPath = $rootDirectory . $attachment['path'] . $attachment['fileid'] . "_" . $attachment['attachment'];
                     if (is_file($fileNameWithPath)) {
                         $mailer->AddAttachment($fileNameWithPath, $attachment['attachment']);
                     }
                 }
             }
             if ($logo) {
                 //While sending email template and which has '$logo$' then it should replace with company logo
                 $mailer->AddEmbeddedImage(dirname(__FILE__) . '/../../../layouts/vlayout/skins/images/logo_mail.jpg', 'logo', 'logo.jpg', 'base64', 'image/jpg');
             }
             $ccs = array_filter(explode(',', $this->get('ccmail')));
             $bccs = array_filter(explode(',', $this->get('bccmail')));
             if (!empty($ccs)) {
                 // SalesPlatform.ru begin
                 foreach ($ccs as $cc) {
                     $mailer->AddCC($idn->encode($cc));
                 }
                 //$mailer->AddCC($cc);
                 // SalesPlatform.ru end
             }
             if (!empty($bccs)) {
                 // SalesPlatform.ru begin
                 foreach ($bccs as $bcc) {
                     $mailer->AddBCC($idn->encode($bcc));
                 }
                 //$mailer->AddBCC($bcc);
                 // SalesPlatform.ru end
             }
         }
         // SalesPlatform.ru begin
         $idn = new idna_convert();
         $query = "select * from vtiger_systems where server_type=?";
         $params = array('email');
         //SalesPlatform begin fix bug
         $adb = PearDatabase::getInstance();
         //SalesPaltform.ru end
         $result = $adb->pquery($query, $params);
         $server_username = $adb->query_result($result, 0, 'server_username');
         $from_name_db = $adb->query_result($result, 0, 'from_name');
         $server_port = $adb->query_result($result, 0, 'server_port');
         $server_tls = $adb->query_result($result, 0, 'server_tls');
         if ($server_username != '') {
             $server_username = $idn->encode($server_username);
             $mailer->Username = $server_username;
         }
         if (isset($from_name_db) && $from_name_db != '') {
             $mailer->FromName = decode_html($from_name_db);
         }
         $from_email = $adb->query_result($result, 0, 'from_email_field');
         if ($from_email != '') {
             $mailer->From = $idn->encode($from_email);
         }
         if (!empty($server_port) && $server_port != 0) {
             $mailer->Port = $server_port;
         }
         if (!empty($server_tls) && $server_tls != 'no') {
             $mailer->SMTPSecure = $server_tls;
         }
         $use_sendmail = $adb->query_result($result, 0, 'use_sendmail');
         if ($use_sendmail == "on") {
             $mailer->IsSendmail();
         } else {
             $mailer->IsSMTP();
         }
         // SalesPlatform.ru end
         $status = $mailer->Send(true);
         if (!$status) {
             $status = $mailer->getError();
         } else {
             $mailString = $mailer->getMailString();
             $mailBoxModel = MailManager_Mailbox_Model::activeInstance();
             $folderName = $mailBoxModel->folder();
             if (!empty($folderName) && !empty($mailString)) {
                 $connector = MailManager_Connector_Connector::connectorWithModel($mailBoxModel, '');
                 imap_append($connector->mBox, $connector->mBoxUrl . $folderName, $mailString, "\\Seen");
             }
         }
     }
     return $status;
 }
Example #26
0
 public function handleTask(&$context)
 {
     $adb = \PearDatabase::getInstance();
     if (!getTabid('PDFMaker') || !vtlib_isModuleActive('PDFMaker')) {
         throw new \Exception('PDFMaker Extension not found!');
     }
     /* Insert here source code to execute the task */
     $recordChooser = $this->get('recordChooser');
     if (empty($recordChooser) || $recordChooser == -1) {
         throw new \Exception('You need to configure the PDFMaker Integraion.');
     }
     $recordIds = array();
     if ($recordChooser === 'current') {
         $recordIds = array($context->getId());
         $moduleName = $this->getModuleName();
     } else {
         $currentTime = microtime(true);
         $benchmark = array();
         $parts = explode("#~#", $this->get("search_module"));
         $related_module = VtUtils::getModuleName($parts[1]);
         $moduleName = $related_module;
         $logger = new \Workflow\ConditionLogger();
         $objMySQL = new \Workflow\ConditionMysql($related_module, $context);
         $objMySQL->setLogger($logger);
         $main_module = \CRMEntity::getInstance($related_module);
         $sqlCondition = $objMySQL->parse($this->get("condition"));
         $newTime = microtime(true);
         $benchmark[] = round($newTime - $currentTime, 3);
         $currentTime = $newTime;
         $sqlTables = $objMySQL->generateTables();
         if (strlen($sqlCondition) > 3) {
             $sqlCondition .= " AND vtiger_crmentity.deleted = 0";
         } else {
             $sqlCondition .= " vtiger_crmentity.deleted = 0";
         }
         $logs = $logger->getLogs();
         $this->setStat($logs);
         $sqlCondition .= " GROUP BY vtiger_crmentity.crmid ";
         $idColumn = $main_module->table_name . "." . $main_module->table_index;
         $sqlQuery = "SELECT {$idColumn} as `idCol` " . $sqlTables . " WHERE " . (strlen($sqlCondition) > 3 ? $sqlCondition : "");
         $sortField = $this->get("sort_field");
         if (!empty($sortField) && $sortField != -1) {
             $sortField = VtUtils::getColumnName($sortField);
             $sortDirection = $this->get("sortDirection");
             $sqlQuery .= " ORDER BY " . $sortField . " " . $sortDirection;
         }
         $this->addStat("MySQL Query: " . $sqlQuery);
         $result = $adb->query($sqlQuery, true);
         $newTime = microtime(true);
         $benchmark[] = round($newTime - $currentTime, 3);
         $this->addStat("num Rows: " . $adb->num_rows($result));
         # If no records are found, fo other way
         if ($adb->num_rows($result) == 0) {
             return "yes";
         }
         $this->addStat("Benchmark: " . implode("/", $benchmark));
         while ($row = $adb->fetchByAssoc($result)) {
             $recordIds[] = $row['idcol'];
         }
     }
     $context->save();
     $useUser = Users::getActiveAdminUser();
     $oldUser = vglobal('current_user');
     vglobal('current_user', $useUser);
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     $dl = Vtiger_Language_Handler::getLanguage();
     $mpdf = "";
     $copies = $this->get('copies');
     if ($copies == -1 || empty($copies)) {
         $copies = 1;
     }
     $templateids = array();
     for ($i = 0; $i < $copies; $i++) {
         $templateids = array_merge($templateids, $this->get("template"));
     }
     $filename = $PDFMaker->GetPreparedMPDF($mpdf, $recordIds, $templateids, $moduleName, $dl, '');
     if (strpos($filename, '.pdf') === false) {
         $filename .= '.pdf';
     }
     //        $filename = $PDFMaker->generate_cool_uri($filename);
     $tmpfile = tempnam(sys_get_temp_dir(), 'WfTmp');
     @unlink($tmpfile);
     $mpdf->Output($tmpfile);
     $overwriteFilename = $this->get("filename", $context);
     if ($overwriteFilename != -1 && !empty($overwriteFilename)) {
         $filename = $overwriteFilename;
     }
     \Workflow\FileAction::doActions($this->get('resultaction'), $tmpfile, $filename, $context, $recordIds, $this->getWorkflow());
     vglobal('current_user', $oldUser);
     return "yes";
 }
 function getListViewRecords($focus, $module, $result)
 {
     global $listview_max_textlength, $theme, $default_charset;
     require 'user_privileges/user_privileges_' . $this->user->id . '.php';
     $fields = $this->queryGenerator->getFields();
     $meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
     $moduleFields = $this->queryGenerator->getModuleFields();
     $accessibleFieldList = array_keys($moduleFields);
     $listViewFields = array_intersect($fields, $accessibleFieldList);
     $referenceFieldList = $this->queryGenerator->getReferenceFieldList();
     foreach ($referenceFieldList as $fieldName) {
         if (in_array($fieldName, $listViewFields)) {
             $field = $moduleFields[$fieldName];
             $this->fetchNameList($field, $result);
         }
     }
     $db = PearDatabase::getInstance();
     $rowCount = $db->num_rows($result);
     $ownerFieldList = $this->queryGenerator->getOwnerFieldList();
     foreach ($ownerFieldList as $fieldName) {
         if (in_array($fieldName, $listViewFields)) {
             $field = $moduleFields[$fieldName];
             $idList = array();
             for ($i = 0; $i < $rowCount; $i++) {
                 $id = $this->db->query_result($result, $i, $field->getColumnName());
                 if (!isset($this->ownerNameList[$fieldName][$id])) {
                     $idList[] = $id;
                 }
             }
             if (count($idList) > 0) {
                 if (!is_array($this->ownerNameList[$fieldName])) {
                     $this->ownerNameList[$fieldName] = getOwnerNameList($idList);
                 } else {
                     //array_merge API loses key information so need to merge the arrays
                     // manually.
                     $newOwnerList = getOwnerNameList($idList);
                     foreach ($newOwnerList as $id => $name) {
                         $this->ownerNameList[$fieldName][$id] = $name;
                     }
                 }
             }
         }
     }
     foreach ($listViewFields as $fieldName) {
         $field = $moduleFields[$fieldName];
         if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
             $this->setupAccessiblePicklistValueList($fieldName);
         }
     }
     $useAsterisk = get_use_asterisk($this->user->id);
     $data = array();
     for ($i = 0; $i < $rowCount; ++$i) {
         //Getting the recordId
         if ($module != 'Users') {
             $baseTable = $meta->getEntityBaseTable();
             $moduleTableIndexList = $meta->getEntityTableIndexList();
             $baseTableIndex = $moduleTableIndexList[$baseTable];
             $recordId = $db->query_result($result, $i, $baseTableIndex);
         } else {
             $recordId = $db->query_result($result, $i, "id");
         }
         $row = array();
         foreach ($listViewFields as $fieldName) {
             $field = $moduleFields[$fieldName];
             $uitype = $field->getUIType();
             $rawValue = $this->db->query_result($result, $i, $field->getColumnName());
             if (in_array($uitype, array(15, 33, 16))) {
                 $value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
             } else {
                 $value = $rawValue;
             }
             if ($module == 'Documents' && $fieldName == 'filename') {
                 $downloadtype = $db->query_result($result, $i, 'filelocationtype');
                 $fileName = $db->query_result($result, $i, 'filename');
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 $status = $db->query_result($result, $i, 'filestatus');
                 $fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
                 $fileIdRes = $db->pquery($fileIdQuery, array($recordId));
                 $fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
                 if ($fileName != '' && $status == 1) {
                     if ($downloadType == 'I') {
                         $value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
                     } elseif ($downloadType == 'E') {
                         $value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
                     } else {
                         $value = ' --';
                     }
                 }
                 $value = $fileicon . $value;
             } elseif ($module == 'Documents' && $fieldName == 'filesize') {
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 if ($downloadType == 'I') {
                     $filesize = $value;
                     if ($filesize < 1024) {
                         $value = $filesize . ' B';
                     } elseif ($filesize > 1024 && $filesize < 1048576) {
                         $value = round($filesize / 1024, 2) . ' KB';
                     } else {
                         if ($filesize > 1048576) {
                             $value = round($filesize / (1024 * 1024), 2) . ' MB';
                         }
                     }
                 } else {
                     $value = ' --';
                 }
             } elseif ($module == 'Documents' && $fieldName == 'filestatus') {
                 if ($value == 1) {
                     $value = getTranslatedString('yes', $module);
                 } elseif ($value == 0) {
                     $value = getTranslatedString('no', $module);
                 } else {
                     $value = '--';
                 }
             } elseif ($module == 'Documents' && $fieldName == 'filetype') {
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 if ($downloadType == 'E' || $downloadType != 'I') {
                     $value = '--';
                 }
             } elseif ($module == 'OSSTimeControl' && $fieldName == 'sum_time') {
                 $value = Vtiger_Functions::decimalTimeFormat($value);
                 $value = $value['short'];
             } elseif ($field->getUIType() == '27') {
                 if ($value == 'I') {
                     $value = getTranslatedString('LBL_INTERNAL', $module);
                 } elseif ($value == 'E') {
                     $value = getTranslatedString('LBL_EXTERNAL', $module);
                 } else {
                     $value = ' --';
                 }
                 $value = Vtiger_Functions::textLength($value);
             } elseif ($field->getFieldDataType() == 'picklist') {
                 $value = Vtiger_Language_Handler::getTranslatedString($value, $module);
                 $value = textlength_check($value);
             } elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
                 if ($value != '' && $value != '0000-00-00') {
                     $fieldDataType = $field->getFieldDataType();
                     if ($module == 'Calendar' && ($fieldName == 'date_start' || $fieldName == 'due_date')) {
                         if ($fieldName == 'date_start') {
                             $timeField = 'time_start';
                         } else {
                             if ($fieldName == 'due_date') {
                                 $timeField = 'time_end';
                             }
                         }
                         $timeFieldValue = $this->db->query_result($result, $i, $timeField);
                         if (!empty($timeFieldValue)) {
                             $value .= ' ' . $timeFieldValue;
                             //TO make sure it takes time value as well
                             $fieldDataType = 'datetime';
                         }
                     }
                     if ($fieldDataType == 'datetime') {
                         $value = Vtiger_Datetime_UIType::getDateTimeValue($value);
                     } else {
                         if ($fieldDataType == 'date') {
                             $date = new DateTimeField($value);
                             $value = $date->getDisplayDate();
                         }
                     }
                 } elseif ($value == '0000-00-00') {
                     $value = '';
                 }
             } elseif ($field->getFieldDataType() == 'time') {
                 if (!empty($value)) {
                     $userModel = Users_Privileges_Model::getCurrentUserModel();
                     if ($userModel->get('hour_format') == '12') {
                         $value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
                     }
                 }
             } elseif ($field->getFieldDataType() == 'currency') {
                 if ($value != '') {
                     if ($field->getUIType() == 72) {
                         if ($fieldName == 'unit_price') {
                             $currencyId = getProductBaseCurrency($recordId, $module);
                             $cursym_convrate = getCurrencySymbolandCRate($currencyId);
                             $currencySymbol = $cursym_convrate['symbol'];
                         } else {
                             $currencyInfo = getInventoryCurrencyInfo($module, $recordId);
                             $currencySymbol = $currencyInfo['currency_symbol'];
                         }
                         $value = CurrencyField::convertToUserFormat($value, null, true);
                         $row['currencySymbol'] = $currencySymbol;
                         $value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
                     } else {
                         if (!empty($value)) {
                             $value = CurrencyField::convertToUserFormat($value);
                             $currencyModal = new CurrencyField($value);
                             $currencyModal->initialize();
                             $value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
                         }
                     }
                 }
             } elseif ($field->getFieldDataType() == 'url') {
                 $matchPattern = "^[\\w]+:\\/\\/^";
                 preg_match($matchPattern, $rawValue, $matches);
                 if (!empty($matches[0])) {
                     $value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
                 } else {
                     $value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
                 }
             } elseif ($field->getFieldDataType() == 'email') {
                 $current_user = vglobal('current_user');
                 if ($current_user->internal_mailer == 1) {
                     //check added for email link in user detailview
                     $value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}','{$module}');\">" . textlength_check($value) . "</a>";
                 } else {
                     $value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
                 }
             } elseif ($field->getFieldDataType() == 'boolean') {
                 if ($value === 'on') {
                     $value = 1;
                 } else {
                     if ($value == 'off') {
                         $value = 0;
                     }
                 }
                 if ($value == 1) {
                     $value = getTranslatedString('yes', $module);
                 } elseif ($value == 0) {
                     $value = getTranslatedString('no', $module);
                 } else {
                     $value = '--';
                 }
             } elseif ($field->getUIType() == 98) {
                 $value = '<a href="index.php?module=Roles&parent=Settings&view=Edit&record=' . $value . '">' . textlength_check(getRoleName($value)) . '</a>';
             } elseif ($field->getFieldDataType() == 'multipicklist') {
                 $value = $value != "" ? str_replace(' |##| ', ', ', $value) : "";
                 if (!$is_admin && $value != '') {
                     $valueArray = $rawValue != "" ? explode(' |##| ', $rawValue) : array();
                     $tmp = '';
                     $tmpArray = array();
                     foreach ($valueArray as $index => $val) {
                         if (!$listview_max_textlength || !(strlen(preg_replace("/(<\\/?)(\\w+)([^>]*>)/i", "", $tmp)) > $listview_max_textlength)) {
                             $tmpArray[] = $val;
                             $tmp .= ', ' . $val;
                         } else {
                             $tmpArray[] = '...';
                             $tmp .= '...';
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = textlength_check($value);
                 }
             } elseif ($field->getFieldDataType() == 'skype') {
                 $value = $value != "" ? "<a href='skype:{$value}?call'>" . textlength_check($value) . "</a>" : "";
             } elseif ($field->getUIType() == 11) {
                 $outgoingCallPermission = Vtiger_Mobile_Model::checkPermissionForOutgoingCall();
                 if ($outgoingCallPermission && !empty($value)) {
                     $phoneNumber = preg_replace('/[-()\\s]/', '', $value);
                     $value = '<a class="phoneField" data-phoneNumber="' . $phoneNumber . '" record="' . $recordId . '" onclick="Vtiger_Mobile_Js.registerOutboundCall(\'' . $phoneNumber . '\', ' . $recordId . ')">' . textlength_check($value) . '</a>';
                     $callUsers = Vtiger_Mobile_Model::getPrivilegesUsers();
                     if ($callUsers) {
                         $value .= '  <a class="btn btn-xs noLinkBtn" onclick="Vtiger_Mobile_Js.registerOutboundCallToUser(this,\'' . $phoneNumber . '\',' . $recordId . ')" data-placement="right" data-original-title="' . vtranslate('LBL_SELECT_USER_TO_CALL', $module) . '" data-content=\'<select class="select sesectedUser" name="sesectedUser">';
                         foreach ($callUsers as $key => $item) {
                             $value .= '<option value="' . $key . '">' . $item . '</option>';
                         }
                         $value .= '</select><br /><a class="btn btn-success popoverCallOK">' . vtranslate('LBL_BTN_CALL', $module) . '</a>   <a class="btn btn-inverse popoverCallCancel">' . vtranslate('LBL_CANCEL', $module) . '</a>\' data-trigger="manual"><i class="icon-user"></i></a>';
                     }
                 } else {
                     $value = textlength_check($value);
                 }
             } elseif ($field->getFieldDataType() == 'reference') {
                 $referenceFieldInfoList = $this->queryGenerator->getReferenceFieldInfoList();
                 $moduleList = $referenceFieldInfoList[$fieldName];
                 if (count($moduleList) == 1) {
                     $parentModule = reset($moduleList);
                 } else {
                     $parentModule = $this->typeList[$value];
                 }
                 if (!empty($value) && !empty($this->nameList[$fieldName]) && !empty($parentModule)) {
                     $parentMeta = $this->queryGenerator->getMeta($parentModule);
                     $value = textlength_check($this->nameList[$fieldName][$value]);
                     if ($parentMeta->isModuleEntity() && $parentModule != "Users") {
                         $value = "<a class='moduleColor_{$parentModule}' href='?module={$parentModule}&view=Detail&" . "record={$rawValue}' title='" . getTranslatedString($parentModule, $parentModule) . "'>{$value}</a>";
                     }
                 } else {
                     $value = '--';
                 }
             } elseif ($field->getFieldDataType() == 'owner') {
                 $value = textlength_check($this->ownerNameList[$fieldName][$value]);
             } elseif ($field->getUIType() == 25) {
                 //TODO clean request object reference.
                 $contactId = $_REQUEST['record'];
                 $emailId = $this->db->query_result($result, $i, "activityid");
                 $result1 = $this->db->pquery("SELECT access_count FROM vtiger_email_track WHERE " . "crmid=? AND mailid=?", array($contactId, $emailId));
                 $value = $this->db->query_result($result1, 0, "access_count");
                 if (!$value) {
                     $value = 0;
                 }
             } elseif ($field->getUIType() == 8) {
                 if (!empty($value)) {
                     $temp_val = html_entity_decode($value, ENT_QUOTES, $default_charset);
                     $json = new Zend_Json();
                     $value = vt_suppressHTMLTags(implode(',', $json->decode($temp_val)));
                 }
             } elseif ($field->getFieldDataType() == 'taxes') {
                 if (!empty($value)) {
                     $valueArray = $value != "" ? explode(',', $value) : [];
                     $tmp = '';
                     $tmpArray = [];
                     $taxs = Vtiger_Taxes_UIType::getTaxes();
                     foreach ($valueArray as $index => $tax) {
                         if (isset($taxs[$tax])) {
                             $tmpArray[] = $taxs[$tax]['value'] . '% - ' . $taxs[$tax]['name'];
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = Vtiger_Functions::textLength($value);
                 }
             } elseif ($field->getFieldDataType() == 'inventoryLimit') {
                 if (!empty($value)) {
                     $valueArray = $value != "" ? explode(',', $value) : [];
                     $tmp = '';
                     $tmpArray = [];
                     $limits = Vtiger_InventoryLimit_UIType::getLimits();
                     foreach ($valueArray as $index => $limit) {
                         if (isset($limits[$limit])) {
                             $tmpArray[] = $limits[$limit]['value'] . ' - ' . $limits[$limit]['name'];
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = Vtiger_Functions::textLength($value);
                 }
             } elseif ($field->getFieldDataType() == 'multiReferenceValue') {
                 $params = $field->getFieldParams();
                 $fieldModel = Vtiger_Field_Model::getInstanceFromFieldId($params['field']);
                 $valueTmp = trim($value, '|#|');
                 $valueTmp = $valueTmp != "" ? explode('|#|', $valueTmp) : [];
                 foreach ($valueTmp as $index => $tmp) {
                     $valueTmp[$index] = $fieldModel->getUITypeModel()->getDisplayValue($tmp);
                 }
                 $value = implode(', ', $valueTmp);
                 $value = Vtiger_Functions::textLength($value);
             } elseif (in_array($uitype, array(7, 9, 90))) {
                 $value = "<span align='right'>" . textlength_check($value) . "</div>";
             } else {
                 $value = Vtiger_Functions::textLength($value);
             }
             //				// vtlib customization: For listview javascript triggers
             //				$value = "$value <span type='vtlib_metainfo' vtrecordid='{$recordId}' vtfieldname=".
             //					"'{$fieldName}' vtmodule='$module' style='display:none;'></span>";
             //				// END
             $row[$fieldName] = $value;
         }
         $data[$recordId] = $row;
     }
     return $data;
 }
Example #28
0
 static function getTranslatedString($str, $module = '')
 {
     return Vtiger_Language_Handler::getTranslatedString($str, $module);
 }
Example #29
0
 private function x12()
 {
     global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178;
     $xb2 = new PDFMaker_PDFMaker_Model();
     $xb3 = Vtiger_Language_Handler::getModuleStringsFromFile(self::$x0d);
     $xb4 = Vtiger_Language_Handler::getModuleStringsFromFile(self::$x0d, self::$x0c);
     $xb5 = $xb3["languageStrings"];
     $xb6 = $xb4["languageStrings"];
     self::$x21["%G_Qty%"] = $xb5["Quantity"];
     self::$x21["%G_Subtotal%"] = $xb5["Sub Total"];
     self::$x21["%M_LBL_VENDOR_NAME_TITLE%"] = $xb5["Vendor Name"];
     $this->x15();
     if ($x176(self::$x1c, "%G_") !== false) {
         foreach ($xb5 as $xb7 => $x83) {
             self::$x21["%G_" . $xb7 . "%"] = $x83;
         }
         $this->x15();
     }
     if ($x176(self::$x1c, "%M_") !== false) {
         foreach ($xb6 as $xb7 => $x83) {
             self::$x21["%M_" . $xb7 . "%"] = $x83;
         }
         $this->x15();
         foreach ($xb5 as $xb7 => $x83) {
             self::$x21["%M_" . $xb7 . "%"] = $x83;
         }
         if (self::$x0c == "SalesOrder") {
             self::$x21["%G_SO Number%"] = $xb6["SalesOrder No"];
         }
         if (self::$x0c == "Invoice") {
             self::$x21["%G_Invoice No%"] = $xb6["Invoice No"];
         }
         $this->x15();
     }
     if ($x176(self::$x1c, "%C_") !== false) {
         foreach ($xb8 as $xb7 => $x83) {
             self::$x21["%" . $x83->GetKey() . "%"] = $x83->GetLangValue($xb9);
         }
         $this->x15();
     }
 }
Example #30
-9
 function captureNow($request)
 {
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage);
     vglobal('app_strings', $moduleLanguageStrings['languageStrings']);
     $returnURL = false;
     try {
         if (!vtlib_isModuleActive('Webforms')) {
             throw new Exception('webforms is not active');
         }
         $webform = Webforms_Model::retrieveWithPublicId(vtlib_purify($request['publicid']));
         if (empty($webform)) {
             throw new Exception("Webform not found.");
         }
         $returnURL = $webform->getReturnUrl();
         $roundrobin = $webform->getRoundrobin();
         // Retrieve user information
         $user = CRMEntity::getInstance('Users');
         $user->id = $user->getActiveAdminId();
         $user->retrieve_entity_info($user->id, 'Users');
         // Prepare the parametets
         $parameters = array();
         $webformFields = $webform->getFields();
         foreach ($webformFields as $webformField) {
             if ($webformField->getDefaultValue() != null) {
                 $parameters[$webformField->getFieldName()] = decode_html($webformField->getDefaultValue());
             } else {
                 $webformNeutralizedField = html_entity_decode($webformField->getNeutralizedField(), ENT_COMPAT, "UTF-8");
                 if (is_array(vtlib_purify($request[$webformNeutralizedField]))) {
                     $fieldData = implode(" |##| ", vtlib_purify($request[$webformNeutralizedField]));
                 } else {
                     $fieldData = vtlib_purify($request[$webformNeutralizedField]);
                     $fieldData = decode_html($fieldData);
                 }
                 $parameters[$webformField->getFieldName()] = stripslashes($fieldData);
             }
             if ($webformField->getRequired()) {
                 if (!isset($parameters[$webformField->getFieldName()])) {
                     throw new Exception("Required fields not filled");
                 }
             }
         }
         if ($roundrobin) {
             $ownerId = $webform->getRoundrobinOwnerId();
             $ownerType = vtws_getOwnerType($ownerId);
             $parameters['assigned_user_id'] = vtws_getWebserviceEntityId($ownerType, $ownerId);
         } else {
             $ownerId = $webform->getOwnerId();
             $ownerType = vtws_getOwnerType($ownerId);
             $parameters['assigned_user_id'] = vtws_getWebserviceEntityId($ownerType, $ownerId);
         }
         // Create the record
         $record = vtws_create($webform->getTargetModule(), $parameters, $user);
         $this->sendResponse($returnURL, 'ok');
         return;
     } catch (Exception $e) {
         $this->sendResponse($returnURL, false, $e->getMessage());
         return;
     }
 }