diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 1a2aed2789b..520a0868959 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -48,13 +48,12 @@ $langs->load('stocks'); $langs->load('other'); $langs->load('propal'); -$origin = "expedition"; +$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal $origin_id = isset($_REQUEST["id"])?$_REQUEST["id"]:''; +if (empty($origin_id)) $origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal +if (empty($origin_id)) $origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal $id = $origin_id; -$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal -$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal - // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -539,58 +538,53 @@ if ($_GET["action"] == 'create') $quantityAsked = $line->qty; $quantityToBeDelivered = $quantityAsked - $quantityDelivered; - if ($conf->stock->enabled - //&& $line->product_type == 0 - ) + $defaultqty=0; + if ($_REQUEST["entrepot_id"]) { - $defaultqty=0; - if ($_REQUEST["entrepot_id"]) - { - //var_dump($product); - $stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real; - $stock+=0; // Convertit en numerique - $defaultqty=min($quantityToBeDelivered, $stock); - if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; - } + //var_dump($product); + $stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real; + $stock+=0; // Convertit en numerique + $defaultqty=min($quantityToBeDelivered, $stock); + if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; + } - // Quantity to send + // Quantity to send + print '