From 4d05bff78037be41f9a91c27f33d970a0ca75863 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 27 Feb 2018 12:25:36 +0100 Subject: [PATCH] FIX : if we make a mistake with situation_percent, now we can correct it. before situation_final was always set to 1 and no way to go back --- htdocs/compta/facture/class/facture.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d1ede7cb41d..3728908f01d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2245,9 +2245,12 @@ class Facture extends CommonInvoice $final = ($this->lines[$i]->situation_percent == 100); $i++; } - if ($final) { - $this->setFinal($user); - } + + if (empty($final)) $this->situation_final = 0; + else $this->situation_final = 1; + + $this->setFinal($user); + } } } @@ -4090,7 +4093,6 @@ class Facture extends CommonInvoice $this->db->begin(); - $this->situation_final = 1; $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; dol_syslog(__METHOD__, LOG_DEBUG);