From 2851f8bc5c26021b253e728d049f453daeb68f4a Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 10 Feb 2023 13:17:51 +1300 Subject: [PATCH] Enotice fix, pledge block on UserDashboard --- CRM/Pledge/Page/UserDashboard.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/CRM/Pledge/Page/UserDashboard.php b/CRM/Pledge/Page/UserDashboard.php index a30b8bcf9c..0c8b74375d 100644 --- a/CRM/Pledge/Page/UserDashboard.php +++ b/CRM/Pledge/Page/UserDashboard.php @@ -19,7 +19,7 @@ class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard /** * called when action is browse. */ - public function listPledges() { + public function listPledges(): void { $controller = new CRM_Core_Controller_Simple( 'CRM_Pledge_Form_Search', ts('Pledges'), @@ -35,25 +35,20 @@ class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard $controller->process(); $controller->run(); - // add honor block. - $honorParams = []; + // Add honor block. $honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId); - if (!empty($honorParams)) { - // assign vars to templates - $this->assign('pledgeHonorRows', $honorParams); - $this->assign('pledgeHonor', TRUE); - } - $session = CRM_Core_Session::singleton(); - $loggedUserID = $session->get('userID'); - $this->assign('loggedUserID', $loggedUserID); + $this->assign('pledgeHonorRows', $honorParams); + $this->assign('pledgeHonor', !empty($honorParams)); + $this->assign('loggedUserID', CRM_Core_Session::getLoggedInContactID()); } /** - * the main function that is called when the page - * loads, it decides the which action has to be taken for the page. + * The main function that is called when the page loads. + * + * @throws \CRM_Core_Exception */ - public function run() { - parent::preProcess(); + public function run(): void { + $this->preProcess(); $this->listPledges(); } -- 2.25.1