From e7de412442a697fee88d2bb99fa859ec96dcb2b5 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 27 Nov 2020 20:16:32 +1300 Subject: [PATCH] Deprecate UFGroup::add parameter ids This is only passed in from one place. This PR removes it & adds noisy deprecation --- CRM/Core/BAO/UFGroup.php | 6 +++++- CRM/UF/Form/Group.php | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 988be26421..a79ee24ea5 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1425,12 +1425,16 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { * @param array $params * Reference array contains the values submitted by the form. * @param array $ids - * Reference array contains the id. + * Deprecated array. * * * @return object */ public static function add(&$params, $ids = []) { + if (empty($params['id']) && !empty($ids['ufgroup'])) { + $params['id'] = $ids['ufgroup']; + Civi::log()->warning('ids parameter is deprecated', ['civi.tag' => 'deprecated']); + } $fields = [ 'is_active', 'add_captcha', diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index 5a4d3dd570..c464d1a2f4 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -363,7 +363,6 @@ class CRM_UF_Form_Group extends CRM_Core_Form { } else { // get the submitted form values. - $ids = []; $params = $this->controller->exportValues($this->_name); if (!array_key_exists('is_active', $params)) { @@ -371,7 +370,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form { } if ($this->_action & (CRM_Core_Action::UPDATE)) { - $ids['ufgroup'] = $this->_id; + $params['id'] = $this->_id; // CRM-5284 // lets skip trying to mess around with profile weights and allow the user to do as needed. } @@ -382,7 +381,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form { } // create uf group - $ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids); + $ufGroup = CRM_Core_BAO_UFGroup::add($params); if (!empty($params['is_active'])) { //make entry in uf join table -- 2.25.1