";
-
- /*
- * Documents g�n�r�s
- */
-
- $livraisonref = sanitize_string($livraison->ref);
- $filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref;
- $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
-
- $genallowed=$user->rights->expedition->livraison->creer;
- $delallowed=$user->rights->expedition->livraison->supprimer;
-
- $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
-
- /*
- * D�j� livre
- */
- $sql = "SELECT ld.fk_product, ld.description, ld.qty as qty_shipped, ld.fk_livraison as livraison_id";
- $sql.= ", l.ref, ".$db->pdate("l.date_livraison")." as date_livraison";
- $sql.= ", cd.rowid, cd.qty as qty_commande";
- $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
- $sql.= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
- $sql.= " WHERE l.rowid <> ".$livraison->id;
- $sql.= " AND cd.rowid = ld.fk_origin_line";
- $sql.= " AND ld.fk_livraison = l.rowid";
- $sql.= " AND l.fk_statut > 0";
- $sql.= " ORDER BY cd.fk_product";
-
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
-
- if ($num)
- {
- print ' ';
-
- print_titre($langs->trans("OtherSendingsForSameOrder"));
- print '';
- print '';
- print '| '.$langs->trans("Sending").' | ';
- print ''.$langs->trans("Description").' | ';
- print ''.$langs->trans("QtyShipped").' | ';
- print ''.$langs->trans("Date").' | ';
- print " \n";
-
- $var=True;
- while ($i < $num)
- {
- $var=!$var;
- $objp = $db->fetch_object($resql);
- print "";
- print '| '.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' | ';
- if ($objp->fk_product > 0)
- {
- $product = new Product($db);
- $product->fetch($objp->fk_product);
-
- print '';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
- if ($objp->description) print nl2br($objp->description);
- print ' | ';
- }
- else
- {
- print "".stripslashes(nl2br($objp->description))." | \n";
- }
- print ''.$objp->qty_shipped.' | ';
- print ''.dolibarr_print_date($objp->date_livraison,"dayhour").' | ';
- print ' ';
- $i++;
- }
-
- print ' ';
- }
- $db->free($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
-
- print ' | ';
+ if ( $livraison->id > 0)
+ {
+ $soc = new Societe($db);
+ $soc->fetch($livraison->socid);
+
+ $h=0;
+ if ($conf->expedition_bon->enabled)
+ {
+ $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$livraison->expedition_id;
+ $head[$h][1] = $langs->trans("SendingCard");
+ $h++;
+ }
+
+ $head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
+ $head[$h][1] = $langs->trans("DeliveryCard");
+ $hselected = $h;
+ $h++;
+
+ dolibarr_fiche_head($head, $hselected, $langs->trans("Sending"));
+
+ /*
+ * Confirmation de la suppression
+ *
+ */
+ if ($_GET["action"] == 'delete')
+ {
+ $expedition_id = $_GET["expid"];
+ $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous s�r de vouloir supprimer ce bon de livraison ?','confirm_delete');
+ print ' ';
+ }
+
+ /*
+ * Confirmation de la validation
+ *
+ */
+ if ($_GET["action"] == 'valid')
+ {
+ $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid');
+ print ' ';
+ }
+
+
+ /*
+ * Livraison
+ */
+ print '';
+
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print ''.$livraison->ref.' | ';
+
+ // Client
+ print '| '.$langs->trans("Customer").' | ';
+ print ''.$soc->getNomUrl(1).' | ';
+ print " ";
+
+ // Document origine
+ if ($conf->commande->enabled)
+ {
+ print '| '.$langs->trans("RefOrder").' | ';
+ $order=new Commande($db);
+ $order->fetch($livraison->origin_id);
+ print '';
+ print $order->getNomUrl(1,4);
+ print " | \n";
+ print ' ';
+ }
+ else
+ {
+ $propal=new Propal($db);
+ $propal->fetch($livraison->origin_id);
+ print '| '.$langs->trans("RefProposal").' | ';
+ print '';
+ print $propal->getNomUrl(1,'expedition');
+ print " | \n";
+ print ' ';
+ }
+
+ // Ref client
+ print '| '.$langs->trans("RefCustomer").' | ';
+ print ''.$livraison->ref_client." | \n";
+ print ' ';
+
+ // Date
+ print '| '.$langs->trans("Date").' | ';
+ print ''.dolibarr_print_date($livraison->date_creation,'dayhourtext')." | \n";
+ print ' ';
+
+ // Statut
+ print '| '.$langs->trans("Status").' | ';
+ print ''.$livraison->getLibStatut(4)." | \n";
+ print ' ';
+
+ if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+ {
+ // Entrepot
+ $entrepot = new Entrepot($db);
+ $entrepot->fetch($livraison->entrepot_id);
+ print '| '.$langs->trans("Warehouse").' | ';
+ print ''.$entrepot->libelle.' | ';
+ print ' ';
+ }
+
+ print " \n";
+
+ /*
+ * Lignes produits
+ */
+ print '
';
+
+ $num_prod = sizeof($livraison->lignes);
+
+ if ($num_prod)
+ {
+ $i = 0;
+
+ print '';
+ print '| '.$langs->trans("Products").' | ';
+ print ''.$langs->trans("QtyOrdered").' | ';
+ print ''.$langs->trans("QtyReceived").' | ';
+ print " \n";
+
+ $var=true;
+ while ($i < $num_prod)
+ {
+ $var=!$var;
+ print "";
+ if ($livraison->lignes[$i]->fk_product > 0)
+ {
+ $product = new Product($db);
+ $product->fetch($livraison->lignes[$i]->fk_product);
+
+ print '';
+ print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
+ if ($livraison->lignes[$i]->description) print ' '.$livraison->lignes[$i]->description;
+ print ' | ';
+ }
+ else
+ {
+ print "".$livraison->lignes[$i]->description." | \n";
+ }
+
+ print ''.$livraison->lignes[$i]->qty_asked.' | ';
+ print ''.$livraison->lignes[$i]->qty_shipped.' | ';
+
+ print " ";
+
+ $i++;
+ }
+ }
+
+ print " \n";
+
+ print "\n\n";
+
+
+ /*
+ * Boutons actions
+ */
+
+ if ($user->societe_id == 0)
+ {
+ print '';
+
+ if (! eregi('^(valid|delete)',$_REQUEST["action"]))
+ {
+ if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
+ {
+ print ' '.$langs->trans("Validate").'';
+ }
+
+ if ($livraison->brouillon && $user->rights->expedition->livraison->supprimer)
+ {
+ if ($conf->expedition_bon->enabled)
+ {
+ print ' '.$langs->trans("Delete").'';
+ }
+ else
+ {
+ print ' '.$langs->trans("Delete").'';
+ }
+ }
+ }
+
+ print ' ';
+ }
+ print "\n";
+
+ print "";
+
+ /*
+ * Documents g�n�r�s
+ */
+
+ $livraisonref = sanitize_string($livraison->ref);
+ $filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref;
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
+
+ $genallowed=$user->rights->expedition->livraison->creer;
+ $delallowed=$user->rights->expedition->livraison->supprimer;
+
+ $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
+
+ /*
+ * D�j� livre
+ */
+ $sql = "SELECT ld.fk_product, ld.description, ld.qty as qty_shipped, ld.fk_livraison as livraison_id";
+ $sql.= ", l.ref, ".$db->pdate("l.date_livraison")." as date_livraison";
+ $sql.= ", cd.rowid, cd.qty as qty_commande";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
+ $sql.= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
+ $sql.= " WHERE l.rowid <> ".$livraison->id;
+ $sql.= " AND cd.rowid = ld.fk_origin_line";
+ $sql.= " AND ld.fk_livraison = l.rowid";
+ $sql.= " AND l.fk_statut > 0";
+ $sql.= " ORDER BY cd.fk_product";
+
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ if ($num)
+ {
+ print ' ';
+
+ print_titre($langs->trans("OtherSendingsForSameOrder"));
+ print '';
+ print '';
+ print '| '.$langs->trans("Sending").' | ';
+ print ''.$langs->trans("Description").' | ';
+ print ''.$langs->trans("QtyShipped").' | ';
+ print ''.$langs->trans("Date").' | ';
+ print " \n";
+
+ $var=True;
+ while ($i < $num)
+ {
+ $var=!$var;
+ $objp = $db->fetch_object($resql);
+ print "";
+ print '| '.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' | ';
+ if ($objp->fk_product > 0)
+ {
+ $product = new Product($db);
+ $product->fetch($objp->fk_product);
+
+ print '';
+ print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
+ if ($objp->description) print nl2br($objp->description);
+ print ' | ';
+ }
+ else
+ {
+ print "".stripslashes(nl2br($objp->description))." | \n";
+ }
+ print ''.$objp->qty_shipped.' | ';
+ print ''.dolibarr_print_date($objp->date_livraison,"dayhour").' | ';
+ print ' ';
+ $i++;
+ }
+
+ print ' ';
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+ print ' | ';
// Rien � droite
-
+
print ' | ';
}
else
@@ -642,10 +651,10 @@ else
}
}
else
- {
- /* Expedition non trouv�e */
- print "Expedition inexistante ou acc�s refus�";
- }
+ {
+ /* Expedition non trouv�e */
+ print "Expedition inexistante ou acc�s refus�";
+ }
}
$db->close();
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index 304ac860571..1b941dff72b 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -1890,7 +1890,11 @@ class Propal extends CommonObject
{
$lien = '';
}
- $lienfin='';
+ if($option == 'expedition')
+ {
+ $lien = '';
+ }
+ $lienfin='';
$picto='order';
$label=$langs->trans("ShowPropal").': '.$this->ref;
|