From 2beb6e1e3495fd43d4c26037cb8a38936cfaed70 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 2 Dec 2024 11:38:17 +0100 Subject: [PATCH] FIX uniformize code --- htdocs/supplier_proposal/list.php | 40 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 6622a28fec3..d8bc7165389 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -65,8 +65,8 @@ $mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'intcomma'); $search_sale = GETPOST('search_sale', 'intcomma'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); -$search_societe = GETPOST('search_societe', 'alpha'); -$search_societe_alias = GETPOST('search_societe_alias', 'alpha'); +$search_company = GETPOST('search_company', 'alpha'); +$search_company_alias = GETPOST('search_company_alias', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); @@ -236,8 +236,8 @@ if (empty($reshook)) { $search_user = ''; $search_sale = ''; $search_ref = ''; - $search_societe = ''; - $search_societe_alias = ''; + $search_company = ''; + $search_company_alias = ''; $search_montant_ht = ''; $search_montant_vat = ''; $search_montant_ttc = ''; @@ -294,6 +294,14 @@ $formcompany = new FormCompany($db); $now = dol_now(); +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) { + $search_company = $soc->name; + } +} + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -362,14 +370,14 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { if ($search_ref) { $sql .= natural_search('sp.ref', $search_ref); } -if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) { - $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); +if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { + $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company); } else { - if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); + if ($search_company) { + $sql .= natural_search('s.nom', $search_company); } - if ($search_societe_alias) { - $sql .= natural_search('s.name_alias', $search_societe_alias); + if ($search_company_alias) { + $sql .= natural_search('s.name_alias', $search_company_alias); } } if ($search_login) { @@ -571,11 +579,11 @@ if ($resql) { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); + if ($search_company) { + $param .= '&search_company='.urlencode($search_company); } - if ($search_societe_alias) { - $param .= '&search_societe_alias='.urlencode($search_societe_alias); + if ($search_company_alias) { + $param .= '&search_company_alias='.urlencode($search_company_alias); } if ($search_user > 0) { $param .= '&search_user='.urlencode((string) ($search_user)); @@ -742,12 +750,12 @@ if ($resql) { } if (!empty($arrayfields['s.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; - print ''; + print ''; print ''; } if (!empty($arrayfields['s.town']['checked'])) {