Fix updateline method for INVOICE_USE_SITUATION = 2

If there is no progress on a line, percent must not be 100%
This commit is contained in:
EchoLoGeek 2025-03-04 11:00:24 +01:00
parent 2843597329
commit 146bd33e90

View file

@ -4140,7 +4140,12 @@ class Facture extends CommonInvoice
$special_code = 0;
}
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) {
$situation_percent = 100;
// INVOICE_USE_SITUATION = 2 - If there is no progress on a line, percent must not be 100% (No cumulative)
if ($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2 && (int) $situation_percent < 100) {
$situation_percent = 0;
} else {
$situation_percent = 100;
}
}
if (empty($ref_ext)) {
$ref_ext = '';