From 1b0cd777c2ea738ce1102a8df4f40580351d86a5 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] 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 e08e2c670bc..cbcc4d9aa7c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2030,7 +2030,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 0e6069c9368..7e0e2612f75 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3954,7 +3954,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 = '';