diff --git a/ChangeLog b/ChangeLog index e2aab3a651b..4bbad14be7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,11 +19,12 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT. +* The duplicated and deprecated property ->date_livraison that was renamed into ->delivery_date has been completely removed. * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog() -* Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically - when an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order), because this setup has changed. -* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this variables are no more defined globaly). +* Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically when + an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order), because this setup has changed. +* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this 2 variables are no more defined globaly). diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 986b32d5cac..7624d393ed7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -196,7 +196,7 @@ if (empty($reshook)) { GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int') ); - $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + $date_delivery_old = $object->delivery_date; if (!empty($date_delivery_old) && !empty($date_delivery)) { //Attempt to get the date without possible hour rounding errors $old_date_delivery = dol_mktime( @@ -210,7 +210,6 @@ if (empty($reshook)) { //Calculate the difference and apply if necessary $difference = $date_delivery - $old_date_delivery; if ($difference != 0) { - $object->date_livraison = $date_delivery; $object->delivery_date = $date_delivery; foreach ($object->lines as $line) { if (isset($line->date_start)) { @@ -418,7 +417,6 @@ if (empty($reshook)) { $object->ref = GETPOST('ref'); $object->datep = $datep; $object->date = $datep; - $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); @@ -451,7 +449,6 @@ if (empty($reshook)) { $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; $object->date = $datep; - $object->date_livraison = $date_delivery; $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); @@ -1968,8 +1965,8 @@ if ($action == 'create') { print ''.$langs->trans("DeliveryDate").''; print ''; print img_picto('', 'action', 'class="pictofixedwidth"'); - if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty + $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ea8f3cf06f6..ce2099ad375 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -224,9 +224,12 @@ class Propal extends CommonObject */ public $total; - public $cond_reglement_code; - public $cond_reglement_doc; - public $mode_reglement_code; + public $cond_reglement_code; // code + public $cond_reglement; // label + public $cond_reglement_doc; // label doc + + public $mode_reglement_code; // code + public $mode_reglement; // label public $deposit_percent; @@ -272,8 +275,9 @@ class Propal extends CommonObject public $duree_validite; - public $demand_reason_id; - public $demand_reason_code; + public $demand_reason_id; // id + public $demand_reason_code; // code + public $demand_reason; // label public $warehouse_id; @@ -1108,7 +1112,7 @@ class Propal extends CommonObject } // Set tmp vars - $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + $delivery_date = $this->delivery_date; dol_syslog(get_class($this)."::create"); @@ -1684,7 +1688,6 @@ class Propal extends CommonObject $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); - $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; @@ -2277,7 +2280,6 @@ class Propal extends CommonObject if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $delivery_date; $this->delivery_date = $delivery_date; } @@ -2400,7 +2402,7 @@ class Propal extends CommonObject if (!$error) { $this->oldcopy = clone $this; - $this->fk_input_reason = $id; + $this->demand_reason_id = $id; } @@ -3298,7 +3300,7 @@ class Propal extends CommonObject // phpcs:enable global $user; - if ($this->statut >= self::STATUS_DRAFT) { + if ($this->status >= self::STATUS_DRAFT) { $error = 0; $this->db->begin(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f743ac07287..bbfe0a544bc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -291,7 +291,6 @@ if (empty($reshook)) { $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); - $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); @@ -1708,9 +1707,6 @@ if ($action == 'create' && $usercancreate) { $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ? -1 : ''; $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); - if (empty($date_delivery)) { - $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); - } if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4404bc347f9..9454d8ce94b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -913,7 +913,7 @@ class Commande extends CommonOrder // Set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); - $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + $delivery_date = $this->delivery_date; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { @@ -1388,12 +1388,11 @@ class Commande extends CommonOrder $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; // deprecated - $this->delivery_date = $object->date_livraison; + $this->delivery_date = $object->delivery_date; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; $this->fk_delivery_address = $object->fk_delivery_address; - $this->contact_id = $object->contact_id; + $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; $this->ref_customer = $object->ref_client; @@ -1964,7 +1963,6 @@ class Commande extends CommonOrder $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; @@ -2698,7 +2696,6 @@ class Commande extends CommonOrder if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $delivery_date; $this->delivery_date = $delivery_date; } @@ -3362,7 +3359,7 @@ class Commande extends CommonOrder if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } - $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + $delivery_date = $this->delivery_date; // Check parameters // Put here code to add control on parameters values @@ -3644,7 +3641,6 @@ class Commande extends CommonOrder $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); $generic_commande->date = $this->db->jdate($obj->date_commande); - $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); $generic_commande->delivery_date = $this->db->jdate($obj->delivery_date); if ($mode == 'toship' && $generic_commande->hasDelay()) { @@ -4216,9 +4212,9 @@ class Commande extends CommonOrder global $conf, $langs; if (empty($this->delivery_date)) { - $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + $text = $langs->trans("OrderDate").' '.dol_print_date($this->date, 'day'); } else { - $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day'); + $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->delivery_date, 'day'); } $text .= ' '.($conf->commande->client->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->client->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index da073278bca..538fdcfb36b 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1474,7 +1474,6 @@ if ($resql) { $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); - $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->c_total_ht; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a023542bd8f..321a47d3aa1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1430,8 +1430,7 @@ class Facture extends CommonInvoice $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->delivery_date = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); - $this->date_livraison = $object->delivery_date; // deprecated + $this->delivery_date = $object->delivery_date; $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; @@ -1566,8 +1565,7 @@ class Facture extends CommonInvoice $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->delivery_date = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); - $this->date_livraison = $object->delivery_date; // deprecated + $this->delivery_date = $object->delivery_date; $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 677b55e45a6..1e0e9c644c7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8080,24 +8080,20 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null); $substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null); - if ($object->element == "shipping") { - $substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', 0, $outputlangs) : ''); - } else { - $substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - } - $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%d") : ''); - $substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%A") : ''); - $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%m") : ''); - $substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%b") : ''); - $substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%Y") : ''); - $substitutionarray['__DATE_DELIVERY_HH__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%H") : ''); - $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%M") : ''); - $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%S") : ''); + $substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', 0, $outputlangs) : ''); + $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%d") : ''); + $substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%A") : ''); + $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%m") : ''); + $substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%b") : ''); + $substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%Y") : ''); + $substitutionarray['__DATE_DELIVERY_HH__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%H") : ''); + $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%M") : ''); + $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%S") : ''); // For backward compatibility (deprecated) $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); - $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); + $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->delivery_date) ? dol_print_date($object->delivery_date, 'day', 0, $outputlangs) : ''); $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : ''); if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0) { diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index e48b4c0cc15..b84e4a29041 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -859,7 +859,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) { + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -867,7 +867,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6f251175786..754cac9dfeb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -447,7 +447,6 @@ class CommandeFournisseur extends CommonOrder } else { $this->date = $this->date_creation; } - $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; @@ -1417,7 +1416,7 @@ class CommandeFournisseur extends CommonOrder if (empty($date)) { $date = $now; } - $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + $delivery_date = $this->delivery_date; // Clean parameters if (empty($this->source)) { @@ -2609,7 +2608,6 @@ class CommandeFournisseur extends CommonOrder if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $delivery_date; $this->delivery_date = $delivery_date; } @@ -3396,10 +3394,6 @@ class CommandeFournisseur extends CommonOrder { global $conf; - if (empty($this->delivery_date) && !empty($this->date_livraison)) { - $this->delivery_date = $this->date_livraison; // For backward compatibility - } - if ($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY) { $now = dol_now(); if (!empty($this->delivery_date)) { @@ -3429,10 +3423,6 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (empty($this->delivery_date) && !empty($this->date_livraison)) { - $this->delivery_date = $this->date_livraison; // For backward compatibility - } - $text = ''; if ($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8744c59bf17..abb0756692e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1241,7 +1241,6 @@ 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; // deprecated $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -1295,7 +1294,7 @@ if (empty($reshook)) { dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison); + $tmpdate = $srcobject->delivery_date; $object->setDeliveryDate($user, $tmpdate); $object->set_id_projet($user, $srcobject->fk_project); @@ -1637,7 +1636,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 : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); + $datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0258622e476..2986d9e0c79 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -776,7 +776,7 @@ if ($sall) { $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.email,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_livraison,cf.date_valid, cf.date_approve,"; +$sql .= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as delivery_date, cf.date_valid, cf.date_approve,"; $sql .= ' cf.localtax1 as total_localtax1, cf.localtax2 as total_localtax2,'; $sql .= ' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.multicurrency_total_ht, cf.multicurrency_total_tva, cf.multicurrency_total_ttc,'; $sql .= ' cf.date_creation as date_creation, cf.tms as date_update,'; @@ -1713,7 +1713,7 @@ if ($resql) { $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; $objectstatic->date_commande = $db->jdate($obj->date_commande); - $objectstatic->delivery_date = $db->jdate($obj->date_livraison); + $objectstatic->delivery_date = $db->jdate($obj->delivery_date); $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; $objectstatic->statut = $obj->fk_statut; @@ -1895,7 +1895,7 @@ if ($resql) { // Plannned date of delivery if (!empty($arrayfields['cf.date_livraison']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), 'day'); + print dol_print_date($db->jdate($obj->delivery_date), 'day'); if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) { if ($objectstatic->hasDelay()) { print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 0f7515ebbdd..76b2cb3e6a6 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -139,8 +139,8 @@ if ($id > 0 || !empty($ref)) { if ($user->hasRight('commande', 'lire')) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.ref_client,"; - $sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty"; - $sql .= ", c.date_livraison"; + $sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty,"; + $sql .= " c.date_livraison as delivery_date"; if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user "; } @@ -231,11 +231,11 @@ if ($id > 0 || !empty($ref)) { print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre("OrderDate", $_SERVER["PHP_SELF"], "c.date_commande", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('DateDeliveryPlanned', $_SERVER['PHP_SELF'], 'c.date_livraison', '', $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "c.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("OrderDate", $_SERVER["PHP_SELF"], "c.date_commande", "", $option, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('DateDeliveryPlanned', $_SERVER['PHP_SELF'], 'c.date_livraison', '', $option, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "c.total_ht", "", $option, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, '', $sortfield, $sortorder, 'right '); print "\n"; if ($num > 0) { @@ -260,7 +260,7 @@ if ($id > 0 || !empty($ref)) { print dol_print_date($db->jdate($objp->date_commande), 'dayhour').""; // delivery planned date print ''; - print dol_print_date($db->jdate($objp->date_livraison), 'dayhour'); + print dol_print_date($db->jdate($objp->delivery_date), 'dayhour'); print ''; print ''.$objp->qty."\n"; print ''.price($objp->total_ht)."\n"; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 6db4f7d7474..742175c8f9b 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -139,8 +139,8 @@ if ($id > 0 || !empty($ref)) { if ($user->hasRight('fournisseur', 'commande', 'lire')) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; - $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty"; - $sql .= ", c.date_livraison"; + $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty,"; + $sql .= " c.date_livraison as delivery_date"; if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user "; } @@ -260,7 +260,7 @@ if ($id > 0 || !empty($ref)) { print dol_print_date($db->jdate($objp->date_commande), 'dayhour').""; // delivery planned date print ''; - print dol_print_date($db->jdate($objp->date_livraison), 'dayhour'); + print dol_print_date($db->jdate($objp->delivery_date), 'dayhour'); print ''; print ''.$objp->qty."\n"; print ''.price($objp->total_ht)."\n"; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index bf94b96c906..b7f3c574da2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -281,7 +281,6 @@ if (empty($reshook)) { if (GETPOST('createmode') == 'copy' && GETPOST('copie_supplier_proposal')) { if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); @@ -301,7 +300,6 @@ if (empty($reshook)) { } } else { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; $object->delivery_date = $date_delivery; $object->demand_reason_id = GETPOST('demand_reason_id'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); @@ -1341,8 +1339,8 @@ if ($action == 'create') { print ''; print img_picto('', 'action', 'class="pictofixedwidth"'); $datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + if (in_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty + $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 5c281dd0ccd..68e1f0ff453 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -899,7 +899,7 @@ class SupplierProposal extends CommonObject } // Set tmp vars - $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + $delivery_date = $this->delivery_date; // Multicurrency if (!empty($this->multicurrency_code)) { @@ -1261,7 +1261,6 @@ class SupplierProposal extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); // Creation date $this->date = $this->date_creation; $this->date_validation = $this->db->jdate($obj->datev); // Validation date - $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; @@ -1533,7 +1532,6 @@ class SupplierProposal extends CommonObject $sql .= " WHERE rowid = ".((int) $this->id); if ($this->db->query($sql)) { - $this->date_livraison = $delivery_date; $this->delivery_date = $delivery_date; return 1; } else {