Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated preferred_mail_format from more places... #23565

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CRM/Contact/DAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Contact/Contact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:67196fefde2ec151c97d463869102e21)
* (GenCodeChecksum:6c4b31481898fef1b087265d096c65f6)
*/

/**
Expand Down Expand Up @@ -960,10 +960,10 @@ public static function &fields() {
'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',
Expand Down
6 changes: 0 additions & 6 deletions CRM/Contact/Import/Parser/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -1040,12 +1040,6 @@ public function isErrorInCoreData($params, &$errorMessage) {
}
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) {
Expand Down
11 changes: 2 additions & 9 deletions CRM/Mailing/BAO/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1163,22 +1163,15 @@ public function compose(
}

$mailParams = $headers;
if ($text && ($test || $contact['preferred_mail_format'] == 'Text' ||
$contact['preferred_mail_format'] == 'Both' ||
($contact['preferred_mail_format'] == 'HTML' && !array_key_exists('html', $pEmails))
)
) {
if ($text) {
$textBody = implode('', $text);
if ($useSmarty) {
$textBody = $smarty->fetch("string:$textBody");
}
$mailParams['text'] = $textBody;
}

if ($html && ($test || ($contact['preferred_mail_format'] == 'HTML' ||
$contact['preferred_mail_format'] == 'Both'
))
) {
if ($html) {
$htmlBody = implode('', $html);
if ($useSmarty) {
$htmlBody = $smarty->fetch("string:$htmlBody");
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/CRM/Contact/SelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public function querySets() {
'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)',
Expand Down Expand Up @@ -736,7 +736,7 @@ public function getDefaultSelectString() {
. ' 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`,'
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/CRM/Dedupe/BAO/RuleGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public function getSupportedFields() {
'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',
Expand Down
142 changes: 68 additions & 74 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public function testExportComponentsMembership(): void {
'Image Url' => '',
'Preferred Communication Method' => '',
'Preferred Language' => 'en_US',
'Preferred Mail Format' => 'Both',
'Contact Hash' => '059023a02d27d4e7f285a40ee0e30be8',
'Contact Source' => '',
'First Name' => 'Anthony',
Expand Down Expand Up @@ -1114,7 +1113,6 @@ public function testMergeSameAddress(): void {
'Image Url' => '',
'Preferred Communication Method' => '',
'Preferred Language' => 'en_US',
'Preferred Mail Format' => 'Both',
'Contact Hash' => 'e9bd0913cc05cc5aeae69ba04ee3be84',
'Contact Source' => '',
'First Name' => 'Anthony',
Expand Down Expand Up @@ -1571,7 +1569,6 @@ protected function getBasicReturnProperties($isContactMode): array {
'image_URL' => 1,
'preferred_communication_method' => 1,
'preferred_language' => 1,
'preferred_mail_format' => 1,
'hash' => 1,
'contact_source' => 1,
'first_name' => 1,
Expand Down Expand Up @@ -2262,79 +2259,78 @@ protected function getBasicHeaderDefinition($isContactExport): array {
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;
}
Expand Down Expand Up @@ -2553,7 +2549,6 @@ protected function getBasicSqlColumnDefinition($isContactExport): array {
'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)',
Expand Down Expand Up @@ -2741,7 +2736,6 @@ public function getContributionSqlColumns(): array {
'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)',
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/api/v3/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,6 @@ public function testPseudoFields(): void {
$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']);
Expand Down
2 changes: 1 addition & 1 deletion xml/schema/Contact/Contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
<type>varchar</type>
<length>8</length>
<default>"Both"</default>
<import>true</import>
<import>false</import>
<headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
<comment>What is the preferred mode of sending an email.</comment>
<add>1.1</add>
Expand Down