CRM-14997 - fix regression that caused Add Contacts to Group button to be ALWAYS...
authorDave Greenberg <dave@civicrm.org>
Mon, 28 Jul 2014 23:02:22 +0000 (16:02 -0700)
committerDave Greenberg <dave@civicrm.org>
Mon, 28 Jul 2014 23:02:22 +0000 (16:02 -0700)
----------------------------------------
* CRM-14997:
  https://issues.civicrm.org/jira/browse/CRM-14997

CRM/Contact/Form/Search.php

index adb3c512ef2a038e6c5f32afeacdcebe24db6d9b..8522181ce3a212bebf80c8dd5f31f755798679d0 100644 (file)
@@ -418,10 +418,9 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
         $url = CRM_Utils_System::makeURL('qfKey') . $formQFKey;
         CRM_Utils_System::redirect($url);
       }
+      $permissionForGroup = FALSE;
 
       if (!empty($this->_groupID)) {
-        $permissionForGroup = FALSE;
-
         // check if user has permission to edit members of this group
         $permission = CRM_Contact_BAO_Group::checkPermission($this->_groupID);
         if ($permission && in_array(CRM_Core_Permission::EDIT, $permission)) {
@@ -431,13 +430,10 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
         // check if _groupID exists, it might not if
         // we are displaying a hidden group
         if (!isset($this->_group[$this->_groupID])) {
-          $permissionForGroup = FALSE;
           $this->_group[$this->_groupID] =
             CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'title');
         }
 
-        $this->assign('permissionedForGroup', $permissionForGroup);
-
         // set the group title
         $groupValues = array('id' => $this->_groupID, 'title' => $this->_group[$this->_groupID]);
         $this->assign_by_ref('group', $groupValues);
@@ -467,7 +463,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
         'group_contact_status', ts('Group Status')
       );
 
-      $this->assign('permissionedForGroup', FALSE);
+      $this->assign('permissionedForGroup', $permissionForGroup);
     }
 
     // add the go button for the action form, note it is of type 'next' rather than of type 'submit'