From 92268069538db90f35f0a4e8a96aba64bb91d210 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 18 Oct 2016 15:16:11 +0530 Subject: [PATCH] CRM-19529 - PHP7-Upcoming/Recent Case Activities results into 'Network Error' --- CRM/Case/Page/CaseDetails.php | 2 +- CRM/Case/Page/Tab.php | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/CRM/Case/Page/CaseDetails.php b/CRM/Case/Page/CaseDetails.php index ea2e349f68..06c42ebc9e 100644 --- a/CRM/Case/Page/CaseDetails.php +++ b/CRM/Case/Page/CaseDetails.php @@ -50,7 +50,7 @@ class CRM_Case_Page_CaseDetails extends CRM_Core_Page { $caseId = CRM_Utils_Request::retrieve('caseId', 'Positive', $this); - CRM_Case_Page_Tab::setContext(); + CRM_Case_Page_Tab::setContext($this); $this->assign('caseID', $caseId); $this->assign('contactID', $this->_contactId); diff --git a/CRM/Case/Page/Tab.php b/CRM/Case/Page/Tab.php index 9ad7e348a9..97d819e12a 100644 --- a/CRM/Case/Page/Tab.php +++ b/CRM/Case/Page/Tab.php @@ -191,7 +191,7 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { $this->assign('action', $this->_action); - $this->setContext(); + self::setContext($this); if ($this->_action & CRM_Core_Action::VIEW) { $this->view(); @@ -241,11 +241,15 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { return self::$_links; } - public function setContext() { - $context = $this->get('context'); + /** + * @param CRM_Core_Form $form + */ + public static function setContext(&$form) { + $context = $form->get('context'); + CRM_Core_Error::Debug("context", $context); $url = NULL; - $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this); + $qfKey = CRM_Utils_Request::retrieve('key', 'String', $form); //validate the qfKey if (!CRM_Utils_Rule::qfKey($qfKey)) { $qfKey = NULL; @@ -253,9 +257,9 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { switch ($context) { case 'activity': - if ($this->_contactId) { + if ($form->_contactId) { $url = CRM_Utils_System::url('civicrm/contact/view', - "reset=1&force=1&cid={$this->_contactId}&selectedChild=activity" + "reset=1&force=1&cid={$form->_contactId}&selectedChild=activity" ); } break; @@ -281,12 +285,12 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { break; case 'fulltext': - $action = CRM_Utils_Request::retrieve('action', 'String', $this); + $action = CRM_Utils_Request::retrieve('action', 'String', $form); $urlParams = 'force=1'; $urlString = 'civicrm/contact/search/custom'; if ($action == CRM_Core_Action::RENEW) { - if ($this->_contactId) { - $urlParams .= '&cid=' . $this->_contactId; + if ($form->_contactId) { + $urlParams .= '&cid=' . $form->_contactId; } $urlParams .= '&context=fulltext&action=view'; $urlString = 'civicrm/contact/view/case'; @@ -298,9 +302,9 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { break; default: - if ($this->_contactId) { + if ($form->_contactId) { $url = CRM_Utils_System::url('civicrm/contact/view', - "reset=1&force=1&cid={$this->_contactId}&selectedChild=case" + "reset=1&force=1&cid={$form->_contactId}&selectedChild=case" ); } break; -- 2.25.1