From b6e8d5d2fbbb0786e74477b73413bf6b544283d8 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 24 Nov 2023 15:02:37 +1300 Subject: [PATCH] Add some assigns to prevent notices on Confirm --- CRM/Contribute/Form/Contribution/Confirm.php | 12 +++++++++++ .../Form/Contribution/ConfirmTest.php | 20 ++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index eff96666f8..a9c8078c4c 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -446,6 +446,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $params = $this->processPcp($this, $this->_params); $this->_params = $params; } + else { + $this->assign('pcpBlock'); + } $this->_params['invoiceID'] = $this->get('invoiceID'); //carry campaign from profile. @@ -482,6 +485,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($this->_values['honoree_profile_id']); $this->buildCustom($this->_values['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes); } + else { + $this->assign('honoreeProfileFields'); + } $this->assign('receiptFromEmail', $this->_values['receipt_from_email'] ?? NULL); $this->assign('amount_block_is_active', $this->isFormSupportsNonMembershipContributions()); $this->assign('taxTerm', \Civi::settings()->get('tax_term')); @@ -508,6 +514,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->set('productID', $productID); $this->set('option', $option); } + else { + $this->assign('products'); + } if (CRM_Core_Component::isEnabled('CiviMember') && empty($this->_ccid)) { if (isset($params['selectMembership']) && $params['selectMembership'] !== 'no_thanks' @@ -547,6 +556,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->buildCustom($this->_values['onbehalf_profile_id'], 'onbehalfProfile', TRUE, 'onbehalf', $fieldTypes); } + else { + $this->assign('onbehalfProfile'); + } $this->_separateMembershipPayment = $this->isSeparateMembershipPayment(); $this->assign('is_separate_payment', $this->isSeparateMembershipPayment()); diff --git a/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php b/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php index 461163b46d..e1d689f428 100644 --- a/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php +++ b/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php @@ -211,15 +211,17 @@ class CRM_Contribute_Form_Contribution_ConfirmTest extends CiviUnitTestCase { $this->assertTrue($assignedVariables['is_separate_payment']); // Two emails were sent - check both. The first is a contribution // online receipt & the second is the membership online receipt. - $this->assertMailSentContainingStrings([ - 'Contribution Information', - ' - Amount - - $352.00 - ', - '************1111', - ]); + $this->assertMailSentContainingStrings( + [ + 'Contribution Information', + ' + Amount + + $352.00 + ', + '************1111', + ], + ); $this->assertMailSentContainingStrings([ 'Membership Information', 'Membership Type -- 2.25.1