CRM-15107 - Update group count label and fix sorting
authorColeman Watts <coleman@civicrm.org>
Fri, 15 Aug 2014 13:54:26 +0000 (14:54 +0100)
committerColeman Watts <coleman@civicrm.org>
Fri, 15 Aug 2014 14:31:12 +0000 (15:31 +0100)
CRM/Contact/BAO/Group.php
CRM/Group/Page/AJAX.php
templates/CRM/Group/Form/Search.tpl

index 411c4003df338c379c5cb31e1f69f1d1b8e266be..75332c0c9f005378d8afa7311ff08f5a25deaa50 100644 (file)
@@ -750,7 +750,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
     if (!empty($groups)) {
       foreach ($groups as $id => $value) {
         $groupList[$id]['group_id'] = $value['id'];
-        $groupList[$id]['members'] = $value['members'];
+        $groupList[$id]['count'] = $value['count'];
         $groupList[$id]['group_name'] = $value['title'];
 
         // append parent names if in search mode
@@ -831,12 +831,12 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
     }
 
     $query = "
-        SELECT groups.*, createdBy.sort_name as created_by, IF(groups.saved_search_id, COUNT(smart_members.id), COUNT(members.id)) as members {$select}
+        SELECT groups.*, createdBy.sort_name as created_by, IF(groups.saved_search_id, COUNT(smart_contacts.id), COUNT(contacts.id)) as `count` {$select}
         FROM  civicrm_group groups
-        LEFT JOIN civicrm_group_contact members
-          ON members.group_id = groups.id AND members.status = 'Added'
-        LEFT JOIN civicrm_group_contact_cache smart_members
-          ON smart_members.group_id = groups.id
+        LEFT JOIN civicrm_group_contact contacts
+          ON contacts.group_id = groups.id AND contacts.status = 'Added'
+        LEFT JOIN civicrm_group_contact_cache smart_contacts
+          ON smart_contacts.group_id = groups.id
         LEFT JOIN civicrm_contact createdBy
           ON createdBy.id = groups.created_id
         {$from}
@@ -917,7 +917,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
 
         $values[$object->id]['visibility'] = $visibility[$values[$object->id]['visibility']];
 
-        $values[$object->id]['members'] = $object->members;
+        $values[$object->id]['count'] = $object->count;
 
         if (isset($values[$object->id]['group_type'])) {
           $groupTypes = explode(CRM_Core_DAO::VALUE_SEPARATOR,
index b34b0f3838b99067a0b643dfeb8ed1fa8490fd56..cffa28a9ef9248aebb7ee4f6f408c33c03bd8293 100644 (file)
@@ -50,7 +50,7 @@ class CRM_Group_Page_AJAX {
     }
     else {
       $sortMapper = array(
-        0 => 'groups.title', 1 => 'groups.id', 2 => 'createdBy.sort_name', 3 => '',
+        0 => 'groups.title', 1 => 'count', 2 => 'createdBy.sort_name', 3 => '',
         4 => 'groups.group_type', 5 => 'groups.visibility',
       );
 
@@ -84,7 +84,7 @@ class CRM_Group_Page_AJAX {
 
       $iFilteredTotal = $iTotal = $params['total'];
       $selectorElements = array(
-        'group_name', 'members', 'created_by', 'group_description',
+        'group_name', 'count', 'created_by', 'group_description',
         'group_type', 'visibility', 'org_info', 'links', 'class',
       );
 
index 7d12d8d2752d4684ebf7176d46f752e94b1e1fdf..60a6e70c6733cb5ddcad30cb06fd28118c191fce 100644 (file)
@@ -71,7 +71,7 @@
   <thead>
     <tr>
       <th class='crm-group-name'>{ts}Name{/ts}</th>
-      <th class='crm-group-members'>{ts}Members{/ts}</th>
+      <th class='crm-group-count'>{ts}Count{/ts}</th>
       <th class='crm-group-created_by'>{ts}Created By{/ts}</th>
       <th class='crm-group-description'>{ts}Description{/ts}</th>
       <th class='crm-group-group_type'>{ts}Group Type{/ts}</th>
@@ -137,7 +137,7 @@ CRM.$(function($) {
         "aaSorting"  : [],
         "aoColumns"  : [
                         {sClass:'crm-group-name'},
-                        {sClass:'crm-group-members'},
+                        {sClass:'crm-group-count'},
                         {sClass:'crm-group-created_by'},
                         {sClass:'crm-group-description', bSortable:false},
                         {sClass:'crm-group-group_type'},
@@ -290,7 +290,7 @@ CRM.$(function($) {
               else {
                 appendHTML += '<td class="crm-group-name ' + levelClass + '"><span class="crm-no-children"></span><span class="crm-editable crmf-title">' + val.group_name + '</span></td>';
               }
-              appendHTML += "<td>" + val.members + "</td>";
+              appendHTML += "<td>" + val.count + "</td>";
               appendHTML += "<td>" + val.created_by + "</td>";
               appendHTML += '<td><span class="crm-editable crmf-description" data-type="textarea">' + (val.group_description || '') + "</span></td>";
               appendHTML += "<td>" + val.group_type + "</td>";