";
+
+ /*
+ * Documents générés
+ */
- $livraisonref = sanitize_string($livraison->ref);
- $filedir = $conf->livraison->dir_output . '/' . $livraisonref;
- $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
+ $livraisonref = sanitize_string($livraison->ref);
+ $filedir = $conf->livraison->dir_output . '/' . $livraisonref;
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
- $genallowed=$user->rights->expedition->livraison->creer;
- $delallowed=$user->rights->expedition->livraison->supprimer;
- //$genallowed=1;
- //$delallowed=0;
+ $genallowed=$user->rights->expedition->livraison->creer;
+ $delallowed=$user->rights->expedition->livraison->supprimer;
+
+ $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
- $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_livre, 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 cd.fk_commande = ".$livraison->commande_id;
+ $sql.= " AND 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 ' ';
- /*
- * Déjà livre
- */
- $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande";
- $sql .= " , ld.qty as qty_livre, l.ref, ld.fk_livraison as livraison_id";
- $sql .= ",".$db->pdate("l.date_livraison")." as date_livraison";
- $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
- $sql .= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
- $sql .= " WHERE cd.fk_commande = ".$livraison->commande_id;
- $sql .= " AND l.rowid <> ".$livraison->id;
- $sql .= " AND cd.rowid = ld.fk_commande_ligne";
- $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)
+ 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)
{
- $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_livre.' | ';
- print ''.dolibarr_print_date($objp->date_livraison,"dayhour").' | ';
- print ' ';
- $i++;
- }
-
- print ' ';
- }
- $db->free($resql);
+ $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 {
- dolibarr_print_error($db);
+ else
+ {
+ print "".stripslashes(nl2br($objp->description))." | \n";
}
-
-
- print '';
+ print ' | '.$objp->qty_livre.' | ';
+ print ''.dolibarr_print_date($objp->date_livraison,"dayhour").' | ';
+ print ' ';
+ $i++;
+ }
+
+ print ' ';
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+ print ' | ';
// Rien à droite
-
- print ' |