diff --git a/htdocs/product/index.php3 b/htdocs/product/index.php3 index aa31b633a56..576fd9eda55 100644 --- a/htdocs/product/index.php3 +++ b/htdocs/product/index.php3 @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2003 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,19 +22,19 @@ require("./pre.inc.php3"); -llxHeader(); - $db = new Db(); -if ($sortfield == "") { +if ($sortfield == "") +{ $sortfield="lower(p.label),p.price"; } -if ($sortorder == "") { +if ($sortorder == "") +{ $sortorder="ASC"; } -if ($action == 'update') { - +if ($action == 'update') +{ $sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid"; $db->query($sql); } @@ -44,39 +44,59 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; +llxHeader(); print_barre_liste("Liste des produits", $page, $PHP_SELF); +print ''; + +print ""; +print "\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + $sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; - + +if ($HTTP_POST_VARS["sref"]) +{ + $sql .= " WHERE lower(p.ref) like '%".strtolower($HTTP_POST_VARS["sref"])."%'"; +} +if ($HTTP_POST_VARS["snom"]) +{ + $sql .= " WHERE lower(p.label) like '%".strtolower($HTTP_POST_VARS["snom"])."%'"; +} $sql .= " ORDER BY $sortfield $sortorder "; $sql .= $db->plimit( $limit ,$offset); -if ( $db->query($sql) ) { +if ( $db->query($sql) ) +{ $num = $db->num_rows(); $i = 0; - print "

"; +print_liste_field_titre("Réf",$PHP_SELF, "p.ref"); +print ""; +print_liste_field_titre("Libellé",$PHP_SELF, "p.label"); +print "Prix de vente
 
  
"; - print ""; - print "\n"; + $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - $i++; - } - print "
"; - print_liste_field_titre("Réf",$PHP_SELF, "p.ref"); - print ""; - print_liste_field_titre("Libellé",$PHP_SELF, "p.label"); - print "Prix de vente
rowid\">$objp->ref$objp->label'.price($objp->price).'
"; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "rowid\">$objp->ref\n"; + print "$objp->label\n"; + print ''.price($objp->price).''; + print "\n"; + $i++; + } $db->free(); } - +print ""; $db->close();