Php 8.x notice fix on tags & groups fields
authoreileen <emcnaughton@wikimedia.org>
Fri, 2 Feb 2024 05:40:06 +0000 (18:40 +1300)
committereileen <emcnaughton@wikimedia.org>
Sat, 3 Feb 2024 21:37:15 +0000 (10:37 +1300)
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Edit/TagsAndGroups.php
CRM/Profile/Form.php

index 8c9106715c11c44e304c5ffabd80f2080c086c90..a7d93bc07106dc72798b793e6478ceb3797f557f 100644 (file)
@@ -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.
index 4beab414fdc62e6f3408b83a7bcc2a028d646542..edc67ce6241312051567853fb7fd99bb12a9ef25 100644 (file)
@@ -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];
       }
index e9c8e4f80b45ea15765506d3734aeb18d63f3ba2..9fcb0ed8a335ea44c29abe27d0d972af161a4bbe 100644 (file)
@@ -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;