diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index e91cf944843..27811f9688d 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -34,6 +34,11 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.php"); +if (!$conf->expedition->enabled && $conf->stock->enabled) +{ + require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); +} + $langs->load("bills"); @@ -61,10 +66,15 @@ if ($_POST["action"] == 'add') // Creation de l'objet livraison $livraison = new Livraison($db); - $livraison->date_livraison = time(); + $livraison->date_livraison = time(); $livraison->note = $_POST["note"]; $livraison->commande_id = $_POST["commande_id"]; + if (!$conf->expedition->enabled && $conf->stock->enabled) + { + $expedition->entrepot_id = $_POST["entrepot_id"]; + } + // On boucle sur chaque ligne de commande pour compléter objet livraison // avec qté ŕ livrer $commande = new Commande($db); @@ -164,7 +174,10 @@ if ($_GET["action"] == 'create') $author->id = $commande->user_author_id; $author->fetch(); - //$entrepot = new Entrepot($db); + if (!$conf->expedition->enabled && $conf->stock->enabled) + { + $entrepot = new Entrepot($db); + } /* * Commande @@ -172,7 +185,10 @@ if ($_GET["action"] == 'create') print '