diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 22505f6b921..1e6a33e8ae8 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; @@ -1698,7 +1698,7 @@ if ($action == 'create' && $usercancreate) { // Contacts (ask contact only if thirdparty already defined). print "".$langs->trans("DefaultContact").''; print img_picto('', 'contact', 'class="pictofixedwidth"'); - print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx'); + print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Ligne info remises tiers @@ -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,12 @@ if ($action == 'create' && $usercancreate) { } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); + $parameters = array(); + 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;