From fda1d8056e88845b97ba299d2fca463c4569c8a5 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Fri, 21 Feb 2025 12:23:30 +0100 Subject: [PATCH 1/3] Fix Situation Percent with USE_INVOICE_SITUATION = 2 Lines situation percent on new lines must be 0 (No cumulative) --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6b726c71d02..fe16338f6bd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2029,7 +2029,7 @@ if (empty($reshook)) { $line->fk_prev_id = $line->id; $line->fetch_optionals(); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { - $line->situation_percent = $line->getAllPrevProgress($object->id); // get good progress including credit note + $line->situation_percent = 0; // New situation percent must be 0 (No cumulative) } else { $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3ad7cc33bfa..f20317fd4ae 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3955,7 +3955,12 @@ class Facture extends CommonInvoice $fk_prev_id = 'null'; } if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { - $situation_percent = 100; + // INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative) + if($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2){ + $situation_percent = 0; + } else { + $situation_percent = 100; + } } if (empty($ref_ext)) { $ref_ext = ''; From 8e0ee99084b2bf86b2493be7457fc41f21eb43f0 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Fri, 21 Feb 2025 12:31:03 +0100 Subject: [PATCH 2/3] fix spaces --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f20317fd4ae..a501483dbbb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3956,7 +3956,7 @@ class Facture extends CommonInvoice } if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { // INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative) - if($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2){ + if ($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { $situation_percent = 0; } else { $situation_percent = 100; From c18de2c69b26b2f479ec32364ba49d0b8ea881c2 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 21 Feb 2025 15:52:23 +0100 Subject: [PATCH 3/3] Debug v21 --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a501483dbbb..1ed5be778bd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3956,7 +3956,7 @@ class Facture extends CommonInvoice } if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { // INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative) - if ($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { + if ($this->isSituationInvoice() && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { $situation_percent = 0; } else { $situation_percent = 100;