From: Eileen McNaughton Date: Wed, 29 Nov 2023 12:22:25 +0000 (+1300) Subject: Ensure onBehalfEmail always assigned to prevent notices X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=12ae289916fb9806c95cc7505e926feddfdf904d;p=civicrm-core.git Ensure onBehalfEmail always assigned to prevent notices --- diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 9dff9a2362..4a37189126 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -761,11 +761,13 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters($this->_params)); - if (!empty($this->_params['onbehalf_profile_id']) && !empty($this->_params['onbehalf'])) { + $isDisplayOnBehalf = !empty($this->_params['onbehalf_profile_id']) && !empty($this->_params['onbehalf']); + if ($isDisplayOnBehalf) { $this->assign('onBehalfName', $this->_params['organization_name']); $locTypeId = array_keys($this->_params['onbehalf_location']['email']); - $this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']); + $onBehalfEmail = $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email'] ?? NULL; } + $this->assign('onBehalfEmail', $onBehalfEmail ?? NULL); $this->assignPaymentFields(); $this->assignEmailField(); $this->assign('emailExists', $this->_emailExists);