Beispiel #1
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $modules = $request->get('modules');
     $assignId = $request->get('assigned_user_id');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $entityValues = array();
     $entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
     //■権限なぜか、エラーになるので権限を固定するinouchi
     //$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
     $entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType(1), 1);
     $entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
     $convertLeadFields = $recordModel->getConvertLeadFields();
     $availableModules = array('Accounts', 'Contacts', 'Potentials');
     foreach ($availableModules as $module) {
         if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
             $entityValues['entities'][$module]['create'] = true;
             $entityValues['entities'][$module]['name'] = $module;
             foreach ($convertLeadFields[$module] as $fieldModel) {
                 $fieldName = $fieldModel->getName();
                 $fieldValue = $request->get($fieldName);
                 //Potential Amount Field value converting into DB format
                 if ($fieldModel->getFieldDataType() === 'currency') {
                     $fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'date') {
                     $fieldValue = DateTimeField::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
                     $ids = vtws_getIdComponents($fieldValue);
                     if (count($ids) === 1) {
                         $fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
                     }
                 }
                 $entityValues['entities'][$module][$fieldName] = $fieldValue;
             }
         }
     }
     try {
         $result = vtws_convertlead($entityValues, $currentUser);
     } catch (Exception $e) {
         $this->showError($request, $e);
         exit;
     }
     if (!empty($result['Accounts'])) {
         $accountIdComponents = vtws_getIdComponents($result['Accounts']);
         $accountId = $accountIdComponents[1];
     }
     if (!empty($result['Contacts'])) {
         $contactIdComponents = vtws_getIdComponents($result['Contacts']);
         $contactId = $contactIdComponents[1];
     }
     if (!empty($accountId)) {
         header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
     } elseif (!empty($contactId)) {
         header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
     } else {
         $this->showError($request);
         exit;
     }
 }
Beispiel #2
0
 function getDetailViewRelatedLinks()
 {
     $recordModel = $this->getRecord();
     $moduleName = $recordModel->getModuleName();
     $parentModuleModel = $this->getModule();
     $relatedLinks = array();
     if ($parentModuleModel->isSummaryViewSupported()) {
         $relatedLinks = array(array('linktype' => 'DETAILVIEWTAB', 'linklabel' => vtranslate('LBL_RECORD_SUMMARY', $moduleName), 'linkKey' => 'LBL_RECORD_SUMMARY', 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showDetailViewByMode&requestMode=summary', 'linkicon' => '', 'related' => 'Summary'));
     }
     //link which shows the summary information(generally detail of record)
     $relatedLinks[] = array('linktype' => 'DETAILVIEWTAB', 'linklabel' => vtranslate('LBL_RECORD_DETAILS', $moduleName), 'linkKey' => 'LBL_RECORD_DETAILS', 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showDetailViewByMode&requestMode=full', 'linkicon' => '', 'related' => 'Details');
     if ($moduleName == 'Leads') {
         $showPSTab = vtlib_isModuleActive('OutsourcedProducts') || vtlib_isModuleActive('Products') || vtlib_isModuleActive('Services') || vtlib_isModuleActive('OSSOutsourcedServices');
     }
     if ($moduleName == 'Accounts') {
         $showPSTab = vtlib_isModuleActive('OutsourcedProducts') || vtlib_isModuleActive('Products') || vtlib_isModuleActive('Services') || vtlib_isModuleActive('OSSOutsourcedServices') || vtlib_isModuleActive('Assets') || vtlib_isModuleActive('OSSSoldServices');
     }
     if ('Contacts' != $moduleName && $showPSTab) {
         $relatedLinks[] = array('linktype' => 'DETAILVIEWTAB', 'linklabel' => vtranslate('LBL_RECORD_SUMMARY_PRODUCTS_SERVICES', $moduleName), 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showRelatedProductsServices&requestMode=summary', 'linkicon' => '', 'linkKey' => 'LBL_RECORD_SUMMARY', 'related' => 'ProductsAndServices');
     }
     $modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
     if ($parentModuleModel->isCommentEnabled() && $modCommentsModel->isPermitted('DetailView')) {
         $relatedLinks[] = array('linktype' => 'DETAILVIEWTAB', 'linklabel' => 'ModComments', 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showAllComments', 'linkicon' => '', 'related' => 'Comments');
     }
     if ($parentModuleModel->isTrackingEnabled()) {
         $relatedLinks[] = array('linktype' => 'DETAILVIEWTAB', 'linklabel' => 'LBL_UPDATES', 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showRecentActivities&page=1', 'linkicon' => '', 'related' => 'Updates');
     }
     $relationModels = $parentModuleModel->getRelations();
     foreach ($relationModels as $relation) {
         //TODO : Way to get limited information than getting all the information
         $link = array('linktype' => 'DETAILVIEWRELATED', 'linklabel' => $relation->get('label'), 'linkurl' => $relation->getListUrl($recordModel), 'linkicon' => '', 'relatedModuleName' => $relation->get('relatedModuleName'));
         $relatedLinks[] = $link;
     }
     return $relatedLinks;
 }
 protected function getModels($parentRecordId, $criteria)
 {
     global $adb, $current_user;
     $moduleName = 'ModComments';
     if (vtlib_isModuleActive($moduleName)) {
         $entityInstance = CRMEntity::getInstance($moduleName);
         $queryCriteria = '';
         switch ($criteria) {
             case 'All':
                 $queryCriteria = sprintf(" ORDER BY %s.%s DESC ", $entityInstance->table_name, $entityInstance->table_index);
                 break;
             case 'Last5':
                 $queryCriteria = sprintf(" ORDER BY %s.%s DESC LIMIT 5", $entityInstance->table_name, $entityInstance->table_index);
                 break;
             case 'Mine':
                 $queryCriteria = ' AND vtiger_crmentity.smownerid=' . $current_user->id . sprintf(" ORDER BY %s.%s DESC ", $entityInstance->table_name, $entityInstance->table_index);
                 break;
         }
         $query = $entityInstance->getListQuery($moduleName, sprintf(" AND %s.related_to=?", $entityInstance->table_name));
         $query .= $queryCriteria;
         $result = $adb->pquery($query, array($parentRecordId));
         $instances = array();
         if ($adb->num_rows($result)) {
             while ($resultrow = $adb->fetch_array($result)) {
                 $instances[] = new ModComments_CommentsModel($resultrow);
             }
         }
     }
     return $instances;
 }
Beispiel #4
0
 function process(Mobile_API_Request $request)
 {
     $response = new Mobile_API_Response();
     $username = $request->get('username');
     $password = $request->get('password');
     $current_user = CRMEntity::getInstance('Users');
     $current_user->column_fields['user_name'] = $username;
     if (vtlib_isModuleActive('Mobile') === false) {
         $response->setError(1501, 'Service not available');
         return $response;
     }
     if (!$current_user->load_user($password) || !$current_user->authenticated) {
         global $mod_strings;
         $response->setError(1210, $mod_strings['ERR_INVALID_PASSWORD']);
     } else {
         // Start session now
         $sessionid = Mobile_API_Session::init();
         if ($sessionid === false) {
             echo "Session init failed {$sessionid}\n";
         }
         include_once 'config.php';
         global $application_unique_key;
         $current_user->id = $current_user->retrieve_user_id($username);
         $this->setActiveUser($current_user);
         $_SESSION["authenticated_user_id"] = $current_user->id;
         $_SESSION["app_unique_key"] = $application_unique_key;
         $result = array();
         $result['login'] = array('userid' => $current_user->id, 'crm_tz' => DateTimeField::getDBTimeZone(), 'user_tz' => $current_user->time_zone, 'session' => $sessionid, 'language' => $current_user->language, 'vtiger_version' => Mobile_WS_Utils::getVtigerVersion(), 'mobile_module_version' => Mobile_WS_Utils::getVersion());
         $response->setResult($result);
         $this->postProcess($response);
     }
     return $response;
 }
Beispiel #5
0
 function process(Mobile_API_Request $request)
 {
     $response = new Mobile_API_Response();
     $username = $request->get('username');
     $password = $request->get('password');
     $current_user = CRMEntity::getInstance('Users');
     $current_user->column_fields['user_name'] = $username;
     if (vtlib_isModuleActive('Mobile') === false) {
         $response->setError(1501, 'Service not available');
         return $response;
     }
     if (!$current_user->doLogin($password)) {
         $response->setError(1210, 'Authentication Failed');
     } else {
         // Start session now
         $sessionid = Mobile_API_Session::init();
         if ($sessionid === false) {
             echo "Session init failed {$sessionid}\n";
         }
         $current_user->id = $current_user->retrieve_user_id($username);
         $current_user->retrieveCurrentUserInfoFromFile($current_user->id);
         $this->setActiveUser($current_user);
         $result = array();
         $result['login'] = array('userid' => $current_user->id, 'crm_tz' => DateTimeField::getDBTimeZone(), 'user_tz' => $current_user->time_zone, 'user_currency' => $current_user->currency_code, 'session' => $sessionid, 'vtiger_version' => Mobile_WS_Utils::getVtigerVersion(), 'date_format' => $current_user->date_format, 'mobile_module_version' => Mobile_WS_Utils::getVersion());
         $response->setResult($result);
         $this->postProcess($response);
     }
     return $response;
 }
Beispiel #6
0
 function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $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', Users_Record_Model::getCurrentUserModel());
     $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'));
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
 public function beforeGetTaskform($viewer)
 {
     $viewer->assign("ENABLE_PDFMAKER", false);
     $viewer->assign("pdfmaker_templates", array());
     if (getTabid('PDFMaker') && vtlib_isModuleActive('PDFMaker')) {
         require_once 'modules/PDFMaker/PDFMaker.php';
         if (class_exists("PDFMaker")) {
             $PDFMaker = $PDFMaker = new PDFMaker_PDFMaker_Model();
             if (method_exists($PDFMaker, "GetAvailableTemplates")) {
                 $viewer->assign("ENABLE_PDFMAKER", true);
                 $templates = $PDFMaker->GetAvailableTemplates($this->getModuleName());
                 foreach ($templates as $index => $value) {
                     $pdftemplates[$index] = $value["templatename"];
                 }
                 $viewer->assign("pdfmaker_templates", $pdftemplates);
                 $templateid = $this->get("template");
                 if (!empty($templateid) && $templateid != -1 && $this->get("attachments") == -1) {
                     $this->set("attachments", '{"pdfmaker#' . $templateid . '":"title"}');
                 } else {
                     if ($this->get("attachments") == -1) {
                         $this->set("attachments", '{}');
                     }
                 }
             }
         }
     }
 }
Beispiel #8
0
 function save_module($module)
 {
     global $updateInventoryProductRel_deduct_stock;
     if ($this->HasDirectImageField) {
         $this->insertIntoAttachment($this->id, $module);
     }
     $updateInventoryProductRel_deduct_stock = true;
     //Checking if quote_id is present and updating the quote status
     if ($this->column_fields['quote_id'] != '') {
         $newStatus = GlobalVariable::getVariable('QuoteStatusOnSalesOrderSave', 'Accepted');
         if ($newStatus != 'DoNotChange') {
             $qt_id = $this->column_fields['quote_id'];
             $query1 = 'update vtiger_quotes set quotestage=? where quoteid=?';
             $this->db->pquery($query1, array($newStatus, $qt_id));
         }
     }
     //in ajax save we should not call this function, because this will delete all the existing product values
     if ($_REQUEST['action'] != 'SalesOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
         //Based on the total Number of rows we will save the product relationship with this entity
         saveInventoryProductDetails($this, 'SalesOrder');
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($this, 'SalesOrder');
         }
     } else {
         if ($_REQUEST['action'] == 'SalesOrderAjax' || $_REQUEST['action'] == 'MassEditSave') {
             $updateInventoryProductRel_deduct_stock = false;
         }
     }
     // Update the currency id and the conversion rate for the sales order
     $update_query = "update vtiger_salesorder set currency_id=?, conversion_rate=? where salesorderid=?";
     $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
     $this->db->pquery($update_query, $update_params);
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         if (vtlib_isModuleActive("Timecontrol") && !vtlib_isModuleActive("Task")) {
             $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Timecontrol/convertTZListView.php'", array());
             if ($adb->num_rows($result) == 0) {
                 $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Task/convertTZListView.php'", array());
                 if ($adb->num_rows($result) == 1) {
                     $handler_id = $adb->query_result($result, 0, 'eventhandler_id');
                     $this->ExecuteQuery("UPDATE vtiger_eventhandlers SET handler_path = 'modules/Timecontrol/convertTZListView.php', handler_class = 'convertTZListViewOnTimecontrol' WHERE eventhandler_id = ?", array($handler_id));
                 } else {
                     $em = new VTEventsManager($adb);
                     $em->registerHandler('corebos.filter.listview.render', 'modules/Timecontrol/convertTZListView.php', 'convertTZListViewOnTimecontrol');
                 }
             }
         } elseif (vtlib_isModuleActive("Timecontrol") && vtlib_isModuleActive("Task")) {
             $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Timecontrol/convertTZListView.php'", array());
             if ($adb->num_rows($result) == 0) {
                 $em = new VTEventsManager($adb);
                 $em->registerHandler('corebos.filter.listview.render', 'modules/Timecontrol/convertTZListView.php', 'convertTZListViewOnTimecontrol');
             }
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied(false);
     }
     $this->finishExecution();
 }
Beispiel #10
0
 function save_module($module)
 {
     global $adb;
     //in ajax save we should not call this function, because this will delete all the existing product values
     if ($_REQUEST['action'] != 'PurchaseOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
         //Based on the total Number of rows we will save the product relationship with this entity
         saveInventoryProductDetails($this, 'PurchaseOrder', $this->update_prod_stock);
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($this, 'PurchaseOrder');
         }
     }
     //In Ajax edit, if the status changed to Received Shipment then we have to update the product stock
     if ($_REQUEST['action'] == 'PurchaseOrderAjax' && $this->update_prod_stock == 'true') {
         $inventory_res = $this->db->pquery("select productid, quantity from vtiger_inventoryproductrel where id=?", array($this->id));
         $noofproducts = $this->db->num_rows($inventory_res);
         //We have to update the stock for all the products in this PO
         for ($prod_count = 0; $prod_count < $noofproducts; $prod_count++) {
             $productid = $this->db->query_result($inventory_res, $prod_count, 'productid');
             $quantity = $this->db->query_result($inventory_res, $prod_count, 'quantity');
             $this->db->println("Stock is going to be updated for the productid - {$productid} with quantity - {$quantity}");
             addToProductStock($productid, $quantity);
         }
     }
     // Update the currency id and the conversion rate for the purchase order
     $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?";
     $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
     $adb->pquery($update_query, $update_params);
 }
Beispiel #11
0
 function process(Mobile_API_Request $request)
 {
     $values = Zend_Json::decode($request->get('values'));
     $relatedTo = $values['related_to'];
     $commentContent = $values['commentcontent'];
     $user = $this->getActiveUser();
     $targetModule = '';
     if (!empty($relatedTo) && Mobile_WS_Utils::detectModulenameFromRecordId($relatedTo) == 'HelpDesk') {
         $targetModule = 'HelpDesk';
     } else {
         $targetModule = 'ModComments';
     }
     $response = false;
     if ($targetModule == 'HelpDesk') {
         $response = $this->saveCommentToHelpDesk($commentContent, $relatedTo, $user);
     } else {
         if (vtlib_isModuleActive($targetModule)) {
             $request->set('module', $targetModule);
             $values['assigned_user_id'] = sprintf('%sx%s', Mobile_WS_Utils::getEntityModuleWSId('Users'), $user->id);
             $request->set('values', Zend_Json::encode($values));
             $response = parent::process($request);
         }
     }
     return $response;
 }
 function isModuleActive($module)
 {
     include_once 'include/utils/VtlibUtils.php';
     if (vtlib_isModuleActive($module) && isPermitted($module, 'EditView') == 'yes') {
         return true;
     }
     return false;
 }
Beispiel #13
0
 public function exportPDFAvailable()
 {
     $PDFMakerInstalled = vtlib_isModuleActive("PDFMaker");
     if ($PDFMakerInstalled === true && file_exists('modules/PDFMaker/resources/mpdf/mpdf.php') === true) {
         $PDFMakerInstalled = true;
     } else {
         $PDFMakerInstalled = false;
     }
     return $PDFMakerInstalled;
 }
	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('FOOTER_SCRIPTS',$this->getFooterScripts($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'));
			$viewer->assign('HEADER_SCRIPTS',$this->getHeaderScripts($request));
			if($display) {
				$this->preProcessDisplay($request);
			}
		}
	}
Beispiel #15
0
 function getDetailViewRelatedLinks()
 {
     $recordModel = $this->getRecord();
     $moduleName = $recordModel->getModuleName();
     $parentModuleModel = $this->getModule();
     $relatedLinks = Vtiger_DetailView_Model::getDetailViewRelatedLinks();
     $showPSTab = vtlib_isModuleActive('OutsourcedProducts') || vtlib_isModuleActive('Products') || vtlib_isModuleActive('Services') || vtlib_isModuleActive('OSSOutsourcedServices') || vtlib_isModuleActive('Assets') || vtlib_isModuleActive('OSSSoldServices');
     if ($showPSTab) {
         $relatedLinks[] = ['linktype' => 'DETAILVIEWTAB', 'linklabel' => vtranslate('LBL_RECORD_SUMMARY_PRODUCTS_SERVICES', $moduleName), 'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showRelatedProductsServices&requestMode=summary', 'linkicon' => '', 'linkKey' => 'LBL_RECORD_SUMMARY', 'related' => 'ProductsAndServices', 'countRelated' => true];
     }
     return $relatedLinks;
 }
Beispiel #16
0
 function captureNow($request)
 {
     $returnURL = false;
     try {
         foreach ($request as $key => $value) {
             $request[utf8_decode($key)] = $value;
         }
         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();
         // 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());
                 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 (empty($parameters[$webformField->getFieldName()])) {
                     throw new Exception("Required fields not filled");
                 }
             }
         }
         $parameters['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $webform->getOwnerId());
         // 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;
     }
 }
	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);
			}
		}
	}
 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $id = $request->get('record');
     $recordInstance = Vtiger_Record_Model::getInstanceById($id, $moduleName);
     $permissionToSendEmail = vtlib_isModuleActive('OSSMail') && Users_Privileges_Model::isPermitted('OSSMail', 'compose');
     $viewer = $this->getViewer($request);
     $viewer->assign('PERMISSION_TO_SENDE_MAIL', $permissionToSendEmail);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('RECORD', $recordInstance);
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getScripts($request));
     $viewer->view('ActivityStateModal.tpl', $moduleName);
 }
Beispiel #19
0
 function save_module()
 {
     global $adb;
     //in ajax save we should not call this function, because this will delete all the existing product values
     if ($_REQUEST['action'] != 'QuotesAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
         //Based on the total Number of rows we will save the product relationship with this entity
         saveInventoryProductDetails($this, 'Quotes');
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($this, 'Quotes');
         }
     }
     // Update the currency id and the conversion rate for the quotes
     $update_query = "update vtiger_quotes set currency_id=?, conversion_rate=? where quoteid=?";
     $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
     $adb->pquery($update_query, $update_params);
 }
Beispiel #20
0
 function process(Mobile_API_Request $request)
 {
     $current_user = $this->getActiveUser();
     //$module = $request->get('module');
     $module = $this->detectModuleName($request->get('record'));
     $record = $this->processRetrieve($request);
     $this->resolveRecordValues($record, $current_user);
     $response = new Mobile_API_Response();
     $ret_arr = array('record' => $record);
     if ($request->get('module')) {
         $module = $request->get('module');
         $moduleWSFieldNames = Mobile_WS_Utils::getEntityFieldnames($module);
         foreach ($moduleWSFieldNames as $key => $value) {
             $relatedlistcontent[$key] = $record[$value];
         }
         $relatedlistcontent['id'] = $record['id'];
         $ret_arr['relatedlistcontent'] = $relatedlistcontent;
     } elseif (vtlib_isModuleActive('ModComments') and $module != 'HelpDesk') {
         include_once 'include/Webservices/Query.php';
         $comments = vtws_query("SELECT * FROM ModComments WHERE related_to = '" . $record['id'] . "' ORDER BY createdtime DESC LIMIT 5;", $current_user);
         if (count($comments) > 0) {
             foreach ($comments as &$comment) {
                 $comment['assigned_user_id'] = vtws_getName($comment['assigned_user_id'], $current_user);
                 $comment['createdtime'] = DateTimeField::convertToUserFormat($comment['createdtime']);
             }
             $ret_arr['comments'] = $comments;
         } else {
             $ret_arr['comments'] = array();
         }
     } elseif ($module == 'HelpDesk') {
         //there is currently no vtws service for ticket comments
         $comments = Mobile_WS_Utils::getTicketComments($record);
         if (!empty($comments)) {
             foreach ($comments as &$comment) {
                 $comment['assigned_user_id'] = vtws_getName($comment['assigned_user_id'], $current_user);
                 $comment['createdtime'] = DateTimeField::convertToUserFormat($comment['createdtime']);
             }
             $ret_arr['comments'] = $comments;
         } else {
             $ret_arr['comments'] = array();
         }
     }
     $response->setResult($ret_arr);
     return $response;
 }
Beispiel #21
0
 function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     if ('true' == $request->get('type_remainder')) {
         $recordModels = Calendar_Module_Model::getCalendarReminder(true);
     } else {
         $recordModels = Calendar_Module_Model::getCalendarReminder();
     }
     foreach ($recordModels as $record) {
         $record->updateReminderStatus(2);
     }
     $permissionToSendEmail = vtlib_isModuleActive('OSSMail') && Users_Privileges_Model::isPermitted('OSSMail', 'compose');
     $viewer->assign('PERMISSION_TO_SENDE_MAIL', $permissionToSendEmail);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('RECORDS', $recordModels);
     $viewer->view('Reminders.tpl', $moduleName);
 }
Beispiel #22
0
 function save_module($module)
 {
     global $adb;
     if ($this->HasDirectImageField) {
         $this->insertIntoAttachment($this->id, $module);
     }
     //in ajax save we should not call this function, because this will delete all the existing product values
     if (inventoryCanSaveProductLines($_REQUEST)) {
         //Based on the total Number of rows we will save the product relationship with this entity
         saveInventoryProductDetails($this, 'PurchaseOrder');
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($this, 'PurchaseOrder');
         }
     }
     // Update the currency id and the conversion rate for the purchase order
     $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?";
     $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
     $adb->pquery($update_query, $update_params);
 }
Beispiel #23
0
 function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $menuModelsList = Vtiger_Menu_Model::getAll(true);
     $selectedModule = $request->getModule();
     $menuStructure = Vtiger_MenuStructure_Model::getInstanceFromMenuList($menuModelsList, $selectedModule);
     $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('VIEW', $request->get('view'));
     // Order by pre-defined automation process for QuickCreate.
     uksort($menuModelsList, array('Vtiger_MenuStructure_Model', 'sortMenuItemsByProcess'));
     $viewer->assign('MENUS', $menuModelsList);
     //$viewer->assign('MENU_STRUCTURE', $menuStructure);
     $viewer->assign('MENU_SELECTED_MODULENAME', $selectedModule);
     $viewer->assign('MENU_TOPITEMS_LIMIT', $menuStructure->getLimit());
     $viewer->assign('COMPANY_LOGO', $companyLogo);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $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'));
     // OpenSaaS
     $OSSMenu = OSSMenuManager_Record_Model::getMenu();
     $paintedIcon = OSSMenuManager_Record_Model::getIcon();
     $viewer->assign('MENU_STRUCTURE', $OSSMenu);
     $viewer->assign('PAINTEDICON', $paintedIcon);
     $viewer->assign('WORKTIME', OSSEmployees_Record_Model::getWorkTime());
     //  OpenSaaS
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
Beispiel #24
0
function vtJsonDependentModules($adb, $request)
{
    $moduleName = $request['modulename'];
    $result = $adb->pquery("SELECT fieldname, tabid, typeofdata, vtiger_ws_referencetype.type as reference_module FROM vtiger_field\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_ws_fieldtype ON vtiger_field.uitype = vtiger_ws_fieldtype.uitype\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_ws_referencetype ON vtiger_ws_fieldtype.fieldtypeid = vtiger_ws_referencetype.fieldtypeid\n\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\tSELECT fieldname, tabid, typeofdata, relmodule as reference_module FROM vtiger_field\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_fieldmodulerel ON vtiger_field.fieldid = vtiger_fieldmodulerel.fieldid", array());
    $noOfFields = $adb->num_rows($result);
    $dependentFields = array();
    // List of modules which will not be supported by 'Create Entity' workflow task
    $filterModules = array('Invoice', 'Quotes', 'SalesOrder', 'PurchaseOrder', 'Emails', 'Calendar', 'Events', 'Accounts');
    $skipFieldsList = array();
    for ($i = 0; $i < $noOfFields; ++$i) {
        $tabId = $adb->query_result($result, $i, 'tabid');
        $fieldName = $adb->query_result($result, $i, 'fieldname');
        $typeOfData = $adb->query_result($result, $i, 'typeofdata');
        $referenceModule = $adb->query_result($result, $i, 'reference_module');
        $tabModuleName = getTabModuleName($tabId);
        if (in_array($tabModuleName, $filterModules)) {
            continue;
        }
        if ($referenceModule == $moduleName && $tabModuleName != $moduleName) {
            if (!vtlib_isModuleActive($tabModuleName)) {
                continue;
            }
            $dependentFields[$tabModuleName] = array('fieldname' => $fieldName, 'modulelabel' => getTranslatedString($tabModuleName, $tabModuleName));
        } else {
            $dataTypeInfo = explode('~', $typeOfData);
            if ($dataTypeInfo[1] == 'M') {
                // If the current reference field is mandatory
                $skipFieldsList[$tabModuleName] = array('fieldname' => $fieldName);
            }
        }
    }
    foreach ($skipFieldsList as $tabModuleName => $fieldInfo) {
        $dependentFieldInfo = $dependentFields[$tabModuleName];
        if ($dependentFieldInfo['fieldname'] != $fieldInfo['fieldname']) {
            unset($dependentFields[$tabModuleName]);
        }
    }
    $returnValue = array('count' => count($dependentFields), 'entities' => $dependentFields);
    echo Zend_Json::encode($returnValue);
}
Beispiel #25
0
/** Function to get Secondary columns for an advanced filter
 *  This function accepts The module as an argument
 *  This generate columns of the secondary module for the advanced filter 
 *  It returns a HTML string of combo values
 */
function getSecondaryColumns_AdvFilterHTML($module, $selected = "")
{
    global $ITS4YouReports;
    global $app_list_strings;
    global $current_language;
    if ($module != "") {
        $secmodule = explode(":", $module);
        for ($i = 0; $i < count($secmodule); $i++) {
            $modulename = vtlib_getModuleNameById($secmodule[$i]);
            $mod_strings = return_module_language($current_language, $modulename);
            if (vtlib_isModuleActive($modulename)) {
                $block_listed = array();
                foreach ($ITS4YouReports->module_list[$modulename] as $key => $value) {
                    if (isset($ITS4YouReports->sec_module_columnslist[$modulename][$key]) && !$block_listed[$key]) {
                        $block_listed[$key] = true;
                        $shtml .= "<optgroup label=\"" . $app_list_strings['moduleList'][$modulename] . " " . getTranslatedString($key) . "\" class=\"select\" style=\"border:none\">";
                        foreach ($ITS4YouReports->sec_module_columnslist[$modulename][$key] as $field => $fieldlabel) {
                            if (isset($mod_strings[$fieldlabel])) {
                                if ($selected == $field) {
                                    $shtml .= "<option selected value=\"" . $field . "\">" . $mod_strings[$fieldlabel] . "</option>";
                                } else {
                                    $shtml .= "<option value=\"" . $field . "\">" . $mod_strings[$fieldlabel] . "</option>";
                                }
                            } else {
                                if ($selected == $field) {
                                    $shtml .= "<option selected value=\"" . $field . "\">" . $fieldlabel . "</option>";
                                } else {
                                    $shtml .= "<option value=\"" . $field . "\">" . $fieldlabel . "</option>";
                                }
                            }
                        }
                        $shtml .= "</optgroup>";
                    }
                }
            }
        }
    }
    return $shtml;
}
Beispiel #26
0
/** Function to get Secondary columns for an advanced filter
 *  This function accepts The module as an argument
 *  This generate columns of the secondary module for the advanced filter
 *  It returns a HTML string of combo values
 */
function getSecondaryColumns_AdvFilterHTML($module, $selected = "")
{
    global $ogReport, $app_list_strings;
    if ($module != '') {
        $secmodule = explode(":", $module);
        for ($i = 0; $i < count($secmodule); $i++) {
            if (vtlib_isModuleActive($secmodule[$i])) {
                $block_listed = array();
                foreach ($ogReport->module_list[$secmodule[$i]] as $key => $value) {
                    if (isset($ogReport->sec_module_columnslist[$secmodule[$i]][$value]) && !$block_listed[$value]) {
                        $block_listed[$value] = true;
                        $shtml .= "<optgroup label=\"" . $app_list_strings['moduleList'][$secmodule[$i]] . " " . getTranslatedString($value, $secmodule[$i]) . "\" class=\"select\" style=\"border:none\">";
                        foreach ($ogReport->sec_module_columnslist[$secmodule[$i]][$value] as $field => $fieldlabel) {
                            $fldlbl = str_replace(array("\n", "\r"), '', getTranslatedString($fieldlabel, $secmodule[$i]));
                            $field = decode_html($field);
                            $shtml .= '<option ' . ($selected == $field ? 'selected' : '') . ' value="' . $field . "\">{$fldlbl}</option>";
                        }
                    }
                }
            }
        }
    }
    return $shtml;
}
Beispiel #27
0
 /**
  *
  */
 private function getDefaultDetails($dfid, $calCnt)
 {
     global $adb;
     $qry = "select * from vtiger_homedefault where stuffid=?";
     $result = $adb->pquery($qry, array($dfid));
     $maxval = $adb->query_result($result, 0, "maxentries");
     $hometype = $adb->query_result($result, 0, "hometype");
     if ($hometype == "ALVT" && vtlib_isModuleActive("Accounts")) {
         include_once "modules/Accounts/ListViewTop.php";
         $home_values = getTopAccounts($maxval, $calCnt);
     } elseif ($hometype == "PLVT" && vtlib_isModuleActive("Potentials")) {
         if (isPermitted('Potentials', 'index') == "yes") {
             include_once "modules/Potentials/ListViewTop.php";
             $home_values = getTopPotentials($maxval, $calCnt);
         }
     } elseif ($hometype == "QLTQ" && vtlib_isModuleActive("Quotes")) {
         if (isPermitted('Quotes', 'index') == "yes") {
             require_once 'modules/Quotes/ListTopQuotes.php';
             $home_values = getTopQuotes($maxval, $calCnt);
         }
     } elseif ($hometype == "HLT" && vtlib_isModuleActive("HelpDesk")) {
         if (isPermitted('HelpDesk', 'index') == "yes") {
             require_once 'modules/HelpDesk/ListTickets.php';
             $home_values = getMyTickets($maxval, $calCnt);
         }
     } elseif ($hometype == "GRT") {
         $home_values = getGroupTaskLists($maxval, $calCnt);
     } elseif ($hometype == "OLTSO" && vtlib_isModuleActive("SalesOrder")) {
         if (isPermitted('SalesOrder', 'index') == "yes") {
             require_once 'modules/SalesOrder/ListTopSalesOrder.php';
             $home_values = getTopSalesOrder($maxval, $calCnt);
         }
     } elseif ($hometype == "ILTI" && vtlib_isModuleActive("Invoice")) {
         if (isPermitted('Invoice', 'index') == "yes") {
             require_once 'modules/Invoice/ListTopInvoice.php';
             $home_values = getTopInvoice($maxval, $calCnt);
         }
     } elseif ($hometype == "MNL" && vtlib_isModuleActive("Leads")) {
         if (isPermitted('Leads', 'index') == "yes") {
             include_once "modules/Leads/ListViewTop.php";
             $home_values = getNewLeads($maxval, $calCnt);
         }
     } elseif ($hometype == "OLTPO" && vtlib_isModuleActive("PurchaseOrder")) {
         if (isPermitted('PurchaseOrder', 'index') == "yes") {
             require_once 'modules/PurchaseOrder/ListTopPurchaseOrder.php';
             $home_values = getTopPurchaseOrder($maxval, $calCnt);
         }
     } elseif ($hometype == "LTFAQ" && vtlib_isModuleActive("Faq")) {
         if (isPermitted('Faq', 'index') == "yes") {
             require_once 'modules/Faq/ListFaq.php';
             $home_values = getMyFaq($maxval, $calCnt);
         }
     } elseif ($hometype == "CVLVT") {
         include_once "modules/CustomView/ListViewTop.php";
         $home_values = getKeyMetrics($maxval, $calCnt);
     } elseif ($hometype == 'UA' && vtlib_isModuleActive("Calendar")) {
         require_once "modules/Home/HomeUtils.php";
         $home_values = homepage_getUpcomingActivities($maxval, $calCnt);
     } elseif ($hometype == 'PA' && vtlib_isModuleActive("Calendar")) {
         require_once "modules/Home/HomeUtils.php";
         $home_values = homepage_getPendingActivities($maxval, $calCnt);
     }
     if ($calCnt == 'calculateCnt') {
         return $home_values;
     }
     $return_value = array();
     if (count($home_values) > 0) {
         $return_value = array('Maxentries' => $maxval, 'Details' => $home_values);
     }
     return $return_value;
 }
    $smarty = new vtigerCRM_Smarty();
    $smarty->assign('APP', $appStrings);
    $mod = array_merge(return_module_language($current_language, 'FieldFormulas'), return_module_language($current_language, 'Settings'));
    $jsStrings = array('NEED_TO_ADD_A' => $mod['NEED_TO_ADD_A'], 'CUSTOM_FIELD' => $mod['LBL_CUSTOM_FIELD'], 'LBL_USE_FUNCTION_DASHDASH' => $mod['LBL_USE_FUNCTION_DASHDASH'], 'LBL_USE_FIELD_VALUE_DASHDASH' => $mod['LBL_USE_FIELD_VALUE_DASHDASH'], 'LBL_DELETE_EXPRESSION_CONFIRM' => $mod['LBL_DELETE_EXPRESSION_CONFIRM']);
    $smarty->assign("JS_STRINGS", Zend_Json::encode($jsStrings));
    $smarty->assign("MOD", $mod);
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE_NAME", 'FieldFormulas');
    $smarty->assign("PAGE_NAME", 'LBL_FIELDFORMULAS');
    $smarty->assign("PAGE_TITLE", 'LBL_FIELDFORMULAS');
    $smarty->assign("PAGE_DESC", 'LBL_FIELDFORMULAS_DESCRIPTION');
    $smarty->assign("FORMODULE", $formodule);
    if (file_exists("modules/{$formodule}/{$formodule}.php")) {
        $focus = CRMEntity::getInstance($formodule);
        $validationArray = split_validationdataArray(getDBValidationData($focus->tab_name, getTabid($formodule)));
        $smarty->assign('VALIDATION_DATA_FIELDNAME', $validationArray['fieldname']);
        $smarty->assign('VALIDATION_DATA_FIELDDATATYPE', $validationArray['datatype']);
        $smarty->assign('VALIDATION_DATA_FIELDLABEL', $validationArray['fieldlabel']);
    }
    $smarty->display(vtlib_getModuleTemplate('FieldFormulas', 'EditExpressions.tpl'));
}
$modules = vtGetModules($adb);
if (vtlib_isModuleActive('FieldFormulas') && in_array(getTranslatedString($_REQUEST['formodule']), $modules)) {
    vtEditExpressions($adb, $app_strings, $current_language, $theme, $_REQUEST['formodule']);
} else {
    echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
    echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 80%; position: relative; z-index: 10000000;'>\n\n\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t<tbody><tr>\n\t<td rowspan='2' width='11%'><img src='" . vtiger_imageurl('denied.gif', $theme) . "' ></td>\n\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'><span class='genHeaderSmall'>" . $app_strings['LBL_PERMISSION'] . " </span></td>\n\t</tr>\n\t<tr>\n\t<td class='small' align='right' nowrap='nowrap'>\n\t<a href='javascript:window.history.back();'>{$app_strings['LBL_BACK']}</a><br></td>\n\t</tr>\n\t</tbody></table>\n\t</div>";
    echo "</td></tr></table>";
    die;
}
Beispiel #29
0
/**
 * this function returns the value of use_asterisk from the database for the current user
 * @param string $id - the id of the current user
 */
function get_use_asterisk($id)
{
    global $adb;
    if (!vtlib_isModuleActive('PBXManager') || isPermitted('PBXManager', 'index') == 'no') {
        return false;
    }
    $sql = "select * from vtiger_asteriskextensions where userid = ?";
    $result = $adb->pquery($sql, array($id));
    if ($adb->num_rows($result) > 0) {
        $use_asterisk = $adb->query_result($result, 0, "use_asterisk");
        $asterisk_extension = $adb->query_result($result, 0, "asterisk_extension");
        if ($use_asterisk == 0 || empty($asterisk_extension)) {
            return 'false';
        } else {
            return 'true';
        }
    } else {
        return 'false';
    }
}
Beispiel #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;
     }
 }