Fix: On exclut les expeditions brouillons dans calcul des epxeditions livrées

Fix: Lien invalides
This commit is contained in:
Laurent Destailleur 2006-01-14 13:45:04 +00:00
parent 362b6099d3
commit 709e8944b7
2 changed files with 430 additions and 415 deletions

View File

@ -30,6 +30,9 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
$user->getrights('commande'); $user->getrights('commande');
@ -37,9 +40,6 @@ $user->getrights('expedition');
if (!$user->rights->commande->lire) if (!$user->rights->commande->lire)
accessforbidden(); accessforbidden();
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -60,6 +60,9 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes')
} }
$html = new Form($db);
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
/* Mode vue et edition */ /* Mode vue et edition */
@ -68,15 +71,13 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes')
llxHeader('',$langs->trans("OrderCard")); llxHeader('',$langs->trans("OrderCard"));
$html = new Form($db);
if ($_GET["id"] > 0) if ($_GET["id"] > 0)
{ {
$commande = New Commande($db); $commande = New Commande($db);
if ( $commande->fetch($_GET["id"]) > 0) if ( $commande->fetch($_GET["id"]) > 0)
{ {
$commande->livraison_array(); $commande->livraison_array(1);
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->soc_id); $soc->fetch($commande->soc_id);
@ -124,7 +125,7 @@ if ($_GET["id"] > 0)
print "<br />"; print "<br />";
} }
// Onglet expedition // Onglet commande
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -206,7 +207,7 @@ if ($_GET["id"] > 0)
$reste_a_livrer = array(); $reste_a_livrer = array();
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object(); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
@ -378,9 +379,10 @@ if ($_GET["id"] > 0)
$sql .= ",".$db->pdate("e.date_expedition")." as date_expedition"; $sql .= ",".$db->pdate("e.date_expedition")." as date_expedition";
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
$sql .= " WHERE cd.fk_commande = $commande->id"; $sql .= " WHERE cd.fk_commande = ".$commande->id;
$sql .= " AND cd.rowid = ed.fk_commande_ligne"; $sql .= " AND cd.rowid = ed.fk_commande_ligne";
$sql .= " AND ed.fk_expedition = e.rowid"; $sql .= " AND ed.fk_expedition = e.rowid";
$sql .= " AND e.fk_statut > 0";
$sql .= " ORDER BY cd.fk_product"; $sql .= " ORDER BY cd.fk_product";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -391,7 +393,10 @@ if ($_GET["id"] > 0)
if ($num) if ($num)
{ {
print '<br><table class="liste" width="100%">'; print '<br>';
print_titre($langs->trans("OtherSendingsForSameOrder"));
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Description").'</td>'; print '<td width="54%">'.$langs->trans("Description").'</td>';
print '<td align="center">Quan. livrée</td>'; print '<td align="center">Quan. livrée</td>';
@ -411,7 +416,7 @@ if ($_GET["id"] > 0)
$product->fetch($objp->fk_product); $product->fetch($objp->fk_product);
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle; print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
if ($objp->description) print nl2br($objp->description); if ($objp->description) print nl2br($objp->description);
print '</td>'; print '</td>';
} }

View File

@ -37,6 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
$langs->load("bills"); $langs->load("bills");
$user->getrights('expedition');
if (!$user->rights->expedition->lire) if (!$user->rights->expedition->lire)
accessforbidden(); accessforbidden();
@ -295,7 +296,7 @@ if ($_GET["action"] == 'create')
* *
*/ */
print '<tr><td align="center" colspan="4"><br><input type="submit" value="'.$langs->trans("Create").'"></td></tr>'; print '<tr><td align="center" colspan="4"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print "</table>"; print "</table>";
print '</form>'; print '</form>';
} }
@ -311,7 +312,6 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
{ {
if ($_GET["id"] > 0) if ($_GET["id"] > 0)
{ {
$expedition = New Expedition($db); $expedition = New Expedition($db);
@ -337,7 +337,7 @@ else
$hselected = $h; $hselected = $h;
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("Sending")." : ".$expedition->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("Sending"));
/* /*
* Confirmation de la suppression * Confirmation de la suppression
@ -378,31 +378,39 @@ else
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$expedition->ref.'</td></tr>';
// Client
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>'; print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
print '<td width="30%">'; print '<td width="30%">';
print '<b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>'; print '<b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
// Auteur
print '<td width="20%">'.$langs->trans("Author").'</td><td width="30%">'.$author->fullname.'</td>'; print '<td width="20%">'.$langs->trans("Author").'</td><td width="30%">'.$author->fullname.'</td>';
print "</tr>"; print "</tr>";
// Commande liée
print '<tr><td>'.$langs->trans("Order").'</td>'; print '<tr><td>'.$langs->trans("Order").'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id.'">'.$commande->ref."</a></td>\n"; print '<td><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id.'">'.$commande->ref."</a></td>\n";
print '<td>&nbsp;</td><td>&nbsp;</td></tr>'; print '<td>&nbsp;</td><td>&nbsp;</td></tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td>".strftime("%A %d %B %Y",$expedition->date)."</td>\n"; print "<td>".strftime("%A %d %B %Y",$expedition->date)."</td>\n";
// Entrepot
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($expedition->entrepot_id); $entrepot->fetch($expedition->entrepot_id);
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td></tr>'; print '<td width="20%">'.$langs->trans("Warehouse").'</td><td><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td></tr>';
print "</table>\n"; print "</table>\n";
/* /*
* Lignes * Lignes produits
*
*/ */
echo '<br><table class="noborder" width="100%">'; echo '<br><table class="noborder" width="100%">';
@ -437,7 +445,7 @@ else
$product->fetch($objp->fk_product); $product->fetch($objp->fk_product);
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle; print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
if ($objp->description) print nl2br($objp->description); if ($objp->description) print nl2br($objp->description);
print '</td>'; print '</td>';
} }
@ -466,8 +474,9 @@ else
/* /*
* * Boutons actions
*/ */
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -507,17 +516,18 @@ else
/* /*
* Déjà livré * Déjà livre
*/ */
$sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande";
$sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id"; $sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id";
$sql .= ",".$db->pdate("e.date_expedition")." as date_expedition"; $sql .= ",".$db->pdate("e.date_expedition")." as date_expedition";
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
$sql .= " WHERE cd.fk_commande = $expedition->commande_id"; $sql .= " WHERE cd.fk_commande = ".$expedition->commande_id;
$sql .= " AND e.rowid <> $expedition->id"; $sql .= " AND e.rowid <> ".$expedition->id;
$sql .= " AND cd.rowid = ed.fk_commande_ligne"; $sql .= " AND cd.rowid = ed.fk_commande_ligne";
$sql .= " AND ed.fk_expedition = e.rowid"; $sql .= " AND ed.fk_expedition = e.rowid";
$sql .= " AND e.fk_statut > 0";
$sql .= " ORDER BY cd.fk_product"; $sql .= " ORDER BY cd.fk_product";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -551,7 +561,7 @@ else
$product->fetch($objp->fk_product); $product->fetch($objp->fk_product);
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle; print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
if ($objp->description) print nl2br($objp->description); if ($objp->description) print nl2br($objp->description);
print '</td>'; print '</td>';
} }