Ejemplo n.º 1
0
 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $this->getModule($request);
     $sourceModule = $request->get('src_module');
     $sourceRecord = $request->get('src_record');
     //list of records is narrowed to contacts related to help desks account, only in Help Desk Contacts relation view
     if ($moduleName == 'Contacts' && $sourceModule == 'HelpDesk' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=HelpDesk') === 0) {
         $request->set('related_parent_module', 'Accounts');
         $helpDeskRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'HelpDesk');
         $request->set('related_parent_id', $helpDeskRecord->get('parent_id'));
         $viewer->assign('SWITCH', true);
     }
     if ($moduleName == 'Contacts' && $sourceModule == 'SSalesProcesses' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=SSalesProcesses') === 0) {
         $request->set('related_parent_module', 'Accounts');
         $moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'SSalesProcesses');
         $request->set('related_parent_id', $moduleRecord->get('related_to'));
         $viewer->assign('SWITCH', true);
     }
     if ($moduleName == 'Contacts' && $sourceModule == 'Project' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=Project') === 0) {
         $request->set('related_parent_module', 'Accounts');
         $moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'Project');
         $request->set('related_parent_id', $moduleRecord->get('linktoaccountscontacts'));
         $viewer->assign('SWITCH', true);
     }
     parent::initializeListViewContents($request, $viewer);
 }
Ejemplo n.º 2
0
 function __construct()
 {
     parent::__construct();
     $this->exposeMethod('getListViewCount');
     $this->exposeMethod('getRecordsCount');
     $this->exposeMethod('getPageCount');
 }
 /**
  * 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->get('src_module');
     $jsFileNames = array("modules.Products.resources.ProductsPopup", '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;
 }
Ejemplo n.º 4
0
 function __construct()
 {
     global $log;
     $log->debug("Entering ./views/PopupAjax.php::__construct");
     parent::__construct();
     $this->exposeMethod('getListViewCount');
     $this->exposeMethod('getRecordsCount');
     $this->exposeMethod('getPageCount');
 }
Ejemplo n.º 5
0
 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     //src_module value is added just to stop showing inactive services
     $request->set('src_module', $request->getModule());
     parent::initializeListViewContents($request, $viewer);
     $viewer->assign('MODULE', $request->getModule());
     //$viewer->assign('GETURL', 'getTaxesURL');
     $viewer->assign('VIEW', 'CalculationsPopup');
 }
Ejemplo n.º 6
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();
     $modulePopUpFile = 'modules.' . $moduleName . '.resources.Popup';
     unset($headerScriptInstances[$modulePopUpFile]);
     $jsFileNames = array('modules.Inventory.resources.Popup');
     $jsFileNames[] = $modulePopUpFile;
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
     return $headerScriptInstances;
 }
Ejemplo n.º 7
0
	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
		$moduleName = $this->getModule($request);
		$sourceModule = $request->get('src_module');
		$sourceField = $request->get('src_field');

		if(in_array($sourceModule, array('Quotes', 'SalesOrder')) && $sourceField == 'potential_id') {
            $relatedParentModule = $request->get('related_parent_module');
			$relatedParentId = $request->get('related_parent_id');

            if(empty($relatedParentModule)) {
                return parent::initializeListViewContents($request, $viewer);
            }

			$cvId = $request->get('cvid');
			$pageNumber = $request->get('page');
			$orderBy = $request->get('orderby');
			$sortOrder = $request->get('sortorder');
			$sourceRecord = $request->get('src_record');
			$searchKey = $request->get('search_key');
			$searchValue = $request->get('search_value');
			$currencyId = $request->get('currency_id');

			$requestedPage = $pageNumber;
			if(empty ($requestedPage)) {
				$requestedPage = 1;
			}

			$pagingModel = new Vtiger_Paging_Model();
			$pagingModel->set('page',$requestedPage);

			$parentRecordModel = Vtiger_Record_Model::getInstanceById($relatedParentId, $relatedParentModule);
			$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $moduleName, $label);

			if($sortOrder == "ASC") {
				$nextSortOrder = "DESC";
				$sortImage = "icon-chevron-down";
			} else {
				$nextSortOrder = "ASC";
				$sortImage = "icon-chevron-up";
			}
			if(!empty($orderBy)) {
				$relationListView->set('orderby', $orderBy);
				$relationListView->set('sortorder',$sortOrder);
			}

			$headers = $relationListView->getHeaders();
			$models = $relationListView->getEntries($pagingModel);
			$noOfEntries = count($models);
			foreach ($models as $recordId => $recordModel) {
				foreach ($headers as $fieldName => $fieldModel) {
					$recordModel->set($fieldName, $recordModel->getDisplayValue($fieldName));
				}
				$models[$recordId] = $recordModel;
			}

			//To handle special operation when selecting record from Popup
			$getUrl = $request->get('get_url');

			//Check whether the request is in multi select mode
			$multiSelectMode = $request->get('multi_select');
			if(empty($multiSelectMode)) {
				$multiSelectMode = false;
			}

			if(empty($cvId)) {
				$cvId = '0';
			}
			if(empty ($pageNumber)){
				$pageNumber = '1';
			}

			$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
			$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);

			$viewer->assign('MODULE', $moduleName);

			$viewer->assign('SOURCE_MODULE', $sourceModule);
			$viewer->assign('SOURCE_FIELD', $sourceField);
			$viewer->assign('SOURCE_RECORD', $sourceRecord);

			$viewer->assign('RELATED_PARENT_MODULE', $relatedParentModule);
			$viewer->assign('RELATED_PARENT_ID', $relatedParentId);

			$viewer->assign('SEARCH_KEY', $searchKey);
			$viewer->assign('SEARCH_VALUE', $searchValue);

			$viewer->assign('ORDER_BY',$orderBy);
			$viewer->assign('SORT_ORDER',$sortOrder);
			$viewer->assign('NEXT_SORT_ORDER',$nextSortOrder);
			$viewer->assign('SORT_IMAGE',$sortImage);
			$viewer->assign('GETURL', $getUrl);
			$viewer->assign('CURRENCY_ID', $currencyId);

			$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
			$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());

			$viewer->assign('PAGING_MODEL', $pagingModel);
			$viewer->assign('PAGE_NUMBER',$pageNumber);

			$viewer->assign('LISTVIEW_ENTIRES_COUNT',$noOfEntries);
			$viewer->assign('LISTVIEW_HEADERS', $headers);
			$viewer->assign('LISTVIEW_ENTRIES', $models);
			
			if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
				if(!$this->listViewCount){
					$this->listViewCount = $relationListView->getRelatedEntriesCount();
				}
				$totalCount = $this->listViewCount;
				$pageLimit = $pagingModel->getPageLimit();
				$pageCount = ceil((int) $totalCount / (int) $pageLimit);

				if($pageCount == 0){
					$pageCount = 1;
				}
				$viewer->assign('PAGE_COUNT', $pageCount);
				$viewer->assign('LISTVIEW_COUNT', $totalCount);
			}

			$viewer->assign('MULTI_SELECT', $multiSelectMode);
			$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
		} else {
			return parent::initializeListViewContents($request, $viewer);
		}
	}
 /**
  * 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('modules.Vtiger.resources.EmailsRelatedPopup');
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
     return $headerScriptInstances;
 }
Ejemplo n.º 9
0
 function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     parent::initializeListViewContents($request, $viewer);
 }
Ejemplo n.º 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 getHeaderScripts(Vtiger_Request $request)
 {
     global $log;
     $log->debug("Entering ./views/EmailsRelatedModulePopup.php::getHeaderScripts");
     $headerScriptInstances = parent::getHeaderScripts($request);
     $moduleName = $request->getModule();
     $jsFileNames = array('modules.Vtiger.resources.EmailsRelatedPopup');
     $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
     $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
     return $headerScriptInstances;
 }