Fix compatibility with date_delivery

This commit is contained in:
Laurent Destailleur 2020-11-11 18:08:40 +01:00
parent a804ad4914
commit 90884d8085
13 changed files with 60 additions and 10 deletions

View File

@ -184,6 +184,7 @@ if (empty($reshook))
if ($difference != 0)
{
$object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
foreach ($object->lines as $line)
{
if (isset($line->date_start)) $line->date_start = $line->date_start + $difference;

View File

@ -152,9 +152,15 @@ class Propal extends CommonObject
public $datep;
/**
* @var integer|string $delivery_date;
* @var int Date expected for delivery
* @deprecated
*/
public $delivery_date;
public $date_livraison; // deprecated; Use delivery_date instead.
/**
* @var integer|string $delivery_date;
*/
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
public $fin_validite;
@ -1518,6 +1524,7 @@ class Propal extends CommonObject
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->delivery_date = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->availability_id = $obj->fk_availability;
$this->availability_code = $obj->availability_code;
@ -2104,6 +2111,7 @@ class Propal extends CommonObject
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->date_delivery = $delivery_date;
}
if (!$notrigger && empty($error))

View File

@ -275,6 +275,7 @@ if (empty($reshook))
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison;
$object->delivery_date = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');

View File

@ -180,6 +180,12 @@ class Commande extends CommonOrder
*/
public $date_commande;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
@ -1354,6 +1360,7 @@ class Commande extends CommonOrder
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->delivery_date = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->warehouse_id = $object->warehouse_id;
$this->fk_delivery_address = $object->fk_delivery_address;
@ -1864,6 +1871,7 @@ class Commande extends CommonOrder
$this->demand_reason_id = $obj->fk_input_reason;
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->delivery_date = $this->db->jdate($obj->date_livraison);
$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;
$this->fk_delivery_address = $obj->fk_delivery_address;
@ -2595,6 +2603,7 @@ class Commande extends CommonOrder
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
}
if (!$notrigger && empty($error))
@ -3495,7 +3504,9 @@ 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 ($generic_commande->hasDelay()) {
$response->nbtodolate++;

View File

@ -932,6 +932,7 @@ if ($resql)
$generic_commande->billed = $obj->billed;
$generic_commande->date = $db->jdate($obj->date_commande);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery);
$generic_commande->delivery_date = $db->jdate($obj->date_delivery);
$generic_commande->ref_client = $obj->ref_client;
$generic_commande->total_ht = $obj->total_ht;
$generic_commande->total_tva = $obj->total_tva;

View File

@ -115,6 +115,14 @@ class Facture extends CommonInvoice
public $date; // Date invoice
public $datem;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
* @var string customer ref
*/
@ -1331,6 +1339,7 @@ class Facture extends CommonInvoice
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->delivery_date = $object->date_livraison;
$this->fk_delivery_address = $object->fk_delivery_address; // deprecated
$this->contact_id = $object->contact_id;
$this->ref_client = $object->ref_client;

View File

@ -86,7 +86,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql .= " s.code_client, s.code_fournisseur, s.email,";
$sql .= " s.logo,";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison as delivery_date, ";
$sql .= " c.total_ht,";
$sql .= " c.tva as total_tva,";
$sql .= " c.total_ttc,";
@ -112,10 +112,11 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$date = $this->db->jdate($objp->date_commande);
$delivery_date = $this->db->jdate($objp->date_livraison);
$delivery_date = $this->db->jdate($objp->delivery_date);
$datem = $this->db->jdate($objp->tms);
$supplierorderstatic->date_livraison = $delivery_date;
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;

View File

@ -296,6 +296,11 @@ abstract class CommonObject
*/
public $cond_reglement_id;
/**
* @var int Demand reason ID
*/
public $demand_reason_id;
/**
* @var int Transport mode ID (For module intracomm report)
* @see setTransportMode()

View File

@ -114,6 +114,12 @@ class CommandeFournisseur extends CommonOrder
public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set
public $date_commande;
/**
* @var int Date expected for delivery
* @deprecated See delivery_date
*/
public $date_livraison;
/**
* Delivery date
*/
@ -313,7 +319,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= " c.localtax1, c.localtax2, ";
$sql .= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,";
$sql .= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
$sql .= " c.date_commande as date_commande, c.date_livraison as delivery_date, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
$sql .= " c.fk_account,";
$sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,";
$sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,";
@ -369,7 +375,8 @@ 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->date_livraison);
$this->date_livraison = $this->db->jdate($obj->delivery_date);
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->remise_percent = $obj->remise_percent;
$this->methode_commande_id = $obj->fk_input_method;
$this->methode_commande = $obj->methode_commande;
@ -2313,6 +2320,7 @@ class CommandeFournisseur extends CommonOrder
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
}
if (!$notrigger && empty($error))
@ -2918,6 +2926,7 @@ class CommandeFournisseur extends CommonOrder
$response->nbtodo++;
$commandestatic->date_livraison = $this->db->jdate($obj->delivery_date);
$commandestatic->delivery_date = $this->db->jdate($obj->delivery_date);
$commandestatic->date_commande = $this->db->jdate($obj->date_commande);
$commandestatic->statut = $obj->fk_statut;

View File

@ -1146,6 +1146,7 @@ if (empty($reshook))
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->date_livraison = $datelivraison;
$object->delivery_date = $datelivraison;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');

View File

@ -258,6 +258,7 @@ if (empty($reshook))
if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) {
$object->ref = GETPOST('ref');
$object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
@ -279,6 +280,7 @@ 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');
$object->cond_reglement_id = GETPOST('cond_reglement_id');

View File

@ -1201,7 +1201,7 @@ class SupplierProposal extends CommonObject
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_valid as datev";
$sql .= ", p.date_livraison as date_livraison";
$sql .= ", p.date_livraison as delivery_date";
$sql .= ", p.model_pdf, p.extraparams";
$sql .= ", p.note_private, p.note_public";
$sql .= ", p.fk_projet as fk_project, p.fk_statut";
@ -1256,7 +1256,8 @@ class SupplierProposal extends CommonObject
$this->datev = $this->db->jdate($obj->datev); // TODO deprecated
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->date_livraison = $this->db->jdate($obj->delivery_date);
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->mode_reglement_id = $obj->fk_mode_reglement;

View File

@ -464,7 +464,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
'mode_reglement_code' => $order->mode_reglement_code,
'mode_reglement' => $order->mode_reglement,
'date_livraison' => $order->date_livraison,
'date_livraison' => $order->delivery_date,
'demand_reason_id' => $order->demand_reason_id,
'demand_reason_code' => $order->demand_reason_code,
@ -621,7 +621,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
'mode_reglement' => $order->mode_reglement,
'mode_reglement_code' => $order->mode_reglement_code,
'date_livraison' => $order->date_livraison,
'date_livraison' => $order->delivery_date,
'demand_reason_id' => $order->demand_reason_id,
'demand_reason_code' => $order->demand_reason_code,