From 96e5927a2b88a9f7be606474b70b1ed995bf6d8c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 10 Jul 2003 18:55:16 +0000 Subject: [PATCH] =?UTF-8?q?Modif=20du=20tri=20par=20d=E9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/clients.php3 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/clients.php3 b/htdocs/comm/clients.php3 index ed8e011499a..994a6489a59 100644 --- a/htdocs/comm/clients.php3 +++ b/htdocs/comm/clients.php3 @@ -159,15 +159,12 @@ $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; - - /* * Mode Liste * * * */ -print_barre_liste("Liste des clients", $page, $PHP_SELF,"",$sortfield,$sortorder); $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM llx_societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1"; @@ -189,16 +186,18 @@ if ($user->societe_id) if ($socname) { $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; - $sortfield = "lower(s.nom)"; - $sortorder = "ASC"; + $sortfield = "s.datec"; + $sortorder = "DESC"; } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset); $result = $db->query($sql); if ($result) { $num = $db->num_rows(); + print_barre_liste("Liste des clients", $page, $PHP_SELF,"",$sortfield,$sortorder,'',$num); + $i = 0; if ($sortorder == "DESC") @@ -218,7 +217,7 @@ if ($result) print "\n"; $var=True; - while ($i < $num) + while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object( $i);