diff --git a/CRM/Activity/StateMachine/Search.php b/CRM/Activity/StateMachine/Search.php index 56c408af1248..28a3c8815b01 100644 --- a/CRM/Activity/StateMachine/Search.php +++ b/CRM/Activity/StateMachine/Search.php @@ -35,16 +35,10 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) { $this->_pages = []; $this->_pages['CRM_Activity_Form_Search'] = NULL; - list($task, $result) = $this->taskName($controller, 'Search'); + list($task) = $this->taskName($controller, 'Search'); $this->_task = $task; - - if (is_array($task)) { - foreach ($task as $t) { - $this->_pages[$t] = NULL; - } - } - else { - $this->_pages[$task] = NULL; + foreach ($task as $t) { + $this->_pages[$t] = NULL; } $this->addSequentialPages($this->_pages, $action); @@ -63,7 +57,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) { * @return array * the name of the form that will handle the task */ - public function taskName($controller, $formName = 'Search') { + protected function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff $value = $_POST['task'] ?? NULL; if (!isset($value)) { diff --git a/CRM/Activity/Task.php b/CRM/Activity/Task.php index 94c1d62779ad..8620e23884dd 100644 --- a/CRM/Activity/Task.php +++ b/CRM/Activity/Task.php @@ -156,11 +156,10 @@ public static function getTask($value) { // make the print task by default $value = self::TASK_PRINT; } - - return [ - self::$_tasks[$value]['class'], - self::$_tasks[$value]['result'], - ]; + if (isset(self::$_tasks[$value])) { + return [self::$_tasks[$value]['class'], self::$_tasks[$value]['result']]; + } + return [[], NULL]; } }