From a5013c7cb472e2634d74ebae029edae0eec06506 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 21 Sep 2023 17:19:43 +1200 Subject: [PATCH] Always assign noCid when the tpl is included Fixes notices by moving the assign out of the function that adds the form elements This one only matters when smarty is in secure mode: --- CRM/Contribute/Form/Contribution/Main.php | 3 +-- CRM/Core/Form.php | 1 - CRM/Event/Form/Registration/Register.php | 5 +++-- templates/CRM/Member/Form/MembershipType.tpl | 1 - templates/CRM/common/cidzero.tpl | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 38f9126f70..0c4c36bef1 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -321,10 +321,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->addPaymentProcessorFieldsToForm(); $this->assign('is_pay_later', $this->getCurrentPaymentProcessor() === 0 && $this->_values['is_pay_later']); $this->assign('pay_later_text', $this->getCurrentPaymentProcessor() === 0 ? $this->getPayLaterLabel() : NULL); - + $this->assign('nocid', $contactID === 0); if ($contactID === 0) { $this->addCidZeroOptions(); - } //build pledge block. diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index d02840cd44..237c2af2dd 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -2614,7 +2614,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * and a dozen other small ones to be refactored into a shared parent with the reduction of much code duplication */ public function addCIDZeroOptions() { - $this->assign('nocid', TRUE); $profiles = []; if ($this->_values['custom_pre_id']) { $profiles[] = $this->_values['custom_pre_id']; diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 82321a0cde..1a3e3adc14 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -430,8 +430,9 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->addPaymentProcessorFieldsToForm(); } } - - if ($contactID === 0 && !$this->_values['event']['is_multiple_registrations']) { + $isSelectContactID = ($contactID === 0 && !$this->_values['event']['is_multiple_registrations']); + $this->assign('nocid', $isSelectContactID); + if ($isSelectContactID) { //@todo we are blocking for multiple registrations because we haven't tested $this->addCIDZeroOptions(); } diff --git a/templates/CRM/Member/Form/MembershipType.tpl b/templates/CRM/Member/Form/MembershipType.tpl index e6106b044f..78dd2adb48 100644 --- a/templates/CRM/Member/Form/MembershipType.tpl +++ b/templates/CRM/Member/Form/MembershipType.tpl @@ -106,7 +106,6 @@ {include file="CRM/common/customDataBlock.tpl"} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
{/if}
diff --git a/templates/CRM/common/cidzero.tpl b/templates/CRM/common/cidzero.tpl index 7e641a7fe9..eafe8c76fa 100644 --- a/templates/CRM/common/cidzero.tpl +++ b/templates/CRM/common/cidzero.tpl @@ -1,4 +1,4 @@ -{if !empty($nocid)} +{if $nocid}
{ts}You are completing this form on behalf of someone else. Please enter their details.{/ts} {if !empty($selectable)} -- 2.25.1