diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 22505f6b921..c407d80c727 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1609,7 +1609,7 @@ if ($action == 'create' && $usercancreate) {
$fk_account = $soc->fk_account;
$availability_id = 0;
$shipping_method_id = $soc->shipping_method_id;
- $warehouse_id = $soc->warehouse_id;
+ $warehouse_id = $soc->fk_warehouse;
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
@@ -1722,7 +1722,7 @@ if ($action == 'create' && $usercancreate) {
// Date delivery planned
print '
| '.$langs->trans("DateDeliveryPlanned").' | ';
print '';
- $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
+ $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
print " | \n";
print '
';
@@ -1803,7 +1803,10 @@ if ($action == 'create' && $usercancreate) {
}
// Other attributes
- $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
+ if (!empty($origin) && !empty($originid) && is_object($objectsrc))
+ $parameters['objectsrc'] = $objectsrc;
+ $parameters['socid'] = $socid;
+
// Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint;