*/
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;
}
*/
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;
}
*/
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;
}