From c7dda6b1ff2f9602d767c74958d48dbf73fcdc4e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 24 May 2022 20:35:05 +1200 Subject: [PATCH] Remove deprecated preferred_mail_format from import m --- CRM/Contact/DAO/Contact.php | 6 +- CRM/Contact/Import/Parser/Contact.php | 6 - tests/phpunit/CRM/Contact/SelectorTest.php | 4 +- .../phpunit/CRM/Dedupe/BAO/RuleGroupTest.php | 1 - tests/phpunit/CRM/Export/BAO/ExportTest.php | 142 +++++++++--------- tests/phpunit/api/v3/ContactTest.php | 1 - xml/schema/Contact/Contact.xml | 2 +- 7 files changed, 74 insertions(+), 88 deletions(-) diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index 4a327bb4b0..790dce543b 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Contact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:67196fefde2ec151c97d463869102e21) + * (GenCodeChecksum:6c4b31481898fef1b087265d096c65f6) */ /** @@ -960,10 +960,10 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'description' => ts('What is the preferred mode of sending an email.'), 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, - 'import' => TRUE, + 'import' => FALSE, 'where' => 'civicrm_contact.preferred_mail_format', 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i', - 'export' => TRUE, + 'export' => FALSE, 'default' => 'Both', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 5813f6a8b4..1ccba83b15 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1040,12 +1040,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { } break; - case 'preferred_mail_format': - if (!array_key_exists(strtolower($value), array_change_key_case(CRM_Core_SelectValues::pmf(), CASE_LOWER))) { - $errors[] = ts('Preferred Mail Format'); - } - break; - case 'state_province': if (!empty($value)) { foreach ($value as $stateValue) { diff --git a/tests/phpunit/CRM/Contact/SelectorTest.php b/tests/phpunit/CRM/Contact/SelectorTest.php index ef8a994619..a89538d620 100644 --- a/tests/phpunit/CRM/Contact/SelectorTest.php +++ b/tests/phpunit/CRM/Contact/SelectorTest.php @@ -469,7 +469,7 @@ class CRM_Contact_SelectorTest extends CiviUnitTestCase { 'includeContactIds' => NULL, 'searchDescendentGroups' => FALSE, 'expected_query' => [ - 0 => 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, contact_a.do_not_email as `do_not_email`, contact_a.do_not_phone as `do_not_phone`, contact_a.do_not_mail as `do_not_mail`, contact_a.do_not_sms as `do_not_sms`, contact_a.do_not_trade as `do_not_trade`, contact_a.is_opt_out as `is_opt_out`, contact_a.legal_identifier as `legal_identifier`, contact_a.external_identifier as `external_identifier`, contact_a.nick_name as `nick_name`, contact_a.legal_name as `legal_name`, contact_a.image_URL as `image_URL`, contact_a.preferred_communication_method as `preferred_communication_method`, contact_a.preferred_language as `preferred_language`, contact_a.preferred_mail_format as `preferred_mail_format`, contact_a.first_name as `first_name`, contact_a.middle_name as `middle_name`, contact_a.last_name as `last_name`, contact_a.prefix_id as `prefix_id`, contact_a.suffix_id as `suffix_id`, contact_a.formal_title as `formal_title`, contact_a.communication_style_id as `communication_style_id`, contact_a.job_title as `job_title`, contact_a.gender_id as `gender_id`, contact_a.birth_date as `birth_date`, contact_a.is_deceased as `is_deceased`, contact_a.deceased_date as `deceased_date`, contact_a.household_name as `household_name`, IF ( contact_a.contact_type = \'Individual\', NULL, contact_a.organization_name ) as organization_name, contact_a.sic_code as `sic_code`, contact_a.is_deleted as `contact_is_deleted`, IF ( contact_a.contact_type = \'Individual\', contact_a.organization_name, NULL ) as current_employer, civicrm_address.id as address_id, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.supplemental_address_3 as `supplemental_address_3`, civicrm_address.city as `city`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.postal_code as `postal_code`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_address.state_province_id as state_province_id, civicrm_address.country_id as country_id, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_email.on_hold as `on_hold`, civicrm_im.id as im_id, civicrm_im.provider_id as provider_id, civicrm_im.name as `im`, civicrm_worldregion.id as worldregion_id, civicrm_worldregion.name as `world_region`', + 0 => 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, contact_a.do_not_email as `do_not_email`, contact_a.do_not_phone as `do_not_phone`, contact_a.do_not_mail as `do_not_mail`, contact_a.do_not_sms as `do_not_sms`, contact_a.do_not_trade as `do_not_trade`, contact_a.is_opt_out as `is_opt_out`, contact_a.legal_identifier as `legal_identifier`, contact_a.external_identifier as `external_identifier`, contact_a.nick_name as `nick_name`, contact_a.legal_name as `legal_name`, contact_a.image_URL as `image_URL`, contact_a.preferred_communication_method as `preferred_communication_method`, contact_a.preferred_language as `preferred_language`, contact_a.first_name as `first_name`, contact_a.middle_name as `middle_name`, contact_a.last_name as `last_name`, contact_a.prefix_id as `prefix_id`, contact_a.suffix_id as `suffix_id`, contact_a.formal_title as `formal_title`, contact_a.communication_style_id as `communication_style_id`, contact_a.job_title as `job_title`, contact_a.gender_id as `gender_id`, contact_a.birth_date as `birth_date`, contact_a.is_deceased as `is_deceased`, contact_a.deceased_date as `deceased_date`, contact_a.household_name as `household_name`, IF ( contact_a.contact_type = \'Individual\', NULL, contact_a.organization_name ) as organization_name, contact_a.sic_code as `sic_code`, contact_a.is_deleted as `contact_is_deleted`, IF ( contact_a.contact_type = \'Individual\', contact_a.organization_name, NULL ) as current_employer, civicrm_address.id as address_id, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.supplemental_address_3 as `supplemental_address_3`, civicrm_address.city as `city`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.postal_code as `postal_code`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_address.state_province_id as state_province_id, civicrm_address.country_id as country_id, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_email.on_hold as `on_hold`, civicrm_im.id as im_id, civicrm_im.provider_id as provider_id, civicrm_im.name as `im`, civicrm_worldregion.id as worldregion_id, civicrm_worldregion.name as `world_region`', 2 => 'WHERE displayRelType.relationship_type_id = 1 AND displayRelType.is_active = 1 AND ( 1 ) AND (contact_a.is_deleted = 0)', @@ -736,7 +736,7 @@ AND ( 1 ) AND (contact_a.is_deleted = 0)', . ' contact_a.do_not_sms as `do_not_sms`, contact_a.do_not_trade as `do_not_trade`, contact_a.is_opt_out as `is_opt_out`, contact_a.legal_identifier as `legal_identifier`,' . ' contact_a.external_identifier as `external_identifier`, contact_a.nick_name as `nick_name`, contact_a.legal_name as `legal_name`, contact_a.image_URL as `image_URL`,' . ' contact_a.preferred_communication_method as `preferred_communication_method`, contact_a.preferred_language as `preferred_language`,' - . ' contact_a.preferred_mail_format as `preferred_mail_format`, contact_a.first_name as `first_name`, contact_a.middle_name as `middle_name`, contact_a.last_name as `last_name`,' + . ' contact_a.first_name as `first_name`, contact_a.middle_name as `middle_name`, contact_a.last_name as `last_name`,' . ' contact_a.prefix_id as `prefix_id`, contact_a.suffix_id as `suffix_id`, contact_a.formal_title as `formal_title`, contact_a.communication_style_id as `communication_style_id`,' . ' contact_a.job_title as `job_title`, contact_a.gender_id as `gender_id`, contact_a.birth_date as `birth_date`, contact_a.is_deceased as `is_deceased`,' . ' contact_a.deceased_date as `deceased_date`, contact_a.household_name as `household_name`,' diff --git a/tests/phpunit/CRM/Dedupe/BAO/RuleGroupTest.php b/tests/phpunit/CRM/Dedupe/BAO/RuleGroupTest.php index ea36a16eb5..3c32268cea 100644 --- a/tests/phpunit/CRM/Dedupe/BAO/RuleGroupTest.php +++ b/tests/phpunit/CRM/Dedupe/BAO/RuleGroupTest.php @@ -158,7 +158,6 @@ class CRM_Dedupe_BAO_RuleGroupTest extends CiviUnitTestCase { 'postal_greeting_custom' => 'Postal Greeting Custom', 'preferred_communication_method' => 'Preferred Communication Method', 'preferred_language' => 'Preferred Language', - 'preferred_mail_format' => 'Preferred Mail Format', 'sic_code' => 'Sic Code', 'user_unique_id' => 'Unique ID (OpenID)', 'sort_name' => 'Sort Name', diff --git a/tests/phpunit/CRM/Export/BAO/ExportTest.php b/tests/phpunit/CRM/Export/BAO/ExportTest.php index 26b84bf2cc..887bc02ff1 100644 --- a/tests/phpunit/CRM/Export/BAO/ExportTest.php +++ b/tests/phpunit/CRM/Export/BAO/ExportTest.php @@ -236,7 +236,6 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'Image Url' => '', 'Preferred Communication Method' => '', 'Preferred Language' => 'en_US', - 'Preferred Mail Format' => 'Both', 'Contact Hash' => '059023a02d27d4e7f285a40ee0e30be8', 'Contact Source' => '', 'First Name' => 'Anthony', @@ -1114,7 +1113,6 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'Image Url' => '', 'Preferred Communication Method' => '', 'Preferred Language' => 'en_US', - 'Preferred Mail Format' => 'Both', 'Contact Hash' => 'e9bd0913cc05cc5aeae69ba04ee3be84', 'Contact Source' => '', 'First Name' => 'Anthony', @@ -1571,7 +1569,6 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'image_URL' => 1, 'preferred_communication_method' => 1, 'preferred_language' => 1, - 'preferred_mail_format' => 1, 'hash' => 1, 'contact_source' => 1, 'first_name' => 1, @@ -2262,79 +2259,78 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 15 => 'Image Url', 16 => 'Preferred Communication Method', 17 => 'Preferred Language', - 18 => 'Preferred Mail Format', - 19 => 'Contact Hash', - 20 => 'Contact Source', - 21 => 'First Name', - 22 => 'Middle Name', - 23 => 'Last Name', - 24 => 'Individual Prefix', - 25 => 'Individual Suffix', - 26 => 'Formal Title', - 27 => 'Communication Style', - 28 => 'Email Greeting ID', - 29 => 'Postal Greeting ID', - 30 => 'Addressee ID', - 31 => 'Job Title', - 32 => 'Gender', - 33 => 'Birth Date', - 34 => 'Deceased', - 35 => 'Deceased Date', - 36 => 'Household Name', - 37 => 'Organization Name', - 38 => 'Sic Code', - 39 => 'Unique ID (OpenID)', - 40 => 'Current Employer ID', - 41 => 'Contact is in Trash', - 42 => 'Created Date', - 43 => 'Modified Date', - 44 => 'Addressee', - 45 => 'Email Greeting', - 46 => 'Postal Greeting', - 47 => 'Current Employer', - 48 => 'Location Type', - 49 => 'Address ID', - 50 => 'Street Address', - 51 => 'Street Number', - 52 => 'Street Number Suffix', - 53 => 'Street Name', - 54 => 'Street Unit', - 55 => 'Supplemental Address 1', - 56 => 'Supplemental Address 2', - 57 => 'Supplemental Address 3', - 58 => 'City', - 59 => 'Postal Code Suffix', - 60 => 'Postal Code', - 61 => 'Latitude', - 62 => 'Longitude', - 63 => 'Is Manually Geocoded', - 64 => 'Address Name', - 65 => 'Master Address ID', - 66 => 'County', - 67 => 'State', - 68 => 'Country', - 69 => 'Phone', - 70 => 'Phone Extension', - 71 => 'Phone Type ID', - 72 => 'Phone Type', - 73 => 'Email', - 74 => 'On Hold', - 75 => 'Use for Bulk Mail', - 76 => 'Signature Text', - 77 => 'Signature Html', - 78 => 'IM Provider', - 79 => 'IM Screen Name', - 80 => 'OpenID', - 81 => 'World Region', - 82 => 'Website', - 83 => 'Group(s)', - 84 => 'Tag(s)', - 85 => 'Note(s)', + 18 => 'Contact Hash', + 19 => 'Contact Source', + 20 => 'First Name', + 21 => 'Middle Name', + 22 => 'Last Name', + 23 => 'Individual Prefix', + 24 => 'Individual Suffix', + 25 => 'Formal Title', + 26 => 'Communication Style', + 27 => 'Email Greeting ID', + 28 => 'Postal Greeting ID', + 29 => 'Addressee ID', + 30 => 'Job Title', + 31 => 'Gender', + 32 => 'Birth Date', + 33 => 'Deceased', + 34 => 'Deceased Date', + 35 => 'Household Name', + 36 => 'Organization Name', + 37 => 'Sic Code', + 38 => 'Unique ID (OpenID)', + 39 => 'Current Employer ID', + 40 => 'Contact is in Trash', + 41 => 'Created Date', + 42 => 'Modified Date', + 43 => 'Addressee', + 44 => 'Email Greeting', + 45 => 'Postal Greeting', + 46 => 'Current Employer', + 47 => 'Location Type', + 48 => 'Address ID', + 49 => 'Street Address', + 50 => 'Street Number', + 51 => 'Street Number Suffix', + 52 => 'Street Name', + 53 => 'Street Unit', + 54 => 'Supplemental Address 1', + 55 => 'Supplemental Address 2', + 56 => 'Supplemental Address 3', + 57 => 'City', + 58 => 'Postal Code Suffix', + 59 => 'Postal Code', + 60 => 'Latitude', + 61 => 'Longitude', + 62 => 'Is Manually Geocoded', + 63 => 'Address Name', + 64 => 'Master Address ID', + 65 => 'County', + 66 => 'State', + 67 => 'Country', + 68 => 'Phone', + 69 => 'Phone Extension', + 70 => 'Phone Type ID', + 71 => 'Phone Type', + 72 => 'Email', + 73 => 'On Hold', + 74 => 'Use for Bulk Mail', + 75 => 'Signature Text', + 76 => 'Signature Html', + 77 => 'IM Provider', + 78 => 'IM Screen Name', + 79 => 'OpenID', + 80 => 'World Region', + 81 => 'Website', + 82 => 'Group(s)', + 83 => 'Tag(s)', + 84 => 'Note(s)', ]; if (!$isContactExport) { + unset($headers[82]); unset($headers[83]); unset($headers[84]); - unset($headers[85]); } return $headers; } @@ -2553,7 +2549,6 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'image_url' => '`image_url` longtext', 'preferred_communication_method' => '`preferred_communication_method` varchar(255)', 'preferred_language' => '`preferred_language` varchar(5)', - 'preferred_mail_format' => '`preferred_mail_format` text(16)', 'hash' => '`hash` varchar(32)', 'contact_source' => '`contact_source` varchar(255)', 'first_name' => '`first_name` varchar(64)', @@ -2741,7 +2736,6 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'image_url' => '`image_url` longtext', 'preferred_communication_method' => '`preferred_communication_method` varchar(255)', 'preferred_language' => '`preferred_language` varchar(5)', - 'preferred_mail_format' => '`preferred_mail_format` text(16)', 'hash' => '`hash` varchar(32)', 'contact_source' => '`contact_source` varchar(255)', 'first_name' => '`first_name` varchar(64)', diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index ffaf9cb730..673527b70d 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -2347,7 +2347,6 @@ class api_v3_ContactTest extends CiviUnitTestCase { $contact = $this->callAPISuccess('contact', 'create', array_merge($this->_params, $params)); $result = $this->callAPISuccess('contact', 'getsingle', ['id' => $contact['id']]); - $this->assertEquals('Both', $result['preferred_mail_format']); $this->assertEquals('en_US', $result['preferred_language']); $this->assertEquals(1, $result['communication_style_id']); diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index 6ebb5f7df9..4b9c1019fd 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -331,7 +331,7 @@ varchar 8 "Both" - true + false /^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i What is the preferred mode of sending an email. 1.1 -- 2.25.1