From 7d1ce072a0ce99e9fd382ee64233b4811ac0474c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 15 Aug 2014 14:54:26 +0100 Subject: [PATCH] CRM-15107 - Update group count label and fix sorting --- CRM/Contact/BAO/Group.php | 14 +++++++------- CRM/Group/Page/AJAX.php | 4 ++-- templates/CRM/Group/Form/Search.tpl | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 411c4003df..75332c0c9f 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -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, diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index b34b0f3838..cffa28a9ef 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -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', ); diff --git a/templates/CRM/Group/Form/Search.tpl b/templates/CRM/Group/Form/Search.tpl index 7d12d8d275..60a6e70c67 100644 --- a/templates/CRM/Group/Form/Search.tpl +++ b/templates/CRM/Group/Form/Search.tpl @@ -71,7 +71,7 @@ {ts}Name{/ts} - {ts}Members{/ts} + {ts}Count{/ts} {ts}Created By{/ts} {ts}Description{/ts} {ts}Group Type{/ts} @@ -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 += '' + val.group_name + ''; } - appendHTML += "" + val.members + ""; + appendHTML += "" + val.count + ""; appendHTML += "" + val.created_by + ""; appendHTML += '' + (val.group_description || '') + ""; appendHTML += "" + val.group_type + ""; -- 2.25.1