From 2e877aeb2d66d10117a8e19969ce0e5b75fd4f54 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 22 Dec 2023 12:27:49 +1300 Subject: [PATCH] Remove checks to bltID in cms classes --- CRM/Utils/System/DrupalBase.php | 8 ++++---- CRM/Utils/System/Joomla.php | 8 ++++---- CRM/Utils/System/WordPress.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index f32c33a009..b989061eb3 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -792,15 +792,15 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { */ public function getEmailFieldName(CRM_Core_Form $form, array $fields):string { $emailName = ''; - - if (!empty($form->_bltID) && array_key_exists("email-{$form->_bltID}", $fields)) { + $billingLocationTypeID = CRM_Core_BAO_LocationType::getBilling(); + if (array_key_exists("email-{$billingLocationTypeID}", $fields)) { // this is a transaction related page - $emailName = 'email-' . $form->_bltID; + $emailName = 'email-' . $billingLocationTypeID; } else { // find the email field in a profile page foreach ($fields as $name => $dontCare) { - if (substr($name, 0, 5) == 'email') { + if (str_starts_with($name, 'email')) { $emailName = $name; break; } diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index d118206b93..ba32ca6b80 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -114,15 +114,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { */ public function getEmailFieldName(CRM_Core_Form $form, array $fields):string { $emailName = ''; - - if (!empty($form->_bltID) && array_key_exists("email-{$form->_bltID}", $fields)) { + $billingLocationTypeID = CRM_Core_BAO_LocationType::getBilling(); + if (array_key_exists("email-{$billingLocationTypeID}", $fields)) { // this is a transaction related page - $emailName = 'email-' . $form->_bltID; + $emailName = 'email-' . $billingLocationTypeID; } else { // find the email field in a profile page foreach ($fields as $name => $dontCare) { - if (substr($name, 0, 5) == 'email') { + if (str_starts_with($name, 'email')) { $emailName = $name; break; } diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 55cb29f4dc..65e55e0d5c 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -963,15 +963,15 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { */ public function getEmailFieldName(CRM_Core_Form $form, array $fields):string { $emailName = ''; - - if (!empty($form->_bltID) && array_key_exists("email-{$form->_bltID}", $fields)) { + $billingLocationTypeID = CRM_Core_BAO_LocationType::getBilling(); + if (array_key_exists("email-{$billingLocationTypeID}", $fields)) { // this is a transaction related page - $emailName = 'email-' . $form->_bltID; + $emailName = 'email-' . $billingLocationTypeID; } else { // find the email field in a profile page foreach ($fields as $name => $dontCare) { - if (substr($name, 0, 5) == 'email') { + if (str_starts_with($name, 'email')) { $emailName = $name; break; } -- 2.25.1