From 7ab339e97f4034f6696ba0e18f25920b6193c6f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 17:52:34 +0100 Subject: [PATCH 1/6] Fix regression --- htdocs/comm/propal/class/propal.class.php | 2 -- htdocs/contact/list.php | 2 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/societe/list.php | 6 +++--- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 39c01663d93ad..868a16ed304a6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -409,8 +409,6 @@ class Propal extends CommonObject */ public function __construct($db, $socid = 0, $propalid = 0) { - global $conf, $langs; - $this->db = $db; $this->socid = $socid; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 96e5814074239..8501ef2616500 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -101,7 +101,7 @@ $search_categ = GETPOSTINT("search_categ"); $search_categ_thirdparty = GETPOSTINT("search_categ_thirdparty"); $search_categ_supplier = GETPOSTINT("search_categ_supplier"); -$search_status = GETPOSTINT("search_status"); +$search_status = GETPOST("search_status", "intcomma"); $search_type = GETPOST('search_type', 'alpha'); $search_address = GETPOST('search_address', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 7c7fc412669c4..7caa6533194f8 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -998,7 +998,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); - $search_status = GETPOSTINT("search_status"); + $search_status = GETPOST("search_status", "intcomma"); if ($search_status == '') { $search_status = 1; // always display active customer first } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index ca5bcb5fdedc9..787cc14f77987 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -52,7 +52,7 @@ $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("sref", "alpha") ? GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha"); $search_label = GETPOST("snom", "alpha") ? GETPOST("snom", "alpha") : GETPOST("search_label", "alpha"); -$search_status = GETPOSTINT("search_status"); +$search_status = GETPOST("search_status", "intcomma"); $search_category_list = array(); if (isModEnabled('category')) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 19e620f7b8a3b..099106056b869 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -120,7 +120,7 @@ $search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); $search_price_level = GETPOSTINT('search_price_level'); $search_staff = GETPOSTINT("search_staff"); -$search_status = GETPOSTINT("search_status"); +$search_status = GETPOST("search_status", 'intcomma'); $search_type = GETPOST('search_type', 'alpha'); $search_level = GETPOST("search_level", "array:alpha"); $search_stcomm = GETPOST('search_stcomm', "array:int"); @@ -472,8 +472,8 @@ } } -if ($search_status == '') { - $search_status = 1; // always display active thirdparty first +if ($search_status == '' && empty($search_all)) { + $search_status = 1; // display active thirdparty only by default } From 4ca754205c008003805d4a35154abc25829c21cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 19:37:00 +0100 Subject: [PATCH 2/6] Fix serch_all --- htdocs/societe/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 099106056b869..c0baeb41882a8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -446,6 +446,8 @@ $search_level = ''; $search_parent_name = ''; $search_import_key = ''; + + $search_all = ''; $toselect = array(); $search_array_options = array(); } From 4f5c400870d0d0ecf39d908dc91c418ac3f8212a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 19:39:33 +0100 Subject: [PATCH 3/6] Fix missing search_all --- htdocs/modulebuilder/template/myobject_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 476a429d97278..d1bde9d79c58d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -249,6 +249,7 @@ $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } From a9cae438a60586b9a880f4b3964aa0f4c128701e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 19:43:57 +0100 Subject: [PATCH 4/6] Fix regression --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 28af89a6246d0..f2668099f9fd7 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; -$type = GETPOSTINT("type"); +$type = GETPOST("type", 'intcomma'); if ($type == '' && !$user->hasRight('produit', 'lire') && $user->hasRight('service', 'lire')) { $type = '1'; // Force global page on service page only } From 65899433fe1cd4e74e187e4ea90af90d030caff7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 19:47:05 +0100 Subject: [PATCH 5/6] Qual: remove $_GET use. --- htdocs/product/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f2668099f9fd7..9abf9bd532689 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -69,15 +69,15 @@ $transAreaType = $langs->trans("ProductsAndServicesArea"); $helpurl = ''; -if (!isset($_GET["type"])) { +if (!GETPOSTISSET("type")) { $transAreaType = $langs->trans("ProductsAndServicesArea"); $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } -if ((isset($_GET["type"]) && $_GET["type"] == 0) || !isModEnabled("service")) { +if ((GETPOSTISSET("type") && GETPOST("type") == '0') || !isModEnabled("service")) { $transAreaType = $langs->trans("ProductsArea"); $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } -if ((isset($_GET["type"]) && $_GET["type"] == 1) || !isModEnabled("product")) { +if ((GETPOSTISSET("type") && GETPOST("type") == '1') || !isModEnabled("product")) { $transAreaType = $langs->trans("ServicesArea"); $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } @@ -310,10 +310,10 @@ if ($num > 0) { $transRecordedType = $langs->trans("LastModifiedProductsAndServices", $max); - if (isset($_GET["type"]) && $_GET["type"] == 0) { + if (GETPOSTISSET("type") && GETPOST("type") == '0') { $transRecordedType = $langs->trans("LastRecordedProducts", $max); } - if (isset($_GET["type"]) && $_GET["type"] == 1) { + if (GETPOSTISSET("type") && GETPOST("type") == '1') { $transRecordedType = $langs->trans("LastRecordedServices", $max); } From 9a281ed2647544824699a4f3ef03b53c6168b418 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 21:21:27 +0100 Subject: [PATCH 6/6] Fix undefined property --- htdocs/adherents/class/api_members.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 000ecc26f2b07..889f1212547cb 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -432,7 +432,12 @@ public function delete($id) private function _validate($data) { $member = array(); - foreach (Members::$FIELDS as $field) { + + $mandatoryfields = array( + 'morphy', + 'typeid' + ); + foreach ($mandatoryfields as $field) { if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); } @@ -857,7 +862,10 @@ public function deleteType($id) private function _validateType($data) { $membertype = array(); - foreach (MembersTypes::$FIELDS as $field) { + + $mandatoryfields = array('label'); + + foreach ($mandatoryfields as $field) { if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); }