From: Jon Goldberg Date: Mon, 7 Jan 2019 00:08:47 +0000 (-0500) Subject: avoid deprecated function; fix bug in buildOptions; fix display of no links X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=887688b99c8ddb6e6044aee1898b282e2c34929a;p=civicrm-core.git avoid deprecated function; fix bug in buildOptions; fix display of no links --- diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 201454fc9e..5e84ab8f4b 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -871,7 +871,7 @@ SELECT g.* } if ($allGroups == NULL) { - $allGroups = CRM_Core_PseudoConstant::allGroup(); + $allGroups = CRM_Contact_BAO_Contact::buildOptions('group_id', NULL, ['onlyActive' => FALSE]); } $acls = CRM_ACL_BAO_Cache::build($contactID); diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 00dead650a..031bf1513f 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -966,18 +966,20 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } $values[$object->id]['group_type'] = implode(', ', $types); } - $values[$object->id]['action'] = CRM_Core_Action::formLink($newLinks, - $action, - array( - 'id' => $object->id, - 'ssid' => $object->saved_search_id, - ), - ts('more'), - FALSE, - 'group.selector.row', - 'Group', - $object->id - ); + if ($action) { + $values[$object->id]['action'] = CRM_Core_Action::formLink($newLinks, + $action, + array( + 'id' => $object->id, + 'ssid' => $object->saved_search_id, + ), + ts('more'), + FALSE, + 'group.selector.row', + 'Group', + $object->id + ); + } // If group has children, add class for link to view children $values[$object->id]['is_parent'] = FALSE; diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 20290e2c69..9bb1dc439a 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -787,9 +787,8 @@ AND contact_id IN ( $contactStr ) * @return array|bool */ public static function buildOptions($fieldName, $context = NULL, $props = array()) { - $params = array(); - $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context); + $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $props, $context); // Sort group list by hierarchy // TODO: This will only work when api.entity is "group_contact". What about others? diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 0760680792..fb59a3c5f8 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -499,7 +499,7 @@ class CRM_Core_PseudoConstant { } /** - * DEPRECATED generic populate method. + * @deprecated generic populate method. * All pseudoconstant functions that use this method are also @deprecated * * The static array $var is populated from the db