From 90376ad6c7272e9e05b507452ea6c751f745d3fe Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 23 Oct 2021 16:14:45 +1300 Subject: [PATCH] Also move responsibility for NULLing custom to ensureGreetingParamsAreSet --- CRM/Contact/BAO/Contact.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 7caa6a718f..5114fe563a 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -541,6 +541,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Te // If we are setting it to null then null out the display field. $params[$greetingIndex . '_display'] = 'null'; } + if ((int) $params[$greetingParam] !== CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greetingParam, 'Customized')) { + $params[$greetingIndex . '_custom'] = 'null'; + } + } } @@ -2808,7 +2812,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $emailGreeting = CRM_Core_PseudoConstant::greeting($filter); $emailGreetingString = $emailGreeting[$contact->email_greeting_id]; - $updateQueryString[] = " email_greeting_custom = NULL "; } if ($emailGreetingString) { @@ -2832,7 +2835,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) ]; $postalGreeting = CRM_Core_PseudoConstant::greeting($filter); $postalGreetingString = $postalGreeting[$contact->postal_greeting_id]; - $updateQueryString[] = " postal_greeting_custom = NULL "; } if ($postalGreetingString) { @@ -2857,7 +2859,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $addressee = CRM_Core_PseudoConstant::greeting($filter); $addresseeString = $addressee[$contact->addressee_id]; - $updateQueryString[] = " addressee_custom = NULL "; } if ($addresseeString) { -- 2.25.1