Bugfix
This commit is contained in:
parent
d3e3fff23b
commit
f85d414fdb
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* Sécurité accés client
|
||||||
*/
|
*/
|
||||||
|
$socidp = $_GET["socidp"];
|
||||||
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -51,19 +53,11 @@ $begin=$_GET["begin"];
|
|||||||
$sortorder=$_GET["sortorder"];
|
$sortorder=$_GET["sortorder"];
|
||||||
$sortfield=$_GET["sortfield"];
|
$sortfield=$_GET["sortfield"];
|
||||||
|
|
||||||
if ($sortfield == "")
|
if ($sortfield == "") $sortfield="c.rowid";
|
||||||
{
|
if ($sortorder == "") $sortorder="DESC";
|
||||||
$sortfield="c.rowid";
|
|
||||||
}
|
|
||||||
if ($sortorder == "")
|
|
||||||
{
|
|
||||||
$sortorder="DESC";
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $_GET["page"] ;
|
$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 = "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";
|
$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 .= " ORDER BY $sortfield $sortorder";
|
||||||
$sql .= $db->plimit($limit + 1,$offset);
|
$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;
|
$i = 0;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -109,7 +117,7 @@ if ( $db->query($sql) )
|
|||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object();
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
@ -148,7 +156,7 @@ if ( $db->query($sql) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free();
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user