From 3065b9ca6ade988e8d7a8a8550415c0abb56b9cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Apr 2023 19:30:34 +0200 Subject: [PATCH] Clean code --- htdocs/categories/viewcat.php | 6 +- htdocs/comm/propal/card.php | 6 +- htdocs/comm/propal/stats/index.php | 2 +- htdocs/commande/card.php | 6 +- htdocs/commande/stats/index.php | 1 + htdocs/compta/deplacement/stats/index.php | 3 +- htdocs/compta/facture/card.php | 6 +- htdocs/compta/facture/stats/index.php | 16 +- htdocs/compta/stats/cabyprodserv.php | 7 +- .../stats/supplier_turnover_by_prodserv.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/contrat/card.php | 3 +- htdocs/core/ajax/ajaxcompanies.php | 135 ------------ htdocs/core/class/html.form.class.php | 122 ++++++----- htdocs/core/lib/functions.lib.php | 4 +- htdocs/don/card.php | 3 +- htdocs/fourn/commande/card.php | 9 +- htdocs/fourn/facture/card.php | 3 +- htdocs/margin/customerMargins.php | 3 +- htdocs/product/fournisseurs.php | 3 +- htdocs/product/price.php | 3 +- htdocs/product/stock/replenish.php | 3 +- htdocs/projet/card.php | 14 +- htdocs/societe/ajax/ajaxcompanies.php | 202 ++++++++++-------- htdocs/societe/ajax/company.php | 17 +- htdocs/societe/card.php | 7 +- htdocs/supplier_proposal/card.php | 6 +- htdocs/takepos/admin/terminal.php | 3 +- 28 files changed, 251 insertions(+), 346 deletions(-) delete mode 100644 htdocs/core/ajax/ajaxcompanies.php diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5999865232a..84770acdaff 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -590,7 +590,8 @@ if ($type == Categorie::TYPE_CUSTOMER) { print ''; print ''; print ''; print '
'; print $langs->trans("AddCustomerIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.client IN (1,3)'); + $filter = 's.client IN (1,3)'; + print $form->select_company('', 'elemid', $filter); print '
'; @@ -670,7 +671,8 @@ if ($type == Categorie::TYPE_SUPPLIER) { print ''; print ''; print ''; print '
'; print $langs->trans("AddSupplierIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.fournisseur = 1'); + $filter ='s.fournisseur = 1'; + print $form->select_company('', 'elemid', $filter); print '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3a3fdfe50a0..d28753632d2 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1810,7 +1810,8 @@ if ($action == 'create') { //$warehouse_id = $soc->warehouse_id; } else { print ''; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + $filter = '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer informations if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { print '