CRM-17059 - Fix faulty relationship count in datatable
authorColeman Watts <coleman@civicrm.org>
Thu, 20 Aug 2015 22:19:06 +0000 (18:19 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 20 Aug 2015 22:19:06 +0000 (18:19 -0400)
CRM/Contact/BAO/Relationship.php

index dd1f1305f2b1c765816b3aa92cb64657c6eb02e1..d7c39429186128414d4dfbfb74682eb46f839b2f 100644 (file)
@@ -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) {