From c902acf99a1af5e94eda5d5542aaf7bbd27b0e29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Apr 2010 08:53:55 +0000 Subject: [PATCH] Fix: A lot of duplicate lines. --- htdocs/expedition/liste.php | 132 ++++++++++++++---------------------- 1 file changed, 50 insertions(+), 82 deletions(-) diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index 4ada5d6503f..9ba1290359b 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -21,7 +21,7 @@ /** * \file htdocs/expedition/liste.php * \ingroup expedition - * \brief Page de la liste des expeditions/livraisons + * \brief Page to list all shipments * \version $Id$ */ @@ -39,7 +39,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,''); $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:""; $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:""; -if (! $sortfield) $sortfield="e.rowid"; +if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; @@ -50,28 +50,19 @@ $offset = $limit * $_GET["page"] ; * View */ +$companystatic=new Societe($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.= ", s.nom as socname, s.rowid as socid"; -$sql.= ", ori.ref as origin_ref, ori.rowid as origin_id"; $sql.= " FROM (".MAIN_DB_PREFIX."expedition as e"; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql.= ") LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target"; -if ($conf->commande->enabled) -{ - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as ori ON el.fk_source = ori.rowid"; - $sql.= " AND el.sourcetype = 'commande'"; -} -else -{ - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."propal as ori ON el.fk_source = ori.rowid"; - $sql.= " AND el.sourcetype = 'propal'"; -} +$sql.= ")"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; $sql.= " WHERE e.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all @@ -81,101 +72,78 @@ if (!$user->rights->societe->client->voir && !$socid) // Internal user with no p } if ($socid) { - $sql.= " AND e.fk_soc = ".$socid; + $sql.= " AND e.fk_soc = ".$socid; } if ($_POST["sf_ref"]) { - $sql.= " AND e.ref like '%".addslashes($_POST["sf_ref"])."%'"; + $sql.= " AND e.ref like '%".addslashes($_POST["sf_ref"])."%'"; } -$sql.= " ORDER BY $sortfield $sortorder"; +$sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); - $expedition = new Expedition($db); + $expedition = new Expedition($db); - print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php","&socid=$socid",$sortfield,$sortorder,'',$num); + $param="&socid=$socid"; - $i = 0; - print ''; + print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php",$param,$sortfield,$sortorder,'',$num); - print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","","&socid=$socid",'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", "&socid=$socid",'width="25%" align="left"',$sortfield,$sortorder); - if ($conf->commande->enabled) - { - print_liste_field_titre($langs->trans("Order"),"liste.php","ori.ref", "", "&socid=$socid",'width="25%" align="left"',$sortfield,$sortorder); - } - else - { - print_liste_field_titre($langs->trans("Proposal"),"liste.php","ori.ref", "", "&socid=$socid",'width="25%" align="left"',$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&socid=$socid", 'width="25%" align="right" colspan="2"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="right"',$sortfield,$sortorder); - print "\n"; - $var=True; - while ($i < min($num,$limit)) - { - $objp = $db->fetch_object($resql); + $i = 0; + print '
'; - $var=!$var; - print ""; - print "\n"; - print ''; - if ($conf->commande->enabled) - { - print ''; - } - else - { - 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 "\n"; + $var=True; - $now = time(); - $lim = 3600 * 24 * 15 ; + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($resql); - if ( ($now - $db->jdate($objp->date_expedition)) > $lim && $objp->statutid == 1 ) - { - print ""; - } - else - { - print ""; - } + $var=!$var; + print ""; + print "\n"; + // Third party + print ''; + // Date + print "\n"; - print "\n"; + print ''; + print "\n"; - print ''; - print "\n"; + $i++; + } - $i++; - } - - print "
rowid."\">".img_object($langs->trans("ShowSending"),"sending").' '; - print "rowid."\">".$objp->ref."'.$objp->socname.''.$objp->origin_ref.''.$objp->origin_ref.'
> 15 jours 
rowid."\">".img_object($langs->trans("ShowSending"),"sending").' '; + print "rowid."\">".$objp->ref."'; + $companystatic->id=$objp->id; + $companystatic->ref=$objp->id; + $companystatic->nom=$objp->socname; + print $companystatic->getNomUrl(1); + print '"; + print dol_print_date($db->jdate($objp->date_expedition),"day"); + /*$now = time(); + if ( ($now - $db->jdate($objp->date_expedition)) > $conf->warnings->lim && $objp->statutid == 1 ) + { + }*/ + print ""; - $y = dol_print_date($db->jdate($objp->date_expedition),"%Y"); - $m = dol_print_date($db->jdate($objp->date_expedition),"%m"); - $mt = dol_print_date($db->jdate($objp->date_expedition),"%b"); - $d = dol_print_date($db->jdate($objp->date_expedition),"%d"); - print $d."\n"; - print " "; - print $b."\n"; - print " "; - print $y."'.$expedition->LibStatut($objp->fk_statut,5).'
'.$expedition->LibStatut($objp->fk_statut,5).'
"; - $db->free($resql); + print ""; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } $db->close(); llxFooter('$Date$ - $Revision$'); - ?>