Fix Situation Percent with USE_INVOICE_SITUATION = 2

Lines situation percent on new lines must be 0 (No cumulative)
This commit is contained in:
EchoLoGeek
2025-02-21 12:23:30 +01:00
committed by ldestailleur
parent 5d84a5fc13
commit fda1d8056e
2 changed files with 7 additions and 2 deletions

View File

@@ -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
}

View File

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