From 0891275893b04d994671e27e936d18572d249abc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Mar 2008 18:12:07 +0000 Subject: [PATCH] Added enhanced patch of sladame --- htdocs/comm/clients.php | 2 +- htdocs/comm/prospect/prospects.php | 2 +- htdocs/fourn/liste.php | 2 +- htdocs/lib/functions.inc.php | 23 +++++++++++++++++------ htdocs/societe.php | 12 ++++++++++-- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index 45a7965bfe9..77e35132e43 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -78,7 +78,7 @@ if (! $sortfield) $sortfield="s.nom"; // Count total nb of records $nbtotalofrecords = 0; -if (empty($conf->global->DISABLE_FULL_SCANLIST)) +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index 7ac32a11cc6..a24576ad4ef 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -104,7 +104,7 @@ if ($socname) // Count total nb of records $nbtotalofrecords = 0; -if (empty($conf->global->DISABLE_FULL_SCANLIST)) +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); diff --git a/htdocs/fourn/liste.php b/htdocs/fourn/liste.php index 5764cb0bb9f..42fd120618e 100644 --- a/htdocs/fourn/liste.php +++ b/htdocs/fourn/liste.php @@ -93,7 +93,7 @@ if ($search_ville) // Count total nb of records $nbtotalofrecords = 0; -if (empty($conf->global->DISABLE_FULL_SCANLIST)) +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 15fb70e32da..393c5a53557 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -1734,24 +1734,35 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print '
'.$titre.'
'; print ''; + $maxnbofpage=10; + $nbpages=ceil($totalnboflines/$conf->liste_limit); - $cpt=($page-10); - if ($cpt<0) { $cpt=0; } + $cpt=($page-$maxnbofpage); + if ($cpt < 0) { $cpt=0; } $pagelist.=$langs->trans('Page'); - if ($cpt>=1) { $pagelist.=' 1 ... ';} + if ($cpt>=1) + { + $pagelist.=' 1'; + if ($cpt >= 2) $pagelist.=' ...'; + } do { if($cpt==$page) { - $pagelist.= " ".($page+1).''; + $pagelist.= ' '.($page+1).''; } else { $pagelist.= ' '.($cpt+1).''; } $cpt++; - } while ($cpt < $nbpages && $cpt<=$page+10); - if ($cpt<$nbpages) { $pagelist.= ' ... '.$nbpages.''; } + } + while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage); + if ($cpt<$nbpages) + { + if ($cpt<$nbpages-1) $pagelist.= ' ...'; + $pagelist.= ' '.$nbpages.''; + } } else { diff --git a/htdocs/societe.php b/htdocs/societe.php index b89d4310cc7..5416d46ec13 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -179,6 +179,14 @@ if ($_POST["search_siren"]) $sql .= " AND s.siren LIKE '%".$_POST["search_siren"]."%'"; } +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); $result = $db->query($sql); @@ -189,7 +197,7 @@ if ($result) $params = "&socname=$socname"; - print_barre_liste($title, $page, "societe.php",$params,$sortfield,$sortorder,'',$num); + print_barre_liste($title, $page, "societe.php",$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords); // Lignes des titres print '';