Fixes when importing invoices with associated payments. Ensure we use the correct applied amount

This commit is contained in:
David Bomba 2023-02-03 13:29:53 +11:00
parent ff9539a1b8
commit 951e460c5a
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ class StorePaymentRequest extends Request
public function prepareForValidation() public function prepareForValidation()
{ {
$input = $this->all(); $input = $this->all();
nlog($input);
$invoices_total = 0; $invoices_total = 0;
$credits_total = 0; $credits_total = 0;

View File

@ -368,7 +368,7 @@ class BaseImport
$payment_data['invoices'] = [ $payment_data['invoices'] = [
[ [
'invoice_id' => $invoice->id, 'invoice_id' => $invoice->id,
'amount' => $payment_data['amount'] ?? null, 'amount' => min($invoice->amount, $payment_data['amount']) ?? null,
], ],
]; ];