';
- //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
+ $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print "
\n";
print '
';
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 09cec584c43..77a62bf8561 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
-$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,";
+$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,";
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@@ -618,6 +618,7 @@ if ($resql)
$object = new Expedition($db);
$object->fetch($obj->rowid);
+
print '
';
// Ref
@@ -705,7 +706,7 @@ if ($resql)
if (!empty($arrayfields['e.date_delivery']['checked']))
{
print '
';
@@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref))
print '';
} else {
- print dol_print_date($object->date_livraison, 'dayhour');
- if ($object->hasDelay() && !empty($object->date_livraison)) {
+ print dol_print_date($object->delivery_date, 'dayhour');
+ if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 2bc539ea07e..5f2771594de 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -375,7 +375,7 @@ class CommandeFournisseur extends CommonOrder
$this->date_approve = $this->db->jdate($obj->date_approve);
$this->date_approve2 = $this->db->jdate($obj->date_approve2);
$this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier
- $this->date_livraison = $this->db->jdate($obj->delivery_date);
+ $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->remise_percent = $obj->remise_percent;
$this->methode_commande_id = $obj->fk_input_method;
@@ -778,16 +778,24 @@ class CommandeFournisseur extends CommonOrder
if (isset($this->statut)) {
$label .= ' '.$this->getLibStatut(5);
}
- if (!empty($this->ref))
+ if (!empty($this->ref)) {
$label .= ' '.$langs->trans('Ref').': '.$this->ref;
- if (!empty($this->ref_supplier))
+ }
+ if (!empty($this->ref_supplier)) {
$label .= ' '.$langs->trans('RefSupplier').': '.$this->ref_supplier;
- if (!empty($this->total_ht))
+ }
+ if (!empty($this->total_ht)) {
$label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- if (!empty($this->total_tva))
+ }
+ if (!empty($this->total_tva)) {
$label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- if (!empty($this->total_ttc))
+ }
+ if (!empty($this->total_ttc)) {
$label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->delivery_date)) {
+ $label .= ' '.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
+ }
}
$picto = 'order';
@@ -1257,9 +1265,10 @@ class CommandeFournisseur extends CommonOrder
$error = 0;
$now = dol_now();
- // $date_commande is deprecated
+ // set tmp vars
$date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set
if (empty($date)) $date = $now;
+ $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Clean parameters
if (empty($this->source)) $this->source = 0;
@@ -1308,7 +1317,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= ", ".$this->socid;
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", '".$this->db->idate($date)."'";
- $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null");
+ $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
$sql .= ", ".$user->id;
$sql .= ", ".self::STATUS_DRAFT;
$sql .= ", ".$this->db->escape($this->source);
@@ -2925,7 +2934,7 @@ class CommandeFournisseur extends CommonOrder
{
$response->nbtodo++;
- $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date);
+ $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$commandestatic->delivery_date = $this->db->jdate($obj->delivery_date);
$commandestatic->date_commande = $this->db->jdate($obj->date_commande);
$commandestatic->statut = $obj->fk_statut;
@@ -3079,10 +3088,10 @@ class CommandeFournisseur extends CommonOrder
{
global $conf;
- if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
+ if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility
$now = dol_now();
- $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery;
+ $date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date;
return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
}
@@ -3096,9 +3105,9 @@ class CommandeFournisseur extends CommonOrder
{
global $conf, $langs;
- if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
+ if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility
- if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
+ if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day');
$text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today");
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index ad4662a156c..b4f3570ff34 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1145,7 +1145,7 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
- $object->date_livraison = $datelivraison;
+ $object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@@ -1200,7 +1200,8 @@ if (empty($reshook))
$result = $srcobject->fetch($object->origin_id);
if ($result > 0)
{
- $object->setDeliveryDate($user, $srcobject->date_livraison);
+ $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison);
+ $object->setDeliveryDate($user, $tmpdate);
$object->set_id_projet($user, $srcobject->fk_project);
$lines = $srcobject->lines;
@@ -1552,7 +1553,7 @@ if ($action == 'create')
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '';
- $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
+ $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''));
if (!empty($conf->multicurrency->enabled))
{
@@ -2161,14 +2162,14 @@ if ($action == 'create')
print '';
$usehourmin = 0;
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1;
- print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
+ print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
print '';
print '';
} else {
$usehourmin = 'day';
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour';
- print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' ';
- if ($object->hasDelay() && !empty($object->date_livraison)) {
+ print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' ';
+ if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 7b41e7030b1..a77606abb3f 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -2068,8 +2068,8 @@ function migrate_commande_livraison($db, $langs, $conf)
$db->begin();
- $sql = "SELECT l.rowid, l.fk_commande";
- $sql .= ", c.ref_client, c.date_livraison";
+ $sql = "SELECT l.rowid, l.fk_commande,";
+ $sql .= " c.ref_client, c.date_livraison as delivery_date";
$sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c";
$sql .= " WHERE c.rowid = l.fk_commande";
$resql = $db->query($sql);
@@ -2090,7 +2090,7 @@ function migrate_commande_livraison($db, $langs, $conf)
if ($resql2)
{
- $delivery_date = $db->jdate($obj->date_livraison);
+ $delivery_date = $db->jdate($obj->delivery_date);
$sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET";
$sqlu .= " ref_client='".$db->escape($obj->ref_client)."'";
@@ -3007,7 +3007,7 @@ function migrate_customerorder_shipping($db, $langs, $conf)
if ($db->query($sqlAdd1) && $db->query($sqlAdd2))
{
- $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison";
+ $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison as delivery_date";
$sqlSelect .= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sqlSelect .= ", ".MAIN_DB_PREFIX."element_element as el";
$sqlSelect .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = el.fk_source AND el.sourcetype = 'commande'";
@@ -3028,7 +3028,7 @@ function migrate_customerorder_shipping($db, $langs, $conf)
$sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
$sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'";
- $sqlUpdate .= ", date_delivery = '".$db->escape($obj->date_livraison ? $obj->date_livraison : 'null')."'";
+ $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'";
$sqlUpdate .= " WHERE rowid = ".$obj->shipping_id;
$result = $db->query($sqlUpdate);
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 62fc287fba3..169ffd327ad 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -111,6 +111,8 @@ $hookmanager->initHooks(array('receptioncard', 'globalcard'));
$permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php
//var_dump($object->lines[0]->detail_batch);
+$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int'));
+
/*
* Actions
@@ -226,8 +228,6 @@ if (empty($reshook))
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
- $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int'));
-
// On va boucler sur chaque ligne du document d'origine pour completer objet reception
// avec info diverses + qte a livrer
@@ -777,8 +777,7 @@ if ($action == 'create')
// 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
+ $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print "
\n";
print '
';
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index b99ba707251..4df73cce925 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -409,7 +409,7 @@ $formfile = new FormFile($db);
$helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
llxHeader('', $langs->trans('ListOfReceptions'), $helpurl);
-$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,";
+$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,";
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@@ -499,21 +499,21 @@ if ($resql)
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
- if ($sall) $param .= "&sall=".$sall;
- if ($search_ref_rcp) $param .= "&search_ref_rcp=".$search_ref_rcp;
- if ($search_ref_liv) $param .= "&search_ref_liv=".$search_ref_liv;
- if ($search_company) $param .= "&search_company=".$search_company;
- if ($optioncss != '') $param .= '&optioncss='.$optioncss;
- if ($search_billed != '' && $search_billed >= 0)$param .= "&search_billed=".$search_billed;
- if ($search_town) $param .= "&search_town=".$search_town;
- if ($search_zip) $param .= "&search_zip=".$search_zip;
- if ($search_state) $param .= "&search_state=".$search_state;
- if ($search_status) $param .= "&search_status=".$search_status;
- if ($search_country) $param .= "&search_country=".$search_country;
- if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty;
- if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier;
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+ if ($sall) $param .= "&sall=".urlencode($sall);
+ if ($search_ref_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
+ if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv);
+ if ($search_company) $param .= "&search_company=".urlencode($search_company);
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+ if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed);
+ if ($search_town) $param .= "&search_town=".urlencode($search_town);
+ if ($search_zip) $param .= "&search_zip=".urlencode($search_zip);
+ if ($search_state) $param .= "&search_state=".urlencode($search_state);
+ if ($search_status) $param .= "&search_status=".urlencode($search_status);
+ if ($search_country) $param .= "&search_country=".urlencode($search_country);
+ if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
+ if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
@@ -838,7 +838,7 @@ if ($resql)
if (!empty($arrayfields['e.date_delivery']['checked']))
{
print '