Avoid higher payments than remain in TakePOS

This commit is contained in:
andreubisquerra 2020-03-07 22:56:43 +01:00 committed by GitHub
parent 148e2e58e5
commit 2af9904c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,8 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->amounts[$invoice->id] = $amountofpayment;
// If user has not used change control, add total invoice payment
if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $remaintopay;
// Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay
if ($amountofpayment == 0 || $amountofpayment>$remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
$payment->paiementid = $paiementid;
$payment->num_payment = $invoice->ref;