Esempio n. 1
0
 function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $page = $request->get('page');
     $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', self::REPORT_LIMIT);
     $this->reportData = $reportModel->getReportData($pagingModel);
     $this->calculationFields = $reportModel->getReportCalulationData();
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $detailViewLinks = $detailViewModel->getDetailViewLinks();
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter(false));
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('COUNT', count($this->reportData));
     $viewer->assign('MODULE', $moduleName);
     $viewer->view('ReportHeader.tpl', $moduleName);
 }
Esempio n. 2
0
 public function getFieldDataType()
 {
     if ($this->getName() == 'contact_id') {
         return 'multireference';
     }
     return parent::getFieldDataType();
 }
Esempio n. 3
0
 /**
  * Function to check whether field is ajax editable'
  * @return <Boolean>
  */
 public function isAjaxEditable()
 {
     $return = parent::isAjaxEditable();
     if (!$return || 'recurringtype' == $this->getFieldName()) {
         return false;
     }
     return true;
 }
Esempio n. 4
0
 function preProcess(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $this->record = $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     parent::preProcess($request);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $isAdmin = $currentUser->isAdminUser();
     $viewer->assign('isAdmin', $isAdmin);
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $moduleName);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $reportChartModel = Reports_Chart_Model::getInstanceById($reportModel);
     $viewer->assign('PRIMARY_MODULE_FIELDS', $reportModel->getPrimaryModuleFieldsForAdvancedReporting());
     $viewer->assign('SECONDARY_MODULE_FIELDS', $reportModel->getSecondaryModuleFieldsForAdvancedReporting());
     $viewer->assign('CALCULATION_FIELDS', $reportModel->getModuleCalculationFieldsForReport());
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD', $recordId);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CHART_MODEL', $reportChartModel);
     $viewer->view('ChartReportHeader.tpl', $moduleName);
 }
Esempio n. 5
0
 /**
  * Customize the display value for detail view.
  */
 public function getDisplayValue($value, $record = false, $recordInstance = false)
 {
     if ($recordInstance) {
         if ($this->getName() == 'due_date') {
             $displayValue = $value . ' ' . $recordInstance->get('time_end');
             $value = $this->getUITypeModel()->getDisplayValue($displayValue);
             list($endDate, $endTime, $meridiem) = explode(' ', $value);
             return $endDate . ' ' . $endTime . ' ' . $meridiem;
         }
     }
     return parent::getDisplayValue($value, $record, $recordInstance);
 }
Esempio n. 6
0
 /**
  * Function to display the UI for advance search on any of the module
  * @param Vtiger_Request $request
  */
 function showAdvancedSearch(Vtiger_Request $request)
 {
     //Modules for which search is excluded
     $excludedModuleForSearch = array('Vtiger', 'Reports');
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     if ($request->get('source_module')) {
         $moduleName = $request->get('source_module');
     }
     $saveFilterPermitted = true;
     $saveFilterexcludedModules = array('ModComments', 'RSS', 'Portal', 'Integration', 'PBXManager', 'DashBoard');
     if (in_array($moduleName, $saveFilterexcludedModules)) {
         $saveFilterPermitted = false;
     }
     //See if it is an excluded module, If so search in home module
     if (in_array($moduleName, $excludedModuleForSearch)) {
         $moduleName = 'Home';
     }
     $module = $request->getModule();
     $customViewModel = new CustomView_Record_Model();
     $customViewModel->setModule($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
     $viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
     $viewer->assign('CUSTOMVIEW_MODEL', $customViewModel);
     if ($moduleName == 'Calendar') {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('SOURCE_MODULE', $moduleName);
     $viewer->assign('SOURCE_MODULE_MODEL', $moduleModel);
     $viewer->assign('MODULE', $module);
     $viewer->assign('SAVE_FILTER_PERMITTED', $saveFilterPermitted);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     echo $viewer->view('AdvanceSearch.tpl', $moduleName, true);
 }
Esempio n. 7
0
 /**
  * Customize the display value for detail view.
  */
 public function getDisplayValue($value, $record = false, $recordInstance = false)
 {
     if ($recordInstance) {
         if ($this->getName() == 'due_date') {
             $displayValue = $value . ' ' . $recordInstance->get('time_end');
             $value = $this->getUITypeModel()->getDisplayValue($displayValue);
             list($endDate, $endTime) = explode(' ', $value);
             $currentUser = Users_Record_Model::getCurrentUserModel();
             if ($currentUser->get('hour_format') == '12') {
                 $endTime = Vtiger_Time_UIType::getTimeValueInAMorPM($endTime);
             }
             return $endDate . ' ' . $endTime;
         }
     }
     return parent::getDisplayValue($value, $record, $recordInstance);
 }
Esempio n. 8
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->get('source_module');
     $module = $request->getModule();
     $record = $request->get('record');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
     if (!empty($record)) {
         $customViewModel = CustomView_Record_Model::getInstanceById($record);
         $viewer->assign('MODE', 'edit');
     } else {
         $customViewModel = new CustomView_Record_Model();
         $customViewModel->setModule($moduleName);
         $viewer->assign('MODE', '');
     }
     $viewer->assign('ADVANCE_CRITERIA', $customViewModel->transformToNewAdvancedFilter());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('DATE_FILTERS', Vtiger_Field_Model::getDateFilterTypes());
     if ($moduleName == 'Calendar') {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('CUSTOMVIEW_MODEL', $customViewModel);
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('MODULE', $module);
     $viewer->assign('SOURCE_MODULE', $moduleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('CV_PRIVATE_VALUE', CustomView_Record_Model::CV_STATUS_PRIVATE);
     $viewer->assign('CV_PENDING_VALUE', CustomView_Record_Model::CV_STATUS_PENDING);
     $viewer->assign('CV_PUBLIC_VALUE', CustomView_Record_Model::CV_STATUS_PUBLIC);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     echo $viewer->view('EditView.tpl', $module, true);
 }
Esempio n. 9
0
 function step2(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $reportModel = Reports_Record_Model::getCleanInstance($record);
     if (!empty($record) && !$request->get('isDuplicate')) {
         $viewer->assign('SELECTED_STANDARD_FILTER_FIELDS', $reportModel->getSelectedStandardFilter());
         $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     }
     $data = $request->getAll();
     foreach ($data as $name => $value) {
         $reportModel->set($name, $value);
     }
     $primaryModule = $request->get('primary_module');
     $secondaryModules = $request->get('secondary_modules');
     $reportModel->setPrimaryModule($primaryModule);
     if (!empty($secondaryModules)) {
         $secondaryModules = implode(':', $secondaryModules);
         $reportModel->setSecondaryModule($secondaryModules);
         $secondaryModules = explode(':', $secondaryModules);
     } else {
         $secondaryModules = array();
     }
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     $viewer->assign('SECONDARY_MODULES', $secondaryModules);
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $moduleName);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     if ($primaryModule == 'Calendar' || in_array('Calendar', $secondaryModules)) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $viewer->assign('MODULE', $moduleName);
     $calculationFields = $reportModel->get('calculation_fields');
     if ($calculationFields) {
         $calculationFields = Zend_Json::decode($calculationFields);
         $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter($calculationFields));
     }
     if ($request->get('isDuplicate')) {
         $viewer->assign('IS_DUPLICATE', true);
     }
     $viewer->view('ChartEditStep2.tpl', $moduleName);
 }
    function content_56854396b279a($_smarty_tpl)
    {
        ?>
<div class="row-fluid conditionRow marginBottom10px"><span class="span4"><select class="<?php 
        if (empty($_smarty_tpl->tpl_vars['NOCHOSEN']->value)) {
            ?>
chzn-select<?php 
        }
        ?>
 row-fluid" name="columnname"><option value="none"><?php 
        echo vtranslate('LBL_SELECT_FIELD', $_smarty_tpl->tpl_vars['MODULE']->value);
        ?>
</option><?php 
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = false;
        $_smarty_tpl->tpl_vars['BLOCK_LABEL'] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['RECORD_STRUCTURE']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key => $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value) {
            $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = true;
            $_smarty_tpl->tpl_vars['BLOCK_LABEL']->value = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key;
            ?>
<optgroup label='<?php 
            echo vtranslate($_smarty_tpl->tpl_vars['BLOCK_LABEL']->value, $_smarty_tpl->tpl_vars['SOURCE_MODULE']->value);
            ?>
'><?php 
            $_smarty_tpl->tpl_vars['FIELD_MODEL'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = false;
            $_smarty_tpl->tpl_vars['FIELD_NAME'] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['FIELD_MODEL']->key => $_smarty_tpl->tpl_vars['FIELD_MODEL']->value) {
                $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = true;
                $_smarty_tpl->tpl_vars['FIELD_NAME']->value = $_smarty_tpl->tpl_vars['FIELD_MODEL']->key;
                $_smarty_tpl->tpl_vars['FIELD_INFO'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldInfo(), null, 0);
                $_smarty_tpl->tpl_vars['MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getModule(), null, 0);
                $_smarty_tpl->tpl_vars["SPECIAL_VALIDATOR"] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getValidator(), null, 0);
                if (!empty($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value)) {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value, null, 0);
                } else {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable('getCustomViewColumnName', null, 0);
                }
                ?>
<option value="<?php 
                $_tmp1 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp1}();
                ?>
" data-fieldtype="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldType();
                ?>
" data-field-name="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_NAME']->value;
                ?>
"<?php 
                $_tmp2 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                if (decode_html($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp2}()) == decode_html($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['columnname'])) {
                    $_smarty_tpl->tpl_vars['FIELD_TYPE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldType(), null, 0);
                    $_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value, null, 0);
                    if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType() == 'reference') {
                        $_smarty_tpl->tpl_vars['FIELD_TYPE'] = new Smarty_variable('V', null, 0);
                    }
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['value'] = decode_html($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['value']);
                    ?>
selected="selected"<?php 
                }
                if ($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name') == 'Calendar' && $_smarty_tpl->tpl_vars['FIELD_NAME']->value == 'recurringtype') {
                    $_smarty_tpl->tpl_vars['PICKLIST_VALUES'] = new Smarty_variable(Calendar_Field_Model::getReccurencePicklistValues(), null, 0);
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues'] = $_smarty_tpl->tpl_vars['PICKLIST_VALUES']->value;
                }
                if ($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name') == 'Calendar' && $_smarty_tpl->tpl_vars['FIELD_NAME']->value == 'activitytype') {
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues']['Task'] = vtranslate('Task', 'Calendar');
                }
                if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType() == 'reference') {
                    $_smarty_tpl->tpl_vars['referenceList'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getWebserviceFieldObject()->getReferenceList(), null, 0);
                    if (is_array($_smarty_tpl->tpl_vars['referenceList']->value) && in_array('Users', $_smarty_tpl->tpl_vars['referenceList']->value)) {
                        $_smarty_tpl->tpl_vars['USERSLIST'] = new Smarty_variable(array(), null, 0);
                        $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL'] = new Smarty_variable(Users_Record_Model::getCurrentUserModel(), null, 0);
                        $_smarty_tpl->tpl_vars['ACCESSIBLE_USERS'] = new Smarty_variable($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->getAccessibleUsers(), null, 0);
                        $_smarty_tpl->tpl_vars['USER_NAME'] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars['USER_NAME']->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['ACCESSIBLE_USERS']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars['USER_NAME']->key => $_smarty_tpl->tpl_vars['USER_NAME']->value) {
                            $_smarty_tpl->tpl_vars['USER_NAME']->_loop = true;
                            $_smarty_tpl->createLocalArrayVariable('USERSLIST', null, 0);
                            $_smarty_tpl->tpl_vars['USERSLIST']->value[$_smarty_tpl->tpl_vars['USER_NAME']->value] = $_smarty_tpl->tpl_vars['USER_NAME']->value;
                        }
                        $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                        $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues'] = $_smarty_tpl->tpl_vars['USERSLIST']->value;
                        $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                        $_smarty_tpl->tpl_vars['FIELD_INFO']->value['type'] = 'picklist';
                    }
                }
                ?>
data-fieldinfo='<?php 
                echo Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($_smarty_tpl->tpl_vars['FIELD_INFO']->value));
                ?>
'<?php 
                if (!empty($_smarty_tpl->tpl_vars['SPECIAL_VALIDATOR']->value)) {
                    ?>
data-validator='<?php 
                    echo Zend_Json::encode($_smarty_tpl->tpl_vars['SPECIAL_VALIDATOR']->value);
                    ?>
'<?php 
                }
                ?>
><?php 
                if ($_smarty_tpl->tpl_vars['SOURCE_MODULE']->value != $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name')) {
                    ?>
(<?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                    ?>
)  <?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                } else {
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['SOURCE_MODULE']->value);
                }
                ?>
</option><?php 
            }
            ?>
</optgroup><?php 
        }
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = false;
        $_smarty_tpl->tpl_vars['BLOCK_LABEL'] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['EVENT_RECORD_STRUCTURE']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key => $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value) {
            $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = true;
            $_smarty_tpl->tpl_vars['BLOCK_LABEL']->value = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key;
            ?>
<optgroup label='<?php 
            echo vtranslate($_smarty_tpl->tpl_vars['BLOCK_LABEL']->value, 'Events');
            ?>
'><?php 
            $_smarty_tpl->tpl_vars['FIELD_MODEL'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = false;
            $_smarty_tpl->tpl_vars['FIELD_NAME'] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['FIELD_MODEL']->key => $_smarty_tpl->tpl_vars['FIELD_MODEL']->value) {
                $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = true;
                $_smarty_tpl->tpl_vars['FIELD_NAME']->value = $_smarty_tpl->tpl_vars['FIELD_MODEL']->key;
                $_smarty_tpl->tpl_vars['FIELD_INFO'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldInfo(), null, 0);
                $_smarty_tpl->tpl_vars['MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getModule(), null, 0);
                if (!empty($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value)) {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value, null, 0);
                } else {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable('getCustomViewColumnName', null, 0);
                }
                ?>
<option value="<?php 
                $_tmp3 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp3}();
                ?>
" data-fieldtype="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldType();
                ?>
" data-field-name="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_NAME']->value;
                ?>
"<?php 
                $_tmp4 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                if (decode_html($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp4}()) == $_smarty_tpl->tpl_vars['CONDITION_INFO']->value['columnname']) {
                    $_smarty_tpl->tpl_vars['FIELD_TYPE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldType(), null, 0);
                    $_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value, null, 0);
                    if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType() == 'reference') {
                        $_smarty_tpl->tpl_vars['FIELD_TYPE'] = new Smarty_variable('V', null, 0);
                    }
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['value'] = decode_html($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['value']);
                    ?>
selected="selected"<?php 
                }
                if ($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name') == 'Calendar' && $_smarty_tpl->tpl_vars['FIELD_NAME']->value == 'recurringtype') {
                    $_smarty_tpl->tpl_vars['PICKLIST_VALUES'] = new Smarty_variable(Calendar_Field_Model::getReccurencePicklistValues(), null, 0);
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues'] = $_smarty_tpl->tpl_vars['PICKLIST_VALUES']->value;
                }
                if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType() == 'reference') {
                    $_smarty_tpl->tpl_vars['referenceList'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getWebserviceFieldObject()->getReferenceList(), null, 0);
                    if (is_array($_smarty_tpl->tpl_vars['referenceList']->value) && in_array('Users', $_smarty_tpl->tpl_vars['referenceList']->value)) {
                        $_smarty_tpl->tpl_vars['USERSLIST'] = new Smarty_variable(array(), null, 0);
                        $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL'] = new Smarty_variable(Users_Record_Model::getCurrentUserModel(), null, 0);
                        $_smarty_tpl->tpl_vars['ACCESSIBLE_USERS'] = new Smarty_variable($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->getAccessibleUsers(), null, 0);
                        $_smarty_tpl->tpl_vars['USER_NAME'] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars['USER_NAME']->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['ACCESSIBLE_USERS']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars['USER_NAME']->key => $_smarty_tpl->tpl_vars['USER_NAME']->value) {
                            $_smarty_tpl->tpl_vars['USER_NAME']->_loop = true;
                            $_smarty_tpl->createLocalArrayVariable('USERSLIST', null, 0);
                            $_smarty_tpl->tpl_vars['USERSLIST']->value[$_smarty_tpl->tpl_vars['USER_NAME']->value] = $_smarty_tpl->tpl_vars['USER_NAME']->value;
                        }
                        $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                        $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues'] = $_smarty_tpl->tpl_vars['USERSLIST']->value;
                        $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                        $_smarty_tpl->tpl_vars['FIELD_INFO']->value['type'] = 'picklist';
                    }
                }
                ?>
data-fieldinfo='<?php 
                echo Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($_smarty_tpl->tpl_vars['FIELD_INFO']->value));
                ?>
' ><?php 
                if ($_smarty_tpl->tpl_vars['SOURCE_MODULE']->value != $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name')) {
                    ?>
(<?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                    ?>
)  <?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                } else {
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['SOURCE_MODULE']->value);
                }
                ?>
</option><?php 
            }
            ?>
</optgroup><?php 
        }
        ?>
</select></span><span class="span3"><select class="<?php 
        if (empty($_smarty_tpl->tpl_vars['NOCHOSEN']->value)) {
            ?>
chzn-select<?php 
        }
        ?>
 row-fluid" name="comparator"><option value="none"><?php 
        echo vtranslate('LBL_NONE', $_smarty_tpl->tpl_vars['MODULE']->value);
        ?>
</option><?php 
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS'] = new Smarty_variable($_smarty_tpl->tpl_vars['ADVANCED_FILTER_OPTIONS_BY_TYPE']->value[$_smarty_tpl->tpl_vars['FIELD_TYPE']->value], null, 0);
        if ($_smarty_tpl->tpl_vars['FIELD_TYPE']->value == 'D' || $_smarty_tpl->tpl_vars['FIELD_TYPE']->value == 'DT') {
            $_smarty_tpl->tpl_vars['DATE_FILTER_CONDITIONS'] = new Smarty_variable(array_keys($_smarty_tpl->tpl_vars['DATE_FILTERS']->value), null, 0);
            $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS'] = new Smarty_variable(array_merge($_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS']->value, $_smarty_tpl->tpl_vars['DATE_FILTER_CONDITIONS']->value), null, 0);
        }
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->key => $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value) {
            $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->_loop = true;
            ?>
<option value="<?php 
            echo $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value;
            ?>
"<?php 
            if ($_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value == $_smarty_tpl->tpl_vars['CONDITION_INFO']->value['comparator']) {
                ?>
selected<?php 
            }
            ?>
><?php 
            echo vtranslate($_smarty_tpl->tpl_vars['ADVANCED_FILTER_OPTIONS']->value[$_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value]);
            ?>
</option><?php 
        }
        ?>
</select></span><span class="span4 fieldUiHolder"><input name="<?php 
        if ($_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL']->value) {
            echo $_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL']->value->get('name');
        }
        ?>
" data-value="value" class="row-fluid" type="text" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['value'], ENT_QUOTES, 'UTF-8', true);
        ?>
" /></span><span class="hide"><!-- TODO : see if you need to respect CONDITION_INFO condition or / and  --><?php 
        if (empty($_smarty_tpl->tpl_vars['CONDITION']->value)) {
            $_smarty_tpl->tpl_vars['CONDITION'] = new Smarty_variable("and", null, 0);
        }
        ?>
<input type="hidden" name="column_condition" value="<?php 
        echo $_smarty_tpl->tpl_vars['CONDITION']->value;
        ?>
" /></span><span class="span1"><i class="deleteCondition icon-trash alignMiddle" title="<?php 
        echo vtranslate('LBL_DELETE', $_smarty_tpl->tpl_vars['MODULE']->value);
        ?>
"></i></span></div><?php 
    }
Esempio n. 11
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->get('source_module');
     $module = $request->getModule();
     $record = $request->get('record');
     $duplicate = $request->get('duplicate');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
     if (!empty($record)) {
         $customViewModel = CustomView_Record_Model::getInstanceById($record);
         $viewer->assign('MODE', 'edit');
     } else {
         $customViewModel = new CustomView_Record_Model();
         $customViewModel->setModule($moduleName);
         $viewer->assign('MODE', '');
     }
     $viewer->assign('ADVANCE_CRITERIA', $customViewModel->transformToNewAdvancedFilter());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('DATE_FILTERS', Vtiger_Field_Model::getDateFilterTypes());
     if ($moduleName == 'Calendar') {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $recordStructure = $recordStructureInstance->getStructure();
     // for Inventory module we should now allow item details block
     if (in_array($moduleName, getInventoryModules())) {
         $itemsBlock = "LBL_ITEM_DETAILS";
         unset($recordStructure[$itemsBlock]);
     }
     $viewer->assign('RECORD_STRUCTURE', $recordStructure);
     // Added to show event module custom fields
     if ($moduleName == 'Calendar') {
         $relatedModuleName = 'Events';
         $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModuleName);
         $relatedRecordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($relatedModuleModel);
         $eventBlocksFields = $relatedRecordStructureInstance->getStructure();
         $viewer->assign('EVENT_RECORD_STRUCTURE_MODEL', $relatedRecordStructureInstance);
         $viewer->assign('EVENT_RECORD_STRUCTURE', $eventBlocksFields);
     }
     $viewer->assign('CUSTOMVIEW_MODEL', $customViewModel);
     if ($duplicate != '1') {
         $viewer->assign('RECORD_ID', $record);
     }
     $viewer->assign('MODULE', $module);
     $viewer->assign('SOURCE_MODULE', $moduleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     if ($customViewModel->get('viewname') == 'All') {
         $viewer->assign('CV_PRIVATE_VALUE', CustomView_Record_Model::CV_STATUS_DEFAULT);
     } else {
         $viewer->assign('CV_PRIVATE_VALUE', CustomView_Record_Model::CV_STATUS_PRIVATE);
     }
     $viewer->assign('CV_PENDING_VALUE', CustomView_Record_Model::CV_STATUS_PENDING);
     $viewer->assign('CV_PUBLIC_VALUE', CustomView_Record_Model::CV_STATUS_PUBLIC);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     echo $viewer->view('EditView.tpl', $module, true);
 }
 function step3(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $reportModel = Reports_Record_Model::getCleanInstance($record);
     if (!empty($record)) {
         $viewer->assign('SELECTED_STANDARD_FILTER_FIELDS', $reportModel->getSelectedStandardFilter());
         $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     }
     $data = $request->getAll();
     foreach ($data as $name => $value) {
         if ($name == 'schdayoftheweek' || $name == 'schdayofthemonth' || $name == 'schannualdates' || $name == 'recipients') {
             $value = Zend_Json::decode($value);
             if (!is_array($value)) {
                 // need to save these as json data
                 $value = array($value);
             }
         }
         $reportModel->set($name, $value);
     }
     $primaryModule = $request->get('primary_module');
     $secondaryModules = $request->get('secondary_modules');
     $reportModel->setPrimaryModule($primaryModule);
     if (!empty($secondaryModules)) {
         $secondaryModules = implode(':', $secondaryModules);
         $reportModel->setSecondaryModule($secondaryModules);
         $secondaryModules = explode(':', $secondaryModules);
     } else {
         $secondaryModules = array();
     }
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     //TODO : We need to remove "update_log" field from "HelpDesk" module in New Look
     // after removing old look we need to remove this field from crm
     if ($primaryModule == 'HelpDesk') {
         foreach ($primaryModuleRecordStructure as $blockLabel => $blockFields) {
             foreach ($blockFields as $field => $object) {
                 if ($field == 'update_log') {
                     unset($primaryModuleRecordStructure[$blockLabel][$field]);
                 }
             }
         }
     }
     if (!empty($secondaryModuleRecordStructures)) {
         foreach ($secondaryModuleRecordStructures as $module => $structure) {
             if ($module == 'HelpDesk') {
                 foreach ($structure as $blockLabel => $blockFields) {
                     foreach ($blockFields as $field => $object) {
                         if ($field == 'update_log') {
                             unset($secondaryModuleRecordStructures[$module][$blockLabel][$field]);
                         }
                     }
                 }
             }
         }
     }
     // End
     $viewer->assign('SECONDARY_MODULES', $secondaryModules);
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $moduleName);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     if ($primaryModule == 'Calendar' || in_array('Calendar', $secondaryModules)) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $viewer->assign('MODULE', $moduleName);
     $calculationFields = $reportModel->get('calculation_fields');
     if ($calculationFields) {
         $calculationFields = Zend_Json::decode($calculationFields);
         $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter($calculationFields));
     }
     if ($request->get('isDuplicate')) {
         $viewer->assign('IS_DUPLICATE', true);
     }
     $viewer->view('step3.tpl', $moduleName);
 }
    function content_54d3d27a4619a($_smarty_tpl)
    {
        ?>
<div class="row-fluid conditionRow marginBottom10px"><span class="span4"><select class="<?php 
        if (empty($_smarty_tpl->tpl_vars['NOCHOSEN']->value)) {
            ?>
chzn-select<?php 
        }
        ?>
 row-fluid" name="columnname" data-placeholder="<?php 
        echo vtranslate('LBL_SELECT_FIELD', $_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);
        ?>
"><option value="none"></option><?php 
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = false;
        $_smarty_tpl->tpl_vars['BLOCK_LABEL'] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['RECORD_STRUCTURE']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key => $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value) {
            $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->_loop = true;
            $_smarty_tpl->tpl_vars['BLOCK_LABEL']->value = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->key;
            ?>
<optgroup label='<?php 
            echo vtranslate($_smarty_tpl->tpl_vars['BLOCK_LABEL']->value, $_smarty_tpl->tpl_vars['SELECTED_MODULE_NAME']->value);
            ?>
'><?php 
            $_smarty_tpl->tpl_vars['FIELD_MODEL'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = false;
            $_smarty_tpl->tpl_vars['FIELD_NAME'] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['FIELD_MODEL']->key => $_smarty_tpl->tpl_vars['FIELD_MODEL']->value) {
                $_smarty_tpl->tpl_vars['FIELD_MODEL']->_loop = true;
                $_smarty_tpl->tpl_vars['FIELD_NAME']->value = $_smarty_tpl->tpl_vars['FIELD_MODEL']->key;
                $_smarty_tpl->tpl_vars['FIELD_INFO'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldInfo(), null, 0);
                $_smarty_tpl->tpl_vars['MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getModule(), null, 0);
                if (!empty($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value)) {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable($_smarty_tpl->tpl_vars['COLUMNNAME_API']->value, null, 0);
                } else {
                    $_smarty_tpl->tpl_vars['columnNameApi'] = new Smarty_variable('getCustomViewColumnName', null, 0);
                }
                ?>
<option value="<?php 
                $_tmp1 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp1}();
                ?>
" data-fieldtype="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldType();
                ?>
" data-field-name="<?php 
                echo $_smarty_tpl->tpl_vars['FIELD_NAME']->value;
                ?>
"<?php 
                $_tmp2 = $_smarty_tpl->tpl_vars['columnNameApi']->value;
                if (decode_html($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->{$_tmp2}()) == $_smarty_tpl->tpl_vars['CONDITION_INFO']->value['columnname']) {
                    $_smarty_tpl->tpl_vars['FIELD_TYPE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType(), null, 0);
                    $_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value, null, 0);
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['value'] = decode_html($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['value']);
                    ?>
selected="selected"<?php 
                }
                if ($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name') == 'Events' && $_smarty_tpl->tpl_vars['FIELD_NAME']->value == 'recurringtype') {
                    $_smarty_tpl->tpl_vars['PICKLIST_VALUES'] = new Smarty_variable(Calendar_Field_Model::getReccurencePicklistValues(), null, 0);
                    $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
                    $_smarty_tpl->tpl_vars['FIELD_INFO']->value['picklistvalues'] = $_smarty_tpl->tpl_vars['PICKLIST_VALUES']->value;
                }
                ?>
data-fieldinfo='<?php 
                echo Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($_smarty_tpl->tpl_vars['FIELD_INFO']->value));
                ?>
' ><?php 
                if ($_smarty_tpl->tpl_vars['SELECTED_MODULE_NAME']->value != $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name')) {
                    ?>
(<?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                    ?>
)  <?php 
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['MODULE_MODEL']->value->get('name'));
                } else {
                    echo vtranslate($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('label'), $_smarty_tpl->tpl_vars['SELECTED_MODULE_NAME']->value);
                }
                ?>
</option><?php 
            }
            ?>
</optgroup><?php 
        }
        ?>
</select></span><span class="span3"><select class="<?php 
        if (empty($_smarty_tpl->tpl_vars['NOCHOSEN']->value)) {
            ?>
chzn-select<?php 
        }
        ?>
 row-fluid" name="comparator"><option value="none"><?php 
        echo vtranslate('LBL_NONE', $_smarty_tpl->tpl_vars['MODULE']->value);
        ?>
</option><?php 
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS'] = new Smarty_variable($_smarty_tpl->tpl_vars['ADVANCED_FILTER_OPTIONS_BY_TYPE']->value[$_smarty_tpl->tpl_vars['FIELD_TYPE']->value], null, 0);
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTIONS']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->key => $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value) {
            $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->_loop = true;
            ?>
<option value="<?php 
            echo $_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value;
            ?>
"<?php 
            if ($_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value == $_smarty_tpl->tpl_vars['CONDITION_INFO']->value['comparator']) {
                ?>
selected<?php 
            }
            ?>
><?php 
            echo vtranslate($_smarty_tpl->tpl_vars['ADVANCED_FILTER_OPTIONS']->value[$_smarty_tpl->tpl_vars['ADVANCE_FILTER_OPTION']->value]);
            ?>
</option><?php 
        }
        ?>
</select></span><span class="span4 fieldUiHolder"><input name="<?php 
        if ($_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL']->value) {
            echo $_smarty_tpl->tpl_vars['SELECTED_FIELD_MODEL']->value->get('name');
        }
        ?>
" data-value="value" class="row-fluid" type="text" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['CONDITION_INFO']->value['value'], ENT_QUOTES, 'UTF-8', true);
        ?>
" /></span><span class="hide"><!-- TODO : see if you need to respect CONDITION_INFO condition or / and  --><?php 
        if (empty($_smarty_tpl->tpl_vars['CONDITION']->value)) {
            $_smarty_tpl->tpl_vars['CONDITION'] = new Smarty_variable("and", null, 0);
        }
        ?>
<input type="hidden" name="column_condition" value="<?php 
        echo $_smarty_tpl->tpl_vars['CONDITION']->value;
        ?>
" /></span><span class="span1"><i class="deleteCondition icon-trash alignMiddle" title="<?php 
        echo vtranslate('LBL_DELETE', $_smarty_tpl->tpl_vars['MODULE']->value);
        ?>
"></i></span></div><?php 
    }
 function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $page = $request->get('page');
     $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', self::REPORT_LIMIT);
     $reportData = $reportModel->getReportData($pagingModel);
     $this->reportData = $reportData['data'];
     $this->calculationFields = $reportModel->getReportCalulationData();
     $count = $reportData['count'];
     if ($count < 1000) {
         $this->count = $count;
     } else {
         $query = $reportModel->getReportSQL(false, 'PDF');
         $countQuery = $reportModel->generateCountQuery($query);
         $this->count = $reportModel->getReportsCount($countQuery);
     }
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $detailViewLinks = $detailViewModel->getDetailViewLinks();
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     //TODO : We need to remove "update_log" field from "HelpDesk" module in New Look
     // after removing old look we need to remove this field from crm
     if ($primaryModule == 'HelpDesk') {
         foreach ($primaryModuleRecordStructure as $blockLabel => $blockFields) {
             foreach ($blockFields as $field => $object) {
                 if ($field == 'update_log') {
                     unset($primaryModuleRecordStructure[$blockLabel][$field]);
                 }
             }
         }
     }
     if (!empty($secondaryModuleRecordStructures)) {
         foreach ($secondaryModuleRecordStructures as $module => $structure) {
             if ($module == 'HelpDesk') {
                 foreach ($structure as $blockLabel => $blockFields) {
                     foreach ($blockFields as $field => $object) {
                         if ($field == 'update_log') {
                             unset($secondaryModuleRecordStructures[$module][$blockLabel][$field]);
                         }
                     }
                 }
             }
         }
     }
     // End
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter(false));
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('COUNT', $this->count);
     $viewer->assign('MODULE', $moduleName);
     // SalesPlatform.ru begin
     // If it is a custom report
     if (in_array($reportModel->getReportType(), getCustomReportsList())) {
         // Only equals filter
         $customAdvanceFilterOpsByFieldType = array('V' => array('e'), 'N' => array('e'), 'T' => array('e'), 'I' => array('e'), 'C' => array('e'), 'D' => array('e'), 'DT' => array('e'), 'I' => array('e'), 'NN' => array('e'), 'E' => array('e'));
         $spPaymentsRecordStructure = $recordStructureInstance->getStructure('SPPayments');
         foreach ($spPaymentsRecordStructure as $blockLabel => $blockFields) {
             foreach ($blockFields as $field => $object) {
                 if ($field != 'pay_date' && $field != 'assigned_user_id' && $field != 'payer') {
                     unset($spPaymentsRecordStructure[$blockLabel][$field]);
                 }
             }
         }
         $customBlockName = 'CUSTOM_BLOCK';
         $customRecordStructure[$customBlockName] = $spPaymentsRecordStructure['LBL_PAYMENT_DETAILS'];
         // Check date filter for custom report
         if (!in_array($reportModel->getReportType(), getCustomReportsListWithDateFilter())) {
             unset($customRecordStructure[$customBlockName]['pay_date']);
         }
         // Check owner filter for custom report
         if (!in_array($reportModel->getReportType(), getCustomReportsListWithOwnerFilter())) {
             unset($customRecordStructure[$customBlockName]['assigned_user_id']);
         }
         // Check account filter for custom report
         if (!in_array($reportModel->getReportType(), getCustomReportsListWithAccountFilter())) {
             unset($customRecordStructure[$customBlockName]['payer']);
         }
         $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $customRecordStructure);
         $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $customAdvanceFilterOpsByFieldType);
         $viewer->view('SPReportHeader.tpl', $moduleName);
     } else {
         $viewer->view('ReportHeader.tpl', $moduleName);
     }
     // SalesPlatform.ru end
 }