Esempio n. 1
0
 public function testGetMassUpdateForm()
 {
     global $current_user, $timedate;
     $expected_dateformat = $timedate->get_cal_date_format();
     $_REQUEST['module'] = 'Calls';
     $mass = new MassUpdate();
     $call = new Call();
     $call->fieldDefs['date_start']['massupdate'] = true;
     $mass->setSugarBean($call);
     $form_results = $mass->getMassUpdateForm();
     $found_match = false;
     if (preg_match('/daFormat\\s+?\\:\\s+\\"(.*?)\\"/', $form_results, $matches)) {
         $this->assertEquals($expected_dateformat, $matches[1], 'Assert that the daFormat set in Calendar widget is %Y/%m/%d');
         $found_match = true;
     }
     $this->assertEquals($found_match, true, 'Assert that the daFormat value was set');
 }
Esempio n. 2
0
 function processListView($seed, $xTemplateSection, $html_varName)
 {
     global $sugar_config;
     $populateOnly = $this->ignorePopulateOnly ? FALSE : !empty($sugar_config['save_query']) && $sugar_config['save_query'] == 'populate_only';
     if (isset($seed->module_dir) && $populateOnly) {
         if (empty($GLOBALS['displayListView']) && strcmp(strtolower($_REQUEST['action']), 'popup') != 0 && (!empty($_REQUEST['clear_query']) || $_REQUEST['module'] == $seed->module_dir && ((empty($_REQUEST['query']) || $_REQUEST['query'] == 'MSI') && (empty($_SESSION['last_search_mod']) || $_SESSION['last_search_mod'] != $seed->module_dir)))) {
             $_SESSION['last_search_mod'] = $_REQUEST['module'];
             return;
         }
     }
     if (strcmp(strtolower($_REQUEST['action']), 'popup') != 0) {
         $_SESSION['last_search_mod'] = $_REQUEST['module'];
     }
     //following session variable will track the detail view nvigation history.
     //needs to the reset after each search.
     $this->setLocalSessionVariable($html_varName, "DETAIL_NAV_HISTORY", false);
     require_once 'include/MassUpdate.php';
     $mass = new MassUpdate();
     $add_acl_javascript = false;
     if (!isset($_REQUEST['action'])) {
         $this->shouldProcess = false;
     } else {
         $this->shouldProcess = is_subclass_of($seed, "SugarBean") && ($_REQUEST['action'] == 'index' || 'ListView' == substr($_REQUEST['action'], 0, 8)) && $_REQUEST['module'] == $seed->module_dir;
     }
     //when processing a multi-select popup.
     if ($this->process_for_popups && $this->multi_select_popup) {
         $this->shouldProcess = true;
     }
     //mass update turned off?
     if (!$this->show_mass_update) {
         $this->shouldProcess = false;
     }
     if (is_subclass_of($seed, "SugarBean")) {
         if ($seed->bean_implements('ACL')) {
             if (!ACLController::checkAccess($seed->module_dir, 'list', true)) {
                 if ($_REQUEST['module'] != 'Home') {
                     ACLController::displayNoAccess();
                 }
                 return;
             }
             if (!ACLController::checkAccess($seed->module_dir, 'export', true)) {
                 $sugar_config['disable_export'] = true;
             }
         }
     }
     //force mass update form if requested.
     if ($this->force_mass_update) {
         $this->shouldProcess = true;
     }
     if ($this->shouldProcess) {
         echo $mass->getDisplayMassUpdateForm(true, $this->multi_select_popup);
         echo $mass->getMassUpdateFormHeader($this->multi_select_popup);
         $mass->setSugarBean($seed);
         //C.L. Fix for 10048, do not process handleMassUpdate for multi select popups
         if (!$this->multi_select_popup) {
             $mass->handleMassUpdate();
         }
     }
     $this->processListViewTwo($seed, $xTemplateSection, $html_varName);
     if ($this->shouldProcess && empty($this->process_for_popups)) {
         //echo "<a href='javascript:sListView.clear_all(document.MassUpdate, \"mass[]\");'>".translate('LBL_CLEARALL')."</a>";
         // cn: preserves current functionality, exception is InboundEmail
         if ($this->show_mass_update_form) {
             echo $mass->getMassUpdateForm();
         }
         if (!$this->keep_mass_update_form_open) {
             echo $mass->endMassUpdateForm();
         }
     }
 }