diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3 index 090f4880257..d1a9b158a09 100644 --- a/htdocs/compta/facture.php3 +++ b/htdocs/compta/facture.php3 @@ -837,8 +837,6 @@ else $sortfield="f.datef"; } - print_barre_liste("Factures",$page,$PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder); - $sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp"; @@ -857,48 +855,50 @@ else } $sql .= " ORDER BY $sortfield $sortorder "; - $sql .= $db->plimit( $limit ,$offset); + $sql .= $db->plimit($limit + 1,$offset); $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - - $i = 0; - print ""; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - if ($num > 0) { - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - - print ""; - print "
Numéro'; - print_liste_field_titre("Société",$PHP_SELF,"s.nom","","&socidp=$socidp"); - print ''; - print_liste_field_titre("Date",$PHP_SELF,"f.datef","","&socidp=$socidp"); - print 'Montant 
facid\">"; - if ($objp->paye) - { - print $objp->facnumber; - } - else - { - print ''.$objp->facnumber.''; - } + if ($result) + { + $num = $db->num_rows(); + print_barre_liste("Factures",$page,$PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); + + $i = 0; + print ""; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + if ($num > 0) { + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + + print ""; + print "\n"; print "\n"; - + if ($objp->df > 0 ) { print "
Numéro'; + print_liste_field_titre("Société",$PHP_SELF,"s.nom","","&socidp=$socidp"); + print ''; + print_liste_field_titre("Date",$PHP_SELF,"f.datef","","&socidp=$socidp"); + print 'Montant 
facid\">"; + if ($objp->paye) + { + print $objp->facnumber; + } + else + { + print ''.$objp->facnumber.''; + } print "idp\">$objp->nom"; $y = strftime("%Y",$objp->df); $m = strftime("%m",$objp->df); - + print strftime("%d",$objp->df)."\n"; print " "; print strftime("%B",$objp->df)."\n"; diff --git a/htdocs/compta/propal.php3 b/htdocs/compta/propal.php3 index 705fe433cbc..24d5d70b96b 100644 --- a/htdocs/compta/propal.php3 +++ b/htdocs/compta/propal.php3 @@ -354,8 +354,6 @@ if ($propalid) $limit = $conf->liste_limit; $offset = $limit * $page ; - print_barre_liste("Propositions commerciales", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder); - $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c "; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut in(2,4)"; @@ -381,11 +379,14 @@ if ($propalid) } $sql .= " ORDER BY $sortfield $sortorder "; - $sql .= $db->plimit($limit ,$offset); + $sql .= $db->plimit($limit + 1,$offset); if ( $db->query($sql) ) { $num = $db->num_rows(); + + print_barre_liste("Propositions commerciales", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); + $i = 0; print ""; print ''; @@ -396,7 +397,7 @@ if ($propalid) print_liste_field_titre_new ("Statut",$PHP_SELF,"p.fk_statut","","",'align="center"',$sortfield); print "\n"; - while ($i < $num) + while ($i < min($num, $limit)) { $objp = $db->fetch_object( $i); diff --git a/htdocs/fichinter/index.php3 b/htdocs/fichinter/index.php3 index 35c6479f725..99689dabaab 100644 --- a/htdocs/fichinter/index.php3 +++ b/htdocs/fichinter/index.php3 @@ -47,9 +47,6 @@ $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; - -print_barre_liste("Liste des fiches d'intervention", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder); - $sql = "SELECT s.nom,s.idp, f.ref,".$db->pdate("f.datei")." as dp, f.rowid as fichid, f.fk_statut, f.duree"; $sql .= " FROM llx_societe as s, llx_fichinter as f "; $sql .= " WHERE f.fk_soc = s.idp "; @@ -59,11 +56,13 @@ if ($user->societe_id > 0) $sql .= " AND s.idp = " . $user->societe_id; } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit ,$offset); +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset); if ( $db->query($sql) ) { $num = $db->num_rows(); + print_barre_liste("Liste des fiches d'intervention", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); + $i = 0; print '
'; print ""; diff --git a/htdocs/lib/functions.inc.php3 b/htdocs/lib/functions.inc.php3 index 889da91e238..dbf605f09c2 100644 --- a/htdocs/lib/functions.inc.php3 +++ b/htdocs/lib/functions.inc.php3 @@ -311,9 +311,19 @@ function block_access() * */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $form='') +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $form='', $num=-1) { global $conf; + + if ($num > $conf->liste_limit or $num == -1) + { + $nextpage = 1; + } + else + { + $nextpage = 0; + } + print '
'; if ($page > 0) @@ -343,14 +353,9 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so } // affichage des fleches de navigation - print_fleche_navigation($page,$file,$options); - /* - if ($page > 0) - { - print 'Page précédente'; - } - print 'Page suivante'; - */ + + print_fleche_navigation($page,$file,$options, $nextpage); + print '

'; } @@ -358,14 +363,18 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so * fonction servant a afficher les fleches de navigation dans les * pages de liste */ -function print_fleche_navigation($page,$file,$options='') +function print_fleche_navigation($page,$file,$options='', $nextpage) { global $conf; if ($page > 0) { print 'Page précédente'; } - print 'Page suivante'; + + if ($nextpage > 0) + { + print 'Page suivante'; + } } /* *