CRM-15931 - civicrm_mailing_group.group_type - Read & write capitalized type
authorTim Otten <totten@civicrm.org>
Sat, 7 Feb 2015 13:42:41 +0000 (05:42 -0800)
committerTim Otten <totten@civicrm.org>
Sat, 7 Feb 2015 13:42:41 +0000 (05:42 -0800)
CRM/Mailing/BAO/Mailing.php
js/angular-crmMailing/services.js

index def033c0343fd4060582acaac8706683cbd99f69..1d762bb07dc2f16dc96da32509eea2572583af20 100644 (file)
@@ -1680,10 +1680,11 @@ 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][$type])) {
-          self::replaceGroups($mailing->id, $type, $entity, $params[$entity][$type]);
+          self::replaceGroups($mailing->id, $groupTypes[$type], $entity, $params[$entity][$type]);
         }
       }
     }
index c33a120ea2c0bfdcb1b3ee2dd890d74f4b6b1663..889da1c55f9f566db26078c9957207bc7dc8d0d2 100644 (file)
             _.each(groupResult.values, function (mailingGroup) {
               var bucket = (/^civicrm_group/.test(mailingGroup.entity_table)) ? 'groups' : 'mailings';
               var entityId = parseInt(mailingGroup.entity_id);
-              mailing[bucket][mailingGroup.group_type].push(entityId);
+              mailing[bucket][mailingGroup.group_type.toLowerCase()].push(entityId);
             });
           });
       },