From bac32f4bba8869d5b77ad39fd373de167598e98d Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 15 Feb 2023 08:43:58 -0700 Subject: [PATCH] Addressbook: Fix required customfields were still required on advanced search dialog's "Extra private" tab --- addressbook/inc/class.addressbook_ui.inc.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index a434f700f0..908ffd282c 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -3433,13 +3433,24 @@ class addressbook_ui extends addressbook_bo { foreach($this->customfields as $name => $data) { - if (substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1)) + if(substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1)) { - if (!isset($content['#'.$name])) $content['#'.$name] = ''; - if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one'); + if(!isset($content['#' . $name])) + { + $content['#' . $name] = ''; + } + if(!isset($data['values'][''])) + { + $sel_options['#' . $name][''] = lang('Select one'); + } } // Make them not required, otherwise you can't search $this->tmpl->setElementAttribute('#' . $name, 'required', FALSE); + if($this->config['private_cf_tab'] == 'True' && $data['private']) + { + // Private CF tab results in a different ID, turn required off there too + $this->tmpl->setElementAttribute('private_cfs[#' . $name . ']', 'required', FALSE); + } } } // configure edit template as search dialog