diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index da24e1360de..fbaba482c50 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -255,6 +255,7 @@ if (empty($reshook))
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
+ $object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
$object->contactid = GETPOST('contactid');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
@@ -549,6 +550,14 @@ if (empty($reshook))
}
}
+ // warehouse
+ else if ($action == 'setwarehouse' && $user->rights->commande->creer) {
+ $result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
$result = $object->set_remise($user, GETPOST('remise_percent'));
}
@@ -1311,6 +1320,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
$shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0));
+ $warehouse_id = (! empty($objectsrc->warehouse_id)?$objectsrc->warehouse_id:(! empty($soc->warehouse_id)?$soc->warehouse_id:0));
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
@@ -1332,6 +1342,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$fk_account = $soc->fk_account;
$availability_id = $soc->availability_id;
$shipping_method_id = $soc->shipping_method_id;
+ $warehouse_id = $soc->warehouse_id;
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
@@ -1464,6 +1475,15 @@ if ($action == 'create' && $user->rights->commande->creer)
print '';
}
+ // Warehouse
+ if (! empty($conf->expedition->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 '
| ' . $langs->trans('Warehouse') . ' | ';
+ print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1);
+ print ' |
';
+ }
+
// What trigger creation
print '| ' . $langs->trans('Source') . ' | ';
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
@@ -1976,6 +1996,27 @@ if ($action == 'create' && $user->rights->commande->creer)
print ' |
';
}
+ // Warehouse
+ if (! empty($conf->expedition->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 '';
+ print ' | ';
+ if ($action == 'editwarehouse') {
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
+ } else {
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
+ }
+ print ' | ';
+ print '
';
+ }
+
// Terms of payment
print '| ';
print ' |