From 954692ce6d895e7d7def2dbc30d9f32de8773f6c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 24 May 2021 14:57:30 +1000 Subject: [PATCH] Fixes for importing payments in CSVs, do not apply payments to Zero amount invoices --- app/Jobs/Import/CSVImport.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Import/CSVImport.php b/app/Jobs/Import/CSVImport.php index 183d7aa5b27c..01dbaf371856 100644 --- a/app/Jobs/Import/CSVImport.php +++ b/app/Jobs/Import/CSVImport.php @@ -293,10 +293,14 @@ class CSVImport implements ShouldQueue { ], ]; - $payment_repository->save( - $payment_data, - PaymentFactory::create( $this->company->id, $invoice->user_id, $invoice->client_id ) - ); + /* Make sure we don't apply any payments to invoices with a Zero Amount*/ + if($invoice->amount > 0) + { + $payment_repository->save( + $payment_data, + PaymentFactory::create( $this->company->id, $invoice->user_id, $invoice->client_id ) + ); + } } } }