From f782a4e93156e156b8d69f812a2a741e52baef71 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 28 Jul 2023 14:03:38 +1200 Subject: [PATCH] dev/core#4453 fix clash over 'name' field on contribution page form --- CRM/Contribute/Form/ContributionPage.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 6af8a60bf9..f09086dfd0 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -260,8 +260,10 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { $this->set('values', $this->_values); } $defaults = $this->_values; + // These fields are not exposed on the form and 'name' is exposed on amount, with a different meaning. + // see https://lab.civicrm.org/dev/core/-/issues/4453. + unset($defaults['name'], $defaults['created_id'], $defaults['created_date']); - $config = CRM_Core_Config::singleton(); if (isset($this->_id)) { //set defaults for pledgeBlock values. @@ -285,7 +287,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { ]; foreach ($pledgeBlock as $key) { $defaults[$key] = $pledgeBlockDefaults[$key] ?? NULL; - if ($key == 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) { + if ($key === 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) { $defaultPledgeDate = (array) json_decode($pledgeBlockDefaults['pledge_start_date']); $pledgeDateFields = [ 'pledge_calendar_date' => 'calendar_date', -- 2.25.1