From 5035ad9be190a002069c0c74b2aff58db0aeea6a Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Wed, 15 Sep 2021 12:32:18 +0200 Subject: [PATCH 1/4] Explicit date_creation instead of date --- htdocs/fourn/class/fournisseur.commande.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 09a43fb95ab..2a8051e818c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -111,7 +111,7 @@ class CommandeFournisseur extends CommonOrder public $socid; public $fourn_id; - public $date; + public $date_creation; public $date_valid; public $date_approve; public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set @@ -375,7 +375,7 @@ class CommandeFournisseur extends CommonOrder $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total_ttc; - $this->date = $this->db->jdate($obj->date_creation); + $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_valid = $this->db->jdate($obj->date_valid); $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); @@ -1282,7 +1282,7 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); // set tmp vars - $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set + $date = ($this->date_commande ? $this->date_commande : $this->date_creation); // in case of date is set if (empty($date)) { $date = $now; } @@ -2847,9 +2847,9 @@ class CommandeFournisseur extends CommonOrder $this->ref = 'SPECIMEN'; $this->specimen = 1; $this->socid = 1; - $this->date = $now; + $this->date_creation = $now; $this->date_commande = $now; - $this->date_lim_reglement = $this->date + 3600 * 24 * 30; + $this->date_lim_reglement = $this->date_creation + 3600 * 24 * 30; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; From c1e1a535039eb0e5626801371f578cc8c880823b Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:23:16 +0200 Subject: [PATCH 2/4] Update Explicit date_creation instead of date --- htdocs/fourn/class/fournisseur.commande.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2a8051e818c..1f2f10d9991 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -111,6 +111,7 @@ class CommandeFournisseur extends CommonOrder public $socid; public $fourn_id; + public $date; public $date_creation; public $date_valid; public $date_approve; @@ -380,6 +381,11 @@ 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 + if (isset($this->date_commande)) { + $this->date = $this->date_commande; + } 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; @@ -1282,7 +1288,7 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); // set tmp vars - $date = ($this->date_commande ? $this->date_commande : $this->date_creation); // in case of date is set + $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) { $date = $now; } @@ -2847,9 +2853,9 @@ class CommandeFournisseur extends CommonOrder $this->ref = 'SPECIMEN'; $this->specimen = 1; $this->socid = 1; - $this->date_creation = $now; + $this->date = $now; $this->date_commande = $now; - $this->date_lim_reglement = $this->date_creation + 3600 * 24 * 30; + $this->date_lim_reglement = $this->date + 3600 * 24 * 30; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; @@ -3295,7 +3301,6 @@ class CommandeFournisseur extends CommonOrder $keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys $keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys /*var_dump(array_keys($qtydelivered)); - var_dump(array_keys($qtywished)); var_dump($diff_array); var_dump($keysinwishednotindelivered); From 5cf90d0247448a93fe5bb2955827735426d0ba1f Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Fri, 24 Sep 2021 14:10:19 +0200 Subject: [PATCH 3/4] Correct date format --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1f2f10d9991..90c9d88a533 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -382,9 +382,9 @@ class CommandeFournisseur extends CommonOrder $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 if (isset($this->date_commande)) { - $this->date = $this->date_commande; + $this->date = $this->db->jdate($obj->date_commande); } else { - $this->date = $this->date_creation; + $this->date = $this->db->jdate($obj->date_creation); } $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); From 5623e5f98afe77d1fffbc71b43278bccca3d11c9 Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Sun, 26 Sep 2021 19:09:09 +0200 Subject: [PATCH 4/4] Correct isset --- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 90c9d88a533..99ef4e54e87 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -381,10 +381,10 @@ 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 - if (isset($this->date_commande)) { - $this->date = $this->db->jdate($obj->date_commande); + if (isset($obj->date_commande)) { + $this->date = $this->date_commande; } else { - $this->date = $this->db->jdate($obj->date_creation); + $this->date = $this->date_creation; } $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date);