From: Coleman Watts Date: Thu, 20 Aug 2015 22:19:06 +0000 (-0400) Subject: CRM-17059 - Fix faulty relationship count in datatable X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2067937ed1b341826a4189ae7232ad990039683e;p=civicrm-core.git CRM-17059 - Fix faulty relationship count in datatable --- diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index dd1f1305f2..d7c3942918 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -1977,19 +1977,13 @@ AND cc.sort_name LIKE '%$name%'"; $contactRelationships = array(); $params['total'] = 0; if (!empty($relationships)) { - // get the total relationships - if ($params['context'] != 'user') { - $params['total'] = count($relationships); - } - else { - // FIX ME: we cannot directly determine total permissioned relationship, hence re-fire query - $permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], - $relationshipStatus, - 0, 0, 0, - NULL, NULL, TRUE - ); - $params['total'] = count($permissionedRelationships); - } + // FIXME: we cannot directly determine total permissioned relationship, hence re-fire query + $params['total'] = $permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], + $relationshipStatus, + 0, 1, 0, + NULL, NULL, + $permissionedContacts + ); // format params foreach ($relationships as $relationshipId => $values) {