From b2a9791dca9bd3872ba359a77439290167820ce9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2020 16:33:02 +0200 Subject: [PATCH] Fix pagination on pages "Related items" --- htdocs/core/lib/product.lib.php | 42 +++++++++---------- htdocs/product/stats/commande.php | 22 ++++------ htdocs/product/stats/commande_fournisseur.php | 20 ++++----- htdocs/product/stats/contrat.php | 21 ++++------ htdocs/product/stats/facture.php | 20 ++++----- htdocs/product/stats/facture_fournisseur.php | 22 ++++------ htdocs/product/stats/mo.php | 22 ++++------ htdocs/product/stats/propal.php | 20 ++++----- htdocs/product/stats/supplier_proposal.php | 22 ++++------ 9 files changed, 90 insertions(+), 121 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a6ee33e9a65..0615ff127b0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -353,6 +353,24 @@ function show_stats_for_company($product, $socid) print ''.$langs->trans("TotalQuantity").''; print ''; + // MO + if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) + { + $nblines++; + //$ret = $product->load_stats_mo($socid); + if ($ret < 0) dol_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; + print ''; + print $product->stats_mo['suppliers']; + print ''; + print $product->stats_mo['nb']; + print ''; + print $product->stats_mo['qty']; + print ''; + print ''; + } // Customer proposals if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { @@ -379,7 +397,7 @@ function show_stats_for_company($product, $socid) if ($ret < 0) dol_print_error($db); $langs->load("propal"); print ''; - print ''.img_object('', 'propal').' '.$langs->trans("SupplierProposals").''; + print ''.img_object('', 'supplier_proposal').' '.$langs->trans("SupplierProposals").''; print ''; print $product->stats_proposal_supplier['suppliers']; print ''; @@ -415,7 +433,7 @@ function show_stats_for_company($product, $socid) if ($ret < 0) dol_print_error($db); $langs->load("orders"); print ''; - print ''.img_object('', 'order').' '.$langs->trans("SuppliersOrders").''; + print ''.img_object('', 'supplier_order').' '.$langs->trans("SuppliersOrders").''; print ''; print $product->stats_commande_fournisseur['suppliers']; print ''; @@ -425,24 +443,6 @@ function show_stats_for_company($product, $socid) print ''; print ''; } - // MO - if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) - { - $nblines++; - //$ret = $product->load_stats_mo($socid); - if ($ret < 0) dol_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; - print ''; - print $product->stats_mo['suppliers']; - print ''; - print $product->stats_mo['nb']; - print ''; - print $product->stats_mo['qty']; - print ''; - print ''; - } // Customer invoices if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { @@ -469,7 +469,7 @@ function show_stats_for_company($product, $socid) if ($ret < 0) dol_print_error($db); $langs->load("bills"); print ''; - print ''.img_object('', 'bill').' '.$langs->trans("SuppliersInvoices").''; + print ''.img_object('', 'supplier_invoice').' '.$langs->trans("SuppliersInvoices").''; print ''; print $product->stats_facture_fournisseur['suppliers']; print ''; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 71c1b0f1ef7..9898c13f21b 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -164,26 +164,22 @@ if ($id > 0 || !empty($ref)) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; - if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit); + 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print '
'."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); - print '
'; + print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - '; print $langs->trans('Month').': '; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 7a5b88000e1..61024cdd7ff 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -172,26 +172,22 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); - print '
'; + print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - '; print $langs->trans('Month').': '; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 8e61446a834..8f88044d913 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -153,27 +153,24 @@ if ($id > 0 || !empty($ref)) if ($result) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; + 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; + if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); + print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); - $i = 0; + if (!empty($page)) $option .= '&page='.urlencode($page); + + $i = 0; print '
'; print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index e42afd9f28c..342cd3058a2 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'bills', 'products')); +$langs->loadLangs(array('companies', 'bills', 'products', 'supplier_proposal')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -185,25 +185,21 @@ if ($id > 0 || !empty($ref)) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); + print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - '; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 29774709e5e..f39d4ab73b3 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'bills', 'products', 'companies')); +$langs->loadLangs(array('companies', 'bills', 'products', 'companies', 'supplier_proposal')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -165,26 +165,22 @@ if ($id > 0 || !empty($ref)) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); - print '
'; + print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - '; print $langs->trans('Month').': '; diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 0a148ad2c8a..51e91aeaaac 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -150,27 +150,23 @@ if ($id > 0 || !empty($ref)) if ($result) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.urlencode($search_month); - if (!empty($search_year)) - $option .= '&search_year='.urlencode($search_year); - if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit); + + 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("Mos"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); + print_barre_liste($langs->trans("Mos"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); - $i = 0; + if (!empty($page)) $option .= '&page='.urlencode($page); + + $i = 0; print '
'; print '
'; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index d65b88ccabc..35b93cac8b9 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -169,26 +169,22 @@ if ($id > 0 || !empty($ref)) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); - print '
'; + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DatePropal").') - '; print $langs->trans('Month').': '; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index a7fede51aa1..5a59cbb9c83 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array('products', 'companies')); +$langs->loadLangs(array('products', 'companies', 'supplier_proposal')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -169,26 +169,22 @@ if ($id > 0 || !empty($ref)) { $num = $db->num_rows($result); - if (!empty($id)) - $option .= '&id='.$product->id; - if (!empty($search_month)) - $option .= '&search_month='.$search_month; - if (!empty($search_year)) - $option .= '&search_year='.$search_year; 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); + if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print ''."\n"; if (!empty($sortfield)) print ''; if (!empty($sortorder)) print ''; - if (!empty($page)) { - print ''; - $option .= '&page='.$page; - } - print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); - print '
'; + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if (!empty($page)) $option .= '&page='.urlencode($page); + + print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DatePropal").') - '; print $langs->trans('Month').': ';