From 7d791167349a8d58791264dfa7ec31ed247a6993 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 May 2010 22:06:27 +0000 Subject: [PATCH] Fix: Restore broken features in shipping module --- htdocs/commande/class/commande.class.php | 10 ++++---- htdocs/expedition/class/expedition.class.php | 25 ++++++++++++++++++ htdocs/expedition/index.php | 18 ++++++++++--- htdocs/expedition/liste.php | 27 +++++++++++++------- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 63643f75502..08bf971aeee 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2163,11 +2163,11 @@ class Commande extends CommonObject /** - \brief Renvoie nom clicable (avec eventuellement le picto) - \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - \param option Sur quoi pointe le lien: 0=fiche commande,3=fiche compta commande,4=fiche expedition commande - \return string Chaine avec URL - */ + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param option Sur quoi pointe le lien: 0=fiche commande,3=fiche compta commande,4=fiche expedition commande + * \return string Chaine avec URL + */ function getNomUrl($withpicto=0,$option=0) { global $langs; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e41d4d60694..d7aa941d70b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -793,6 +793,31 @@ class Expedition extends CommonObject } } + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0) + { + global $langs; + + $result=''; + $urlOption=''; + + + $lien = ''; + $lienfin=''; + + $picto='sending'; + $label=$langs->trans("ShowSending").': '.$this->ref; + + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; + $result.=$lien.$this->ref.$lienfin; + return $result; + } + /** * \brief Retourne le libelle du statut d'une expedition * \return string Libelle diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 483c0c74a13..809b87820d7 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/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 "
"; diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index cb7799a078c..d20bb659577 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -51,11 +51,12 @@ $offset = $limit * $_GET["page"] ; */ $companystatic=new Societe($db); +$shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('',$langs->trans('ListOfSendings'),$helpurl); -$sql = "SELECT e.rowid, e.ref, e.date_expedition, e.fk_statut"; +$sql = "SELECT e.rowid, e.ref, e.date_delivery, e.date_expedition, e.fk_statut"; $sql.= ", s.nom as socname, s.rowid as socid"; $sql.= " FROM (".MAIN_DB_PREFIX."expedition as e"; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all @@ -98,10 +99,11 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","",$param,'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'width="25%" align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","",$param, 'width="25%" align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","",$param,'width="10%" align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"liste.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateReceived"),"liste.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=True; @@ -111,8 +113,11 @@ if ($resql) $var=!$var; print ""; - print "\n"; + print "\n"; // Third party print ''; - // Date + // Date delivery planed print "\n"; + // Date real + print "\n"; print ''; print "\n";
rowid."\">".img_object($langs->trans("ShowSending"),"sending").' '; - print "rowid."\">".$objp->ref.""; + $shipment->id=$objp->rowid; + $shipment->ref=$objp->ref; + print $shipment->getNomUrl(1); + print "'; $companystatic->id=$objp->socid; @@ -120,14 +125,18 @@ if ($resql) $companystatic->nom=$objp->socname; print $companystatic->getNomUrl(1); print '"; - print dol_print_date($db->jdate($objp->date_expedition),"day"); + print dol_print_date($db->jdate($objp->date_delivery),"day"); /*$now = time(); if ( ($now - $db->jdate($objp->date_expedition)) > $conf->warnings->lim && $objp->statutid == 1 ) { }*/ print ""; + print dol_print_date($db->jdate($objp->date_expedition),"day"); + print "'.$expedition->LibStatut($objp->fk_statut,5).'