From 9ec41c1a449e2d5b92c3f63880be94453c86f584 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Oct 2022 08:34:23 +0200 Subject: [PATCH 1/2] FIX avoid error, fetch of product is mandatory (by id or by ref) --- htdocs/product/stats/facture.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index c62c421d6e4..9b3ee0ad5e4 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -200,12 +200,12 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + // Fetch of product is mandatory + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } From 9b37754b858d65082daa928afc0d82c09a9d4ffd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Oct 2022 09:10:22 +0200 Subject: [PATCH 2/2] FIX check $id is already check before --- htdocs/product/stats/bom.php | 5 ++--- htdocs/product/stats/commande.php | 5 ++--- htdocs/product/stats/commande_fournisseur.php | 5 ++--- htdocs/product/stats/contrat.php | 5 ++--- htdocs/product/stats/facture.php | 1 - htdocs/product/stats/facture_fournisseur.php | 5 ++--- htdocs/product/stats/facturerec.php | 5 ++--- htdocs/product/stats/mo.php | 5 ++--- htdocs/product/stats/propal.php | 5 ++--- htdocs/product/stats/supplier_proposal.php | 5 ++--- 10 files changed, 18 insertions(+), 28 deletions(-) diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index a8e76a178bf..f423dd2ec6f 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -258,12 +258,11 @@ if ($id > 0 || !empty($ref)) { } $db->free($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 9f38f68ee33..6d13bb95f00 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -183,12 +183,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 5a236334b5e..222db432bdf 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -184,12 +184,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 03bb1828f66..f831d54d097 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -169,12 +169,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 9b3ee0ad5e4..a83472b4341 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -200,7 +200,6 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); - // Fetch of product is mandatory $option .= '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 59ca77d5937..be6964a26be 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -183,12 +183,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index b71c24d75cb..5a31e16c26a 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -201,12 +201,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 38bebc562ed..edd20a7ee64 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -162,12 +162,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 2f6faca07a7..d13b01c8bdc 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -185,12 +185,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 2136b9b26cf..afde5fe27f8 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -184,12 +184,11 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); + $option .= '&id='.$product->id; + if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.urlencode($limit); } - if (!empty($id)) { - $option .= '&id='.$product->id; - } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); }