From 0d01c3658f689b04edb6d4b4a70de23939b2671f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 12 Sep 2023 11:18:18 +1200 Subject: [PATCH] Fix use of undefined context property on pledge form --- CRM/Pledge/Form/Pledge.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index 27f45ca53a..abac2e8a5c 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -63,20 +63,19 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * @throws \CRM_Core_Exception */ public function preProcess(): void { - $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this); + $this->_contactID = $this->getContactID(); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add' ); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); - + $this->setContext(); // check for action permissions. if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) { CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.')); } $this->assign('action', $this->_action); - $this->assign('context', $this->_context); + $this->assign('context', $this->getContext()); if ($this->_action & CRM_Core_Action::DELETE) { return; } @@ -563,7 +562,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { CRM_Core_Session::setStatus($statusMsg, ts('Payment Due'), 'info'); $buttonName = $this->controller->getButtonName(); - if ($this->_context === 'standalone') { + if ($this->getContext() === 'standalone') { if ($buttonName === $this->getButtonName('upload', 'new')) { $session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/add', 'reset=1&action=add&context=standalone' -- 2.25.1