Fix warnings

This commit is contained in:
Laurent Destailleur 2022-02-10 13:16:51 +01:00
parent d2af490b33
commit c4c15fc105

View File

@ -56,6 +56,7 @@ $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoi
$amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '') : ''; // keep void if not a valid entry $amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '') : ''; // keep void if not a valid entry
// Clean checkamounts // Clean checkamounts
if (is_array($amounts)) {
foreach ($amounts as $key => $value) { foreach ($amounts as $key => $value) {
$value = price2num($value); $value = price2num($value);
$amounts[$key] = $value; $amounts[$key] = $value;
@ -63,7 +64,9 @@ foreach ($amounts as $key => $value) {
unset($amounts[$key]); unset($amounts[$key]);
} }
} }
}
// Clean remains // Clean remains
if (is_array($remains)) {
foreach ($remains as $key => $value) { foreach ($remains as $key => $value) {
$value = price2num($value); $value = price2num($value);
$remains[$key] = (($invoice_type) == 2 ?-1 : 1) * $value; $remains[$key] = (($invoice_type) == 2 ?-1 : 1) * $value;
@ -71,6 +74,7 @@ foreach ($remains as $key => $value) {
unset($remains[$key]); unset($remains[$key]);
} }
} }
}
// Treatment // Treatment
$result = ($amountPayment != '') ? ($amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment $result = ($amountPayment != '') ? ($amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment