Debug v22

This commit is contained in:
ldestailleur
2025-07-26 11:38:27 +02:00
parent 3c8be27009
commit e8de1b62d1
2 changed files with 15 additions and 5 deletions

View File

@@ -2747,15 +2747,17 @@ function pdf_getSizeForImage($realpath)
}
/**
* Return line total amount discount
* Return line total amount discount.
* Calculated by taking the unit price (subprice) * quantity - (total without tax)
*
* @param Commande|Facture|Propal $object Object
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int<0,2> $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param int<0,1> $multicurrency 1=Get value in the foreign currency
* @return int|float|string Return total of line excl tax
*/
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0, $multicurrency = 0)
{
global $hookmanager;
@@ -2777,7 +2779,8 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code
'special_code' => $special_code,
'multicurrency' => $multicurrency
);
$action = '';
@@ -2792,7 +2795,11 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
}
if (empty($hidedetails) || $hidedetails > 1) {
return (float) price2num($sign * (($object->lines[$i]->subprice * (float) $object->lines[$i]->qty) - $object->lines[$i]->total_ht), 'MT', 1);
if (empty($multicurrency)) {
return (float) price2num($sign * (($object->lines[$i]->subprice * (float) $object->lines[$i]->qty) - $object->lines[$i]->total_ht), 'MT', 1);
} else {
return (float) price2num($sign * (($object->lines[$i]->multicurrency_subprice * (float) $object->lines[$i]->qty) - $object->lines[$i]->multicurrency_total_ht), 'MT', 1);
}
}
}
return 0;