From 92d6bfcf9aff8f8894834498f85f22259427a46f Mon Sep 17 00:00:00 2001 From: kurund Date: Wed, 4 Mar 2015 15:44:14 +0530 Subject: [PATCH] re-adding PR-5111 --- CRM/Mailing/BAO/Mailing.php | 3 ++- CRM/Mailing/Form/Group.php | 8 ++++---- CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl | 6 ++++++ xml/version.xml | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 09cfd0e076..1414f95f11 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1607,6 +1607,7 @@ ORDER BY civicrm_email.is_bulkmail DESC /* Create the mailing group record */ $mg = new CRM_Mailing_DAO_MailingGroup(); + $groupTypes = array('include' => 'Include', 'exclude' => 'Exclude', 'base' => 'Base'); foreach (array('groups', 'mailings') as $entity) { foreach (array('include', 'exclude', 'base') as $type) { if (isset($params[$entity]) && !empty($params[$entity][$type]) && @@ -1616,7 +1617,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $mg->mailing_id = $mailing->id; $mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName; $mg->entity_id = $entityId; - $mg->group_type = $type; + $mg->group_type = $groupTypes[$type]; $mg->save(); } } diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index 45e83e6573..0eabfee791 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -143,12 +143,12 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { $mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id; } - $defaults['includeGroups'] = CRM_Utils_Array::value('include', $mailingGroups['civicrm_group']); - $defaults['excludeGroups'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_group']); + $defaults['includeGroups'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_group']); + $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']); if (!empty($mailingGroups['civicrm_mailing'])) { - $defaults['includeMailings'] = CRM_Utils_Array::value('include', $mailingGroups['civicrm_mailing']); - $defaults['excludeMailings'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_mailing']); + $defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']); + $defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_mailing']); } } diff --git a/CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl new file mode 100644 index 0000000000..3becf6350c --- /dev/null +++ b/CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl @@ -0,0 +1,6 @@ +{* file to handle db changes in 4.5.7 during upgrade *} + +-- CRM-15931 +UPDATE civicrm_mailing_group SET group_type = 'Include' WHERE group_type = 'include'; +UPDATE civicrm_mailing_group SET group_type = 'Exclude' WHERE group_type = 'exclude'; +UPDATE civicrm_mailing_group SET group_type = 'Base' WHERE group_type = 'base'; diff --git a/xml/version.xml b/xml/version.xml index 87514d7e01..421c80e7bc 100644 --- a/xml/version.xml +++ b/xml/version.xml @@ -1,4 +1,4 @@ - 4.5.6 + 4.5.7 -- 2.25.1