Skip to content
Snippets Groups Projects
Commit c902acf9 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: A lot of duplicate lines.

parent 817a09c7
Branches
Tags
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/** /**
* \file htdocs/expedition/liste.php * \file htdocs/expedition/liste.php
* \ingroup expedition * \ingroup expedition
* \brief Page de la liste des expeditions/livraisons * \brief Page to list all shipments
* \version $Id$ * \version $Id$
*/ */
...@@ -39,7 +39,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,''); ...@@ -39,7 +39,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,'');
$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:""; $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:"";
$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:""; $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:"";
if (! $sortfield) $sortfield="e.rowid"; if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
...@@ -50,28 +50,19 @@ $offset = $limit * $_GET["page"] ; ...@@ -50,28 +50,19 @@ $offset = $limit * $_GET["page"] ;
* View * View
*/ */
$companystatic=new Societe($db);
$helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
llxHeader('',$langs->trans('ListOfSendings'),$helpurl); 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_expedition, e.fk_statut";
$sql.= ", s.nom as socname, s.rowid as socid"; $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"; $sql.= " FROM (".MAIN_DB_PREFIX."expedition as e";
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
{ {
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
$sql.= ") LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target"; $sql.= ")";
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.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
...@@ -88,7 +79,7 @@ if ($_POST["sf_ref"]) ...@@ -88,7 +79,7 @@ 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); $sql.= $db->plimit($limit + 1,$offset);
$resql=$db->query($sql); $resql=$db->query($sql);
...@@ -98,24 +89,19 @@ if ($resql) ...@@ -98,24 +89,19 @@ if ($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";
print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php",$param,$sortfield,$sortorder,'',$num);
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","","&amp;socid=$socid",'width="15%"',$sortfield,$sortorder); 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", "", "&amp;socid=$socid",'width="25%" align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'width="25%" align="left"',$sortfield,$sortorder);
if ($conf->commande->enabled) 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("Order"),"liste.php","ori.ref", "", "&amp;socid=$socid",'width="25%" align="left"',$sortfield,$sortorder);
}
else
{
print_liste_field_titre($langs->trans("Proposal"),"liste.php","ori.ref", "", "&amp;socid=$socid",'width="25%" align="left"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&amp;socid=$socid", 'width="25%" align="right" colspan="2"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&amp;socid=$socid",'width="10%" align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
...@@ -127,38 +113,21 @@ if ($resql) ...@@ -127,38 +113,21 @@ if ($resql)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?id=".$objp->rowid."\">".img_object($langs->trans("ShowSending"),"sending").'</a>&nbsp;'; print "<td><a href=\"fiche.php?id=".$objp->rowid."\">".img_object($langs->trans("ShowSending"),"sending").'</a>&nbsp;';
print "<a href=\"fiche.php?id=".$objp->rowid."\">".$objp->ref."</a></td>\n"; print "<a href=\"fiche.php?id=".$objp->rowid."\">".$objp->ref."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->socid.'">'.$objp->socname.'</a></td>'; // Third party
if ($conf->commande->enabled) print '<td>';
$companystatic->id=$objp->id;
$companystatic->ref=$objp->id;
$companystatic->nom=$objp->socname;
print $companystatic->getNomUrl(1);
print '</td>';
// Date
print "<td align=\"center\">";
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 '<td><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$objp->origin_id.'">'.$objp->origin_ref.'</a></td>'; }*/
} print "</td>\n";
else
{
print '<td><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$objp->origin_id.'">'.$objp->origin_ref.'</a></td>';
}
$now = time();
$lim = 3600 * 24 * 15 ;
if ( ($now - $db->jdate($objp->date_expedition)) > $lim && $objp->statutid == 1 )
{
print "<td><b> &gt; 15 jours</b></td>";
}
else
{
print "<td>&nbsp;</td>";
}
print "<td align=\"right\">";
$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 " <a href=\"propal.php?year=$y&amp;month=$m\">";
print $b."</a>\n";
print " <a href=\"propal.php?year=$y\">";
print $y."</a></TD>\n";
print '<td align="right">'.$expedition->LibStatut($objp->fk_statut,5).'</td>'; print '<td align="right">'.$expedition->LibStatut($objp->fk_statut,5).'</td>';
print "</tr>\n"; print "</tr>\n";
...@@ -177,5 +146,4 @@ else ...@@ -177,5 +146,4 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment