From 848669747c21b186efcb88e5d722de99820c4c04 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 11 Apr 2023 10:55:07 +1200 Subject: [PATCH] Remove almost all remaining handling for preferred_mail_format This just mops up the handling, with the exception of the UFGroup function that renders the profile (buildProfile) as we maybe need an upgrade script for that? --- CRM/Contact/BAO/Contact.php | 5 ----- CRM/Contact/BAO/Query.php | 1 - CRM/Export/BAO/ExportProcessor.php | 12 +----------- CRM/Mailing/BAO/Mailing.php | 2 +- CRM/Utils/Address.php | 2 -- 5 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index c9c9dc964c..c47485d1a4 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2544,11 +2544,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $values['preferred_communication_method'] = $preffComm; $values['preferred_communication_method_display'] = $temp['preferred_communication_method_display'] ?? NULL; - if ($contact->preferred_mail_format) { - $preferredMailingFormat = CRM_Core_SelectValues::pmf(); - $values['preferred_mail_format'] = $preferredMailingFormat[$contact->preferred_mail_format]; - } - $values['preferred_language'] = empty($contact->preferred_language) ? NULL : CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $contact->preferred_language); // Calculating Year difference diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 2049f18d73..d6c875142a 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4467,7 +4467,6 @@ civicrm_relationship.start_date > {$today} 'contact_sub_type' => 1, 'sort_name' => 1, 'display_name' => 1, - 'preferred_mail_format' => 1, 'nick_name' => 1, 'first_name' => 1, 'middle_name' => 1, diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 97bdcc708c..0811d5674b 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -1147,7 +1147,6 @@ class CRM_Export_BAO_ExportProcessor { case 'gender': case 'preferred_communication_method': - case 'preferred_mail_format': case 'communication_style': return $i18n->crm_translate($fieldValue); @@ -1463,16 +1462,7 @@ class CRM_Export_BAO_ExportProcessor { case CRM_Utils_Type::T_STRING: if (isset($fieldSpec['maxlength'])) { - // A localized string for the preferred_mail_format does not fit - // into the varchar(8) field. - // @see https://lab.civicrm.org/dev/core/-/issues/2645 - switch ($fieldName) { - case 'preferred_mail_format': - return "`$fieldName` text(16)"; - - default: - return "`$fieldName` varchar({$fieldSpec['maxlength']})"; - } + return "`$fieldName` varchar({$fieldSpec['maxlength']})"; } $dataType = $fieldSpec['data_type'] ?? ''; // set the sql columns for custom data diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 5967419e09..81024cb27b 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -2468,7 +2468,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id } $returnProperties = []; - $returnProperties['display_name'] = $returnProperties['contact_id'] = $returnProperties['preferred_mail_format'] = $returnProperties['hash'] = 1; + $returnProperties['display_name'] = $returnProperties['contact_id'] = $returnProperties['hash'] = 1; foreach ($properties as $p) { $returnProperties[$p] = 1; diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index f50ea79949..5436f0534d 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -136,7 +136,6 @@ class CRM_Utils_Address { 'contact.birth_date' => $fields['birth_date'] ?? NULL, 'contact.gender' => $fields['gender'] ?? NULL, 'contact.is_opt_out' => $fields['is_opt_out'] ?? NULL, - 'contact.preferred_mail_format' => $fields['preferred_mail_format'] ?? NULL, 'contact.phone' => $fields['phone'] ?? NULL, 'contact.home_URL' => $fields['home_URL'] ?? NULL, 'contact.contact_source' => $fields['contact_source'] ?? NULL, @@ -377,7 +376,6 @@ class CRM_Utils_Address { 'contact.birth_date' => $fields['birth_date'] ?? NULL, 'contact.gender' => $fields['gender'] ?? NULL, 'contact.is_opt_out' => $fields['is_opt_out'] ?? NULL, - 'contact.preferred_mail_format' => $fields['preferred_mail_format'] ?? NULL, 'contact.phone' => $fields['phone'] ?? NULL, 'contact.home_URL' => $fields['home_URL'] ?? NULL, 'contact.contact_source' => $fields['contact_source'] ?? NULL, -- 2.25.1