From 6c6bd45acf8b3f7337de268f8d51f2a949b719ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Aug 2010 11:48:37 +0000 Subject: [PATCH] Fix: Duplicate entry, wrong sort --- htdocs/expedition/index.php | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 312e87023e9..cc8c1cfaa31 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -21,12 +21,13 @@ /** * \file htdocs/expedition/index.php * \ingroup expedition - * \brief Page accueil du module expedition + * \brief Home page of shipping area. * \version $Id$ */ require("../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); +require(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); +require(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php"); $langs->load("orders"); $langs->load("sendings"); @@ -37,6 +38,7 @@ $langs->load("sendings"); $orderstatic=new Commande($db); $companystatic=new Societe($db); +$shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('',$langs->trans("Sendings"),$helpurl); @@ -92,9 +94,17 @@ if ($resql) { $var=!$var; $obj = $db->fetch_object($resql); - print "rowid."\">".$obj->ref.""; - print ''.$obj->nom.''; - print ''.$obj->commande_ref.''; + print ""; + $shipment->id=$obj->rowid; + $shipment->ref=$obj->ref; + print $shipment->getNomUrl(1); + print ""; + print ''; + print ''.$obj->nom.''; + print ''; + print ''; + if ($obj->commande_id) print ''.$obj->commande_ref.''; + print ''; $i++; } print "
"; @@ -139,7 +149,9 @@ if ( $db->query($sql) ) print $orderstatic->getNomUrl(1); print ''; print ''; - print ''.dol_trunc($obj->nom,20).''; + $companystatic->nom=$obj->nom; + $companystatic->id=$obj->socid; + print $companystatic->getNomUrl(1,'customer'); print ''; $i++; } @@ -189,7 +201,11 @@ if ( $resql ) $orderstatic->ref=$obj->ref; print $orderstatic->getNomUrl(1); print ''; - print ''.$obj->nom.''; + print ''; + $companystatic->nom=$obj->nom; + $companystatic->id=$obj->socid; + print $companystatic->getNomUrl(1,'customer'); + print ''; $i++; } print "
"; @@ -206,7 +222,7 @@ $sql = "SELECT e.rowid, e.ref"; $sql.= ", s.nom, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.sourcetype in ('commande')"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (!$user->rights->societe->client->voir && !$socid) @@ -218,7 +234,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= $clause." e.fk_statut = 1"; $sql.= " AND e.entity = ".$conf->entity; if ($socid) $sql.= " AND c.fk_soc = ".$socid; -$sql.= " ORDER BY e.date_expedition DESC"; +$sql.= " ORDER BY e.date_delivery DESC"; $sql.= $db->plimit(5, 0); $resql = $db->query($sql);