From: Eileen McNaughton Date: Thu, 21 Dec 2023 23:27:49 +0000 (+1300) Subject: Remove checks to bltID in cms classes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2e877aeb2d66d10117a8e19969ce0e5b75fd4f54;p=civicrm-core.git Remove checks to bltID in cms classes --- 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; }