diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 82bf1d01e6a..50a231c0898 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -123,6 +123,12 @@ if ($action == 'setshippingmethod' && $user->rights->commande->creer) { $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int')); } +// warehouse +if ($action == 'setwarehouse' && $user->rights->commande->creer) { + $commande = new Commande($db); + $commande->fetch($id); + $result = $commande->setWarehouse(GETPOST('warehouse_id', 'int')); +} /* @@ -164,8 +170,8 @@ if ($id > 0 || ! empty($ref)) } // Onglet commande - $nbrow=8; - if (! empty($conf->projet->enabled)) $nbrow++; + //$nbrow=8; + //if (! empty($conf->projet->enabled)) $nbrow++; print ''; @@ -286,6 +292,27 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + // Warehouse + if (! empty($conf->stock->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct=new FormProduct($db); + print ''; + print ''; + } + // Terms of payment print '
'; + print ''; + if ($action != 'editwarehouse' && $user->rights->commande->creer) + print ''; + print '
'; + print $langs->trans('Warehouse'); + print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; + print '
'; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1); + } else { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none'); + } + print '
'; print ''; + print ''; // Qty already shipped $qtyProdCom=$objp->qty; @@ -677,7 +704,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("WarehouseSource").''; print '
'; @@ -529,7 +556,7 @@ if ($id > 0 || ! empty($ref)) } // Qty ordered - print ''.$objp->qty.'' . ($objp->qty!=1?''.$objp->qty.'':$objp->qty) . ''; - print $formproduct->selectWarehouses(-1,'entrepot_id','',1); + print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1,'entrepot_id','',1); if (count($formproduct->cache_warehouses) <= 0) { print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").'';