From 7b6515c8c254bf210ffed5ea7a309cf44b4e26b6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 29 Aug 2023 13:40:35 +1000 Subject: [PATCH] Fixes for bank transaction delinking --- app/Repositories/ExpenseRepository.php | 5 +++++ app/Services/Payment/DeletePayment.php | 1 + 2 files changed, 6 insertions(+) diff --git a/app/Repositories/ExpenseRepository.php b/app/Repositories/ExpenseRepository.php index b1b8794b98b7..6af0d453c6b6 100644 --- a/app/Repositories/ExpenseRepository.php +++ b/app/Repositories/ExpenseRepository.php @@ -113,6 +113,11 @@ class ExpenseRepository extends BaseRepository $expense->saveQuietly(); $expense->transaction->expense_id = $exp_ids; + + if(strlen($exp_ids) <= 2) { + $expense->transaction->status_id = 1; + } + $expense->transaction->saveQuietly(); } diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 27119ec5ca12..023e8148f34f 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -60,6 +60,7 @@ class DeletePayment BankTransaction::query()->where('payment_id', $this->payment->id)->cursor()->each(function ($bt){ $bt->payment_id = null; + $bt->status_id = 1; $bt->save(); });