public function beforeGetTaskform($viewer)
 {
     $fields = $this->get('fields');
     if (empty($fields) || $fields == -1) {
         $fields = array();
     }
     $viewer->assign("StaticFieldsField", 'fields');
     $viewer->assign("fields", $fields);
     $viewer->assign("fromFields", $this->getFromFields());
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     $views = array();
     $allviews = \CustomView_Record_Model::getAll($parts[0]);
     foreach ($allviews as $view) {
         $views[$view->get('cvid')] = $view->get('viewname');
     }
     $viewer->assign('customviews', $views);
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
         $viewer->assign("target_module_name", $parts[0]);
     }
 }
 public function beforeGetTaskform($viewer)
 {
     global $adb, $current_language, $mod_strings;
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
         $search_module_name = VtUtils::getModuleName($parts[1]);
         #$workflowSettings = $this->getWorkflow()->getSettings();
         $workflows = $workflows = Workflow2::getWorkflowsForModule($search_module_name, 1);
         $viewer->assign("workflows", $workflows);
         $fields = VtUtils::getFieldsWithBlocksForModule($search_module_name);
         $viewer->assign("sort_fields", $fields);
         $moduleObj = \Vtiger_Module_Model::getInstance($search_module_name);
         $viewer->assign('productCache', array());
         if ($moduleObj instanceof \Inventory_Module_Model) {
             $viewer->assign('searchByProduct', true);
             $product = $this->get('products');
             if (!empty($product)) {
                 //$dataObj = \Vtiger_Record_Model::getInstanceById($product);
                 $productCache[$product] = array('label' => \Vtiger_Functions::getCRMRecordLabel($product));
                 $viewer->assign('productCache', $productCache);
             }
         }
         $views = array();
         $allviews = \CustomView_Record_Model::getAll($search_module_name);
         foreach ($allviews as $view) {
             $views[$view->get('cvid')] = $view->get('viewname');
         }
         $viewer->assign('customviews', $views);
     }
 }