Ejemplo n.º 1
0
 public static function deleteMap($request)
 {
     $moduleName = $request->getModule();
     $mapId = $request->get('mapid');
     if (!empty($mapId)) {
         Import_Map_Model::markAsDeleted($mapId);
     }
     $viewer = new Vtiger_Viewer();
     $viewer->assign('FOR_MODULE', $moduleName);
     $viewer->assign('MODULE', 'Import');
     $viewer->assign('SAVED_MAPS', Import_Map_Model::getAllByModule($moduleName));
     $viewer->view('Import_Saved_Maps.tpl', 'Import');
 }
Ejemplo n.º 2
0
 function uploadAndParse(Vtiger_Request $request)
 {
     if (Import_Utils_Helper::validateFileUpload($request)) {
         $moduleName = $request->getModule();
         $user = Users_Record_Model::getCurrentUserModel();
         $fileReader = Import_Utils_Helper::getFileReader($request, $user);
         if ($fileReader == null) {
             $request->set('error_message', vtranslate('LBL_INVALID_FILE', 'Import'));
             $this->importBasicStep($request);
             exit;
         }
         $hasHeader = $fileReader->hasHeader();
         $rowData = $fileReader->getFirstRowData($hasHeader);
         $viewer = $this->getViewer($request);
         $autoMerge = $request->get('auto_merge');
         if (!$autoMerge) {
             $request->set('merge_type', 0);
             $request->set('merge_fields', '');
         } else {
             $viewer->assign('MERGE_FIELDS', Zend_Json::encode($request->get('merge_fields')));
         }
         $moduleName = $request->getModule();
         $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
         $moduleMeta = $moduleModel->getModuleMeta();
         $viewer->assign('DATE_FORMAT', $user->date_format);
         $viewer->assign('FOR_MODULE', $moduleName);
         $viewer->assign('MODULE', 'Import');
         $viewer->assign('HAS_HEADER', $hasHeader);
         $viewer->assign('ROW_1_DATA', $rowData);
         $viewer->assign('USER_INPUT', $request);
         $viewer->assign('AVAILABLE_FIELDS', $moduleMeta->getImportableFields($moduleName));
         $viewer->assign('ENCODED_MANDATORY_FIELDS', Zend_Json::encode($moduleMeta->getMandatoryFields($moduleName)));
         $viewer->assign('SAVED_MAPS', Import_Map_Model::getAllByModule($moduleName));
         $viewer->assign('USERS_LIST', Import_Utils_Helper::getAssignedToUserList($moduleName));
         $viewer->assign('GROUPS_LIST', Import_Utils_Helper::getAssignedToGroupList($moduleName));
         return $viewer->view('ImportAdvanced.tpl', 'Import');
     } else {
         $this->importBasicStep($request);
     }
 }