From 69c02708d004d33cb37c2d2fa496dfa7a4928266 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 2 Feb 2024 18:40:06 +1300 Subject: [PATCH] Php 8.x notice fix on tags & groups fields --- CRM/Contact/Form/Contact.php | 2 +- CRM/Contact/Form/Edit/TagsAndGroups.php | 5 ++++- CRM/Profile/Form.php | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index 8c9106715c..a7d93bc071 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -840,7 +840,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } // build tags and groups - CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($this, 0, CRM_Contact_Form_Edit_TagsAndGroups::ALL, + CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($this, $this->getContactID(), CRM_Contact_Form_Edit_TagsAndGroups::ALL, FALSE, NULL, 'Group(s)', 'Tag(s)', NULL, 'select'); // build location blocks. diff --git a/CRM/Contact/Form/Edit/TagsAndGroups.php b/CRM/Contact/Form/Edit/TagsAndGroups.php index 4beab414fd..edc67ce624 100644 --- a/CRM/Contact/Form/Edit/TagsAndGroups.php +++ b/CRM/Contact/Form/Edit/TagsAndGroups.php @@ -63,6 +63,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups { $form->addOptionalQuickFormElement('group'); // NYSS 5670 if (!$contactId && !empty($form->_contactId)) { + CRM_Core_Error::deprecatedWarning('this is thought to be unreachable, should be passed in'); $contactId = $form->_contactId; } @@ -73,8 +74,10 @@ class CRM_Contact_Form_Edit_TagsAndGroups { if ($fieldName) { $fName = $fieldName; } + // The optional url parameter grid is refers to Group ID. + // If it set the group options on the page are limited to that group + $groupID = is_numeric(CRM_Utils_Request::retrieve('grid', 'Integer', $form)) ? (int) CRM_Utils_Request::retrieve('grid', 'Integer', $form) : NULL; - $groupID = $form->_grid ?? NULL; if ($groupID && $visibility) { $ids = [$groupID => $groupID]; } diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index e9c8e4f80b..9fcb0ed8a3 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -58,6 +58,9 @@ class CRM_Profile_Form extends CRM_Core_Form { * The group id that we are passing in url. * * @var int + * + * @deprecated + * @internal */ public $_grid; -- 2.25.1