re-adding PR-5111
authorkurund <kurund@civicrm.org>
Wed, 4 Mar 2015 10:14:14 +0000 (15:44 +0530)
committerkurund <kurund@civicrm.org>
Wed, 4 Mar 2015 10:14:14 +0000 (15:44 +0530)
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/Form/Group.php
CRM/Upgrade/Incremental/sql/4.5.7.mysql.tpl [new file with mode: 0644]
xml/version.xml

index 09cfd0e076146caa55a99159f2483d60037127eb..1414f95f11a900e063bb9cfa83e16dafd86ec28f 100644 (file)
@@ -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();
           }
         }
index 45e83e6573725a4ab4440a01531fb2ff5e457da8..0eabfee791fd2ed0633e225d1ce822cfd35a7886 100644 (file)
@@ -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 (file)
index 0000000..3becf63
--- /dev/null
@@ -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';
index 87514d7e01df7e504e358c92dcd4638fef513974..421c80e7bcb2a16270f20da1596e54c6a6507e5b 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>4.5.6</version_no>
+  <version_no>4.5.7</version_no>
 </version>