From f85d414fdbafcea752f90a6446346f3caaf0c8ff Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 12 Apr 2005 09:59:04 +0000 Subject: [PATCH] Bugfix --- htdocs/commande/liste.php | 114 ++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 9aea9a069b7..7e6e99be4bc 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -39,6 +39,8 @@ if (!$user->rights->commande->lire) /* * Sécurité accés client */ +$socidp = $_GET["socidp"]; + if ($user->societe_id > 0) { $action = ''; @@ -51,19 +53,11 @@ $begin=$_GET["begin"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; -if ($sortfield == "") -{ - $sortfield="c.rowid"; -} -if ($sortorder == "") -{ - $sortorder="DESC"; -} +if ($sortfield == "") $sortfield="c.rowid"; +if ($sortorder == "") $sortorder="DESC"; $limit = $conf->liste_limit; $offset = $limit * $_GET["page"] ; -$pageprev = $_GET["page"] - 1; -$pagenext = $_GET["page"] + 1; $sql = "SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande, c.fk_statut" ; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c WHERE c.fk_soc = s.idp"; @@ -90,10 +84,24 @@ if (strlen($_POST["sf_ref"]) > 0) $sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit($limit + 1,$offset); -if ( $db->query($sql) ) +$resql = $db->query($sql); + +if ($resql) { - $num = $db->num_rows(); - print_barre_liste($langs->trans("ListOfOrders"), $_GET["page"], "liste.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + + if ($socidp) + { + $soc = new Societe($db); + $soc->fetch($socidp); + $title = $langs->trans("ListOfOrders") . " - ".$soc->nom; + } + else + { + $title = $langs->trans("ListOfOrders"); + } + + $num = $db->num_rows($resql); + print_barre_liste($title, $_GET["page"], "liste.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); $i = 0; print ''; @@ -109,50 +117,50 @@ if ( $db->query($sql) ) while ($i < min($num,$limit)) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - - $now = time(); - $lim = 3600 * 24 * 15 ; - - if ( ($now - $objp->date_commande) > $lim && $objp->statutid == 1 ) - { - print ""; - } - else - { - print ""; - } - - print "\n"; - - print ''; - print "\n"; - - $total = $total + $objp->price; - $subtotal = $subtotal + $objp->price; - - $i++; + $var=!$var; + print ""; + print "\n"; + print "\n"; + + $now = time(); + $lim = 3600 * 24 * 15 ; + + if ( ($now - $objp->date_commande) > $lim && $objp->statutid == 1 ) + { + print ""; } - - print "
rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$objp->ref."idp\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom." > 15 jours "; - $y = strftime("%Y",$objp->date_commande); - $m = strftime("%m",$objp->date_commande); - - print strftime("%d",$objp->date_commande)."\n"; - print " "; - print strftime("%B",$objp->date_commande)."\n"; - print " "; - print strftime("%Y",$objp->date_commande)."'.$generic_commande->statuts[$objp->fk_statut].'
rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$objp->ref."idp\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom." > 15 jours
"; - $db->free(); + else + { + print " "; + } + + print ""; + $y = strftime("%Y",$objp->date_commande); + $m = strftime("%m",$objp->date_commande); + + print strftime("%d",$objp->date_commande)."\n"; + print " "; + print strftime("%B",$objp->date_commande)."\n"; + print " "; + print strftime("%Y",$objp->date_commande)."\n"; + + print ''.$generic_commande->statuts[$objp->fk_statut].''; + print "\n"; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + + $i++; + } + + print ""; + $db->free($resql); } else { - print dolibarr_print_error($db); + print dolibarr_print_error($db); } $db->close();