From 3e3079caa25dad7ebd467786a6a4e829c73cf1d6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 23 Oct 2021 15:47:17 +1300 Subject: [PATCH] Remove unnecessary code This function is called from 2 places Contact::create Contact::updateGreetingsOnTokenFieldChange In both cases the contact has already been saved (to the extent that is relevant for the operation). The latter operation will not change the selected options - it will only potentially change tokens within it. In the former case the nulling will already have taken place if needed ie if there is no id entity for the relevant greeing ensureGreetingParamsAreSet will already have set it to 'null' before the save - leading to it already being updated to NULL --- CRM/Contact/BAO/Contact.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index ab2850c07b..7caa6a718f 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2810,11 +2810,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $emailGreetingString = $emailGreeting[$contact->email_greeting_id]; $updateQueryString[] = " email_greeting_custom = NULL "; } - else { - if ($contact->email_greeting_custom) { - $updateQueryString[] = " email_greeting_display = NULL "; - } - } if ($emailGreetingString) { CRM_Contact_BAO_Contact_Utils::processGreetingTemplate($emailGreetingString, @@ -2839,11 +2834,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $postalGreetingString = $postalGreeting[$contact->postal_greeting_id]; $updateQueryString[] = " postal_greeting_custom = NULL "; } - else { - if ($contact->postal_greeting_custom) { - $updateQueryString[] = " postal_greeting_display = NULL "; - } - } if ($postalGreetingString) { CRM_Contact_BAO_Contact_Utils::processGreetingTemplate($postalGreetingString, @@ -2869,11 +2859,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $addresseeString = $addressee[$contact->addressee_id]; $updateQueryString[] = " addressee_custom = NULL "; } - else { - if ($contact->addressee_custom) { - $updateQueryString[] = " addressee_display = NULL "; - } - } if ($addresseeString) { CRM_Contact_BAO_Contact_Utils::processGreetingTemplate($addresseeString, -- 2.25.1