Merge pull request #6553 from sudhabisht/C12658
[civicrm-core.git] / CRM / Mailing / Form / Group.php
index 9909ad72865536c0cf5fed5cb045fa9bc4517d85..dcca8afc628cb1b941050c7f877170465f823089 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
 
   /**
-   * The mailing ID of the mailing if we are resuming a mailing
+   * The mailing ID of the mailing if we are resuming a mailing.
    *
    * @var integer
    */
   protected $_mailingID;
 
   /**
-   * Set variables up before form is built
+   * Set variables up before form is built.
    *
    * @return void
    */
@@ -145,12 +145,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']);
       }
     }
 
@@ -183,7 +183,7 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    * @return void
    */
@@ -238,13 +238,13 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
 
     //when the context is search add base group's.
     if ($this->_searchBasedMailing) {
-      //get the static groups
-      $staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
+      //CRM-16600 Include Smart Groups in Unsubscribe list as that matches
+      //all other practices in CiviMail
       $this->add('select', 'baseGroup',
         ts('Unsubscription Group'),
         array(
           '' => ts('- select -'),
-        ) + CRM_Contact_BAO_Group::getGroupsHierarchy($staticGroups, NULL, '&nbsp;&nbsp;', TRUE),
+        ) + $groups,
         TRUE,
         array('class' => 'crm-select2 huge')
       );
@@ -483,8 +483,6 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
     CRM_Mailing_BAO_Mailing::getRecipients(
       $mailing->id,
       $mailing->id,
-      NULL,
-      NULL,
       TRUE,
       $dedupeEmail
     );
@@ -541,7 +539,7 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Display Name of the form
+   * Display Name of the form.
    *
    *
    * @return string
@@ -551,7 +549,7 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Global validation rules for the form
+   * Global validation rules for the form.
    *
    * @param array $fields
    *   Posted values of the form.