diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4764b53a5c9..54661297939 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -557,14 +557,17 @@ if (empty($reshook)) } } - elseif ($action == 'setdate_livraison' && $usercancreate) { - // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + elseif ($action == 'setdate_livraison' && $usercancreate) + { + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $result = $object->set_date_livraison($user, $datelivraison); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->fetch($id); + $result = $object->set_date_livraison($user, $datedelivery); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'setmode' && $usercancreate) { @@ -1681,15 +1684,14 @@ if ($action == 'create' && $usercancreate) print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print ''; - // Delivery date planed - print "".$langs->trans("DateDeliveryPlanned").''; - if (empty($datedelivery)) - { - if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - else $datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE_DELIVERY) ?-1 : ''; - } - print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); - print ""; + // Date delivery planned + print ''.$langs->trans("DateDeliveryPlanned").''; + print ''; + //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. + $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); + print "\n"; + print ''; // terms of the settlement print ''.$langs->trans('PaymentConditionsShort').''; @@ -2209,11 +2211,11 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); + print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : ' '; + print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; if ($object->hasDelay() && !empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3b83e04fe3c..8b7000d8f23 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1147,7 +1147,7 @@ if ($resql) if (!empty($arrayfields['c.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_delivery), 'day'); + print dol_print_date($db->jdate($obj->date_delivery), 'dayhour'); print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a0501c3dd99..0efd01fc10d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -713,7 +713,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 75ee2ef4da3..99cf77ce1f3 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -103,16 +103,17 @@ if (empty($reshook)) } if ($action == 'setdatedelivery' && $user->rights->commande->creer) - { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + { + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $object = new Commande($db); - $object->fetch($id); - $result = $object->set_date_livraison($user, $datelivraison); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->fetch($id); + $result = $object->set_date_livraison($user, $datedelivery); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } /* if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) { @@ -352,7 +353,7 @@ if ($id > 0 || !empty($ref)) // Date print ''.$langs->trans('Date').''; print ''; - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); if ($object->hasDelay() && empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } @@ -373,13 +374,13 @@ if ($id > 0 || !empty($ref)) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison > 0 ? $object->date_livraison : -1, 'liv_', '', '', '', "setdatedelivery"); + print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->date_livraison, 'dayhour'); if ($object->hasDelay() && !empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 782516353b2..a6a1870e807 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -33,4 +33,7 @@ -- For v13 +ALTER TABLE llx_commande MODIFY COLUMN date_livraison DATETIME; + ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 676e768c73b..aa237383452 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -64,8 +64,8 @@ create table llx_commande fk_currency varchar(3), -- currency code fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement - - date_livraison date default NULL, + + date_livraison datetime default NULL, fk_shipping_method integer, -- shipping method id fk_warehouse integer default NULL, fk_availability integer NULL,