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 '
| rowid."\">".img_object($langs->trans("ShowSending"),"sending").' '; - print "rowid."\">".$objp->ref." | \n"; - print ''.$objp->socname.' | '; - if ($conf->commande->enabled) - { - print ''.$objp->origin_ref.' | '; - } - else - { - print ''.$objp->origin_ref.' | '; - } + print '|
| > 15 jours | "; - } - else - { - print ""; - } + $var=!$var; + print " | |||
| rowid."\">".img_object($langs->trans("ShowSending"),"sending").' '; + print "rowid."\">".$objp->ref." | \n"; + // Third party + print ''; + $companystatic->id=$objp->id; + $companystatic->ref=$objp->id; + $companystatic->nom=$objp->socname; + print $companystatic->getNomUrl(1); + print ' | '; + // Date + 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 " | \n"; - 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." | \n"; + print ''.$expedition->LibStatut($objp->fk_statut,5).' | '; + print "'.$expedition->LibStatut($objp->fk_statut,5).' | '; - print "\n"; + $i++; + } - $i++; - } - - print "