Fix pagination on pages "Related items"

This commit is contained in:
Laurent Destailleur 2020-05-05 16:33:02 +02:00
parent 797beef79f
commit b2a9791dca
9 changed files with 90 additions and 121 deletions

View File

@ -353,6 +353,24 @@ function show_stats_for_company($product, $socid)
print '<td class="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>';
// 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 '<tr><td>';
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp').' '.$langs->trans("MO").'</a>';
print '</td><td class="right">';
print $product->stats_mo['suppliers'];
print '</td><td class="right">';
print $product->stats_mo['nb'];
print '</td><td class="right">';
print $product->stats_mo['qty'];
print '</td>';
print '</tr>';
}
// 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 '<tr><td>';
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'propal').' '.$langs->trans("SupplierProposals").'</a>';
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal').' '.$langs->trans("SupplierProposals").'</a>';
print '</td><td class="right">';
print $product->stats_proposal_supplier['suppliers'];
print '</td><td class="right">';
@ -415,7 +433,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'order').' '.$langs->trans("SuppliersOrders").'</a>';
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order').' '.$langs->trans("SuppliersOrders").'</a>';
print '</td><td class="right">';
print $product->stats_commande_fournisseur['suppliers'];
print '</td><td class="right">';
@ -425,24 +443,6 @@ function show_stats_for_company($product, $socid)
print '</td>';
print '</tr>';
}
// 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 '<tr><td>';
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp').' '.$langs->trans("MO").'</a>';
print '</td><td class="right">';
print $product->stats_mo['suppliers'];
print '</td><td class="right">';
print $product->stats_mo['nb'];
print '</td><td class="right">';
print $product->stats_mo['qty'];
print '</td>';
print '</tr>';
}
// 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 '<tr><td>';
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'bill').' '.$langs->trans("SuppliersInvoices").'</a>';
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice').' '.$langs->trans("SuppliersInvoices").'</a>';
print '</td><td class="right">';
print $product->stats_facture_fournisseur['suppliers'];
print '</td><td class="right">';

View File

@ -164,26 +164,22 @@ if ($id > 0 || !empty($ref))
{
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&amp;id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';

View File

@ -172,26 +172,22 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&amp;id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';

View File

@ -153,27 +153,24 @@ if ($id > 0 || !empty($ref))
if ($result)
{
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], "&amp;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 '<div class="div-table-responsive">';
print '<table class="tagtable liste listwithfilterbefore" width="100%">';

View File

@ -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 .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], "&amp;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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';

View File

@ -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 .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&amp;id=$product->id", $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';

View File

@ -150,27 +150,23 @@ if ($id > 0 || !empty($ref))
if ($result)
{
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.urlencode($search_month);
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("Mos"), $page, $_SERVER["PHP_SELF"], "&amp;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 '<div class="div-table-responsive">';
print '<table class="tagtable liste listwithfilterbefore" width="100%">';

View File

@ -169,26 +169,22 @@ if ($id > 0 || !empty($ref))
{
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&amp;id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("DatePropal").') - ';
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';

View File

@ -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 .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (!empty($search_year))
$option .= '&amp;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 '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&amp;id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '<div class="liste_titre liste_titre_bydiv centpercent">';
print '<div class="divsearchfield">';
print $langs->trans('Period').' ('.$langs->trans("DatePropal").') - ';
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';