From 09951888a554f5aceecf10415fda5f957217a14f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Feb 2016 23:04:17 +0100 Subject: [PATCH] Can select number of records for warehouse lists. --- htdocs/product/list.php | 5 ++--- htdocs/product/stock/list.php | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c25c4c1ce0a..f69adcfc8dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -270,14 +270,13 @@ else $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet - $nbtotalofrecords = 0; + $sql.= $db->order($sortfield,$sortorder); + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); } - - $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index bebfc87b528..58f95625d94 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -37,13 +37,13 @@ $search_label=GETPOST("snom","alpha")?GETPOST("snom","alpha"):GETPOST("search_la $sall=GETPOST("sall","alpha"); $search_status=GETPOST("search_status","int"); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); $sortorder = GETPOST("sortorder"); if (! $sortfield) $sortfield="e.label"; if (! $sortorder) $sortorder="ASC"; $page = GETPOST("page"); if ($page < 0) $page = 0; -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; $year = strftime("%Y",time()); @@ -107,14 +107,17 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); - print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $totalnboflines); - - print '
'; + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + print ''; print ''; print ''; print ''; print ''; + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, '', '', $limit); + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); @@ -126,13 +129,13 @@ if ($result) print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; // Lignes des champs de filtre