Merge manually changes from #37012 that seems good.

This commit is contained in:
Laurent Destailleur 2026-01-29 10:42:44 +01:00
parent c07ac38ddb
commit c23b58d416
2 changed files with 5 additions and 4 deletions

View file

@ -1341,7 +1341,7 @@ if (empty($reshook)) {
}
}
// NOTE: Pb with situation invoice
// NOTE: Pb with situation invoice when INVOICE_USE_SITUATION=1 (legacy mode)
// NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total
// NOTE: fields total on credit note are stored as delta both on total of lines and on invoice total (good)
// NOTE: fields situation_percent on situation invoice are stored as cumulative values on lines (bad)
@ -3317,6 +3317,7 @@ if (empty($reshook)) {
}
if (GETPOST('all_progress') != "") {
$all_progress = GETPOSTINT('all_progress');
if ($all_progress > 100) $all_progress = 100;
foreach ($object->lines as $line) {
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$percent = $line->getAllPrevProgress($object->id);
@ -3328,7 +3329,7 @@ if (empty($reshook)) {
setEventMessages($mesg, null, 'warnings');
$result = -1;
} else {
$object->update_percent($line, GETPOSTINT('all_progress'), false);
$object->update_percent($line, $all_progress, false);
}
}
$object->update_price(1);
@ -6822,7 +6823,7 @@ if ($action == 'create') {
}
// Create next situation invoice
if ($usercancreate && ($object->type == 5) && ($object->status == 1 || $object->status == 2)) {
if ($usercancreate && ($object->type == Facture::TYPE_SITUATION) && ($object->status == 1 || $object->status == 2)) {
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create&type=5&origin=facture&originid='.$object->id.'&socid='.$object->socid.'" >'.$langs->trans('CreateNextSituationInvoice').'</a>';
} elseif (!$object->is_last_in_cycle()) {

View file

@ -2418,5 +2418,5 @@ abstract class CommonInvoiceLine extends CommonObjectLine
/**
* @var float Situation advance percentage (default 100 for standard invoices)
*/
public $situation_percent;
public $situation_percent = 100;
}