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] 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 = '';