From 1983c09ba453e197304e1fbf7ba13c9f4c79b2d5 Mon Sep 17 00:00:00 2001 From: Alex BORDARAUD <100122553+elfibro@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:54:36 +0200 Subject: [PATCH] Update list.php (#30254) * Update list.php Added condition to include client code in the search when the global variable SOCIETE_ADD_REF_IN_LIST is set to 1. - Modified the SQL query to include 's.code_client' in the search conditions. - Added check for the global variable SOCIETE_ADD_REF_IN_LIST. - If SOCIETE_ADD_REF_IN_LIST is 1, 's.code_client' is included in the search along with 's.nom' and 's.name_alias'. - Ensured that 's.code_client' is searched separately only when SOCIETE_ADD_REF_IN_LIST is 1 and 'search_societe' is not defined. * Update list.php * Update list.php * Update list.php Refactor: Replace conf->global->SOCIETE_ADD_REF_IN_LIST with getDolGlobalString('SOCIETE_ADD_REF_IN_LIST') * Update list.php Simplified SOCIETE_ADD_REF_IN_LIST retrieval Replaced conditional retrieval with getDolGlobalInt('SOCIETE_ADD_REF_IN_LIST') to simplify code and pass tests. --- htdocs/comm/propal/list.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dbc4b286027e6..629c00ef799a7 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -635,16 +635,29 @@ if ($search_availability) { $sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')'; } +$societe_add_ref_in_list = getDolGlobalInt('SOCIETE_ADD_REF_IN_LIST'); if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) { - $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); + if ($societe_add_ref_in_list == 1) { + $sql .= natural_search(array("s.nom", "s.name_alias", "s.code_client"), $search_societe); + } else { + $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); + } } else { if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); + if ($societe_add_ref_in_list == 1) { + $sql .= natural_search(array('s.nom', 's.code_client'), $search_societe); + } else { + $sql .= natural_search('s.nom', $search_societe); + } } if ($search_societe_alias) { $sql .= natural_search('s.name_alias', $search_societe_alias); } } +// Rechercher dans code_client si SOCIETE_ADD_REF_IN_LIST est égal à 1 +if ($societe_add_ref_in_list == 1 && $search_code_client && !$search_societe) { + $sql .= natural_search('s.code_client', $search_code_client); +} if ($search_login) { $sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login); }