/** * @see SugarController::loadBean() */ public function loadBean() { if (!empty($_REQUEST['record']) && $_REQUEST['action'] == 'ReportsWizard') { $_REQUEST['id'] = $this->record; $_REQUEST['page'] = 'report'; $this->view_object_map['action'] = 'ReportsWizard'; } else { if (empty($this->record) && !empty($_REQUEST['id'])) { $this->record = $_REQUEST['id']; $GLOBALS['action'] = 'detailview'; $this->view_object_map['action'] = 'ReportCriteriaResults'; } elseif (!empty($this->record)) { if ($_REQUEST['action'] == 'DetailView') { $_REQUEST['id'] = $this->record; unset($_REQUEST['record']); } else { $GLOBALS['action'] = 'detailview'; //bug 41860 } $_REQUEST['page'] = 'report'; $this->view_object_map['action'] = 'ReportCriteriaResults'; } } parent::loadBean(); }
public function testaction_save() { $SugarController = new SugarController(); $SugarController->setModule('Users'); $SugarController->loadBean(); //execute the method and check if it either works or throws an mysql exception. //Fail if it throws any other exception. try { $SugarController->action_save(); } catch (Exception $e) { $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); } $this->assertTrue(true); }