Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
Conflicts: htdocs/takepos/invoice.php
This commit is contained in:
commit
0fa139f4e3
@ -224,26 +224,27 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
// $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
|
||||
//}
|
||||
|
||||
$remaintopay = $invoice->getRemainToPay();
|
||||
|
||||
// Add the payment
|
||||
if ($res >= 0 && $remaintopay > 0) {
|
||||
$payment = new Paiement($db);
|
||||
$payment->datepaye = $now;
|
||||
$payment->fk_account = $bankaccount;
|
||||
$payment->amounts[$invoice->id] = $amountofpayment;
|
||||
if ($res >= 0) {
|
||||
$remaintopay = $invoice->getRemainToPay();
|
||||
if ($remaintopay > 0) {
|
||||
$payment = new Paiement($db);
|
||||
$payment->datepaye = $now;
|
||||
$payment->fk_account = $bankaccount;
|
||||
$payment->amounts[$invoice->id] = $amountofpayment;
|
||||
|
||||
// If user has not used change control, add total invoice payment
|
||||
// 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;
|
||||
// If user has not used change control, add total invoice payment
|
||||
// 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;
|
||||
$payment->paiementid = $paiementid;
|
||||
$payment->num_payment = $invoice->ref;
|
||||
|
||||
$payment->create($user);
|
||||
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
|
||||
$payment->create($user);
|
||||
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
|
||||
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
|
||||
}
|
||||
|
||||
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
|
||||
if ($remaintopay == 0) {
|
||||
dol_syslog("Invoice is paid, so we set it to status Paid");
|
||||
$result = $invoice->set_paid($user);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user