From a53f3edae6ef17f4ca208a30975b983249e323cb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Sep 2022 16:54:22 +1000 Subject: [PATCH 1/5] Minor fixes --- app/Http/Requests/Report/ProfitLossRequest.php | 2 +- app/Jobs/Bank/MatchBankTransactions.php | 5 ++++- app/Models/BankTransaction.php | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Report/ProfitLossRequest.php b/app/Http/Requests/Report/ProfitLossRequest.php index 2886b4eb1944..3b3e7802d010 100644 --- a/app/Http/Requests/Report/ProfitLossRequest.php +++ b/app/Http/Requests/Report/ProfitLossRequest.php @@ -31,7 +31,7 @@ class ProfitLossRequest extends Request 'start_date' => 'string|date', 'end_date' => 'string|date', 'is_income_billed' => 'required|bail|bool', - 'is_expense_billed' => 'required|bail|bool', + 'is_expense_billed' => 'bool', 'include_tax' => 'required|bail|bool', 'date_range' => 'sometimes|string', 'send_email' => 'bool', diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index 05f31fad0bdb..4f9fb07ffb73 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -293,8 +293,11 @@ class MatchBankTransactions implements ShouldQueue private function resolveCategory() :?int { - if(array_key_exists('ninja_category_id', $this->input)) + if(array_key_exists('ninja_category_id', $this->input)){ + $this->bt->ninja_category_id = $this->input['ninja_category_id']; + $this->bt->save(); return $this->input['ninja_category_id']; + } $category = $this->categories->firstWhere('highLevelCategoryId', $this->bt->category_id); diff --git a/app/Models/BankTransaction.php b/app/Models/BankTransaction.php index 2efa9560334f..00d69ceb620e 100644 --- a/app/Models/BankTransaction.php +++ b/app/Models/BankTransaction.php @@ -32,6 +32,7 @@ class BankTransaction extends BaseModel 'date', 'description', 'base_type', + 'expense_id', ]; protected $dates = [ From 80489928719f99c100570f4e6aefc793984bc843 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Sep 2022 16:59:41 +1000 Subject: [PATCH 2/5] Minor fixes --- app/Jobs/Bank/MatchBankTransactions.php | 2 ++ app/Models/BankTransaction.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index 4f9fb07ffb73..de430de319cc 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -175,9 +175,11 @@ class MatchBankTransactions implements ShouldQueue $expense->payment_date = Carbon::parse($this->bt->date); $expense->transaction_reference = $this->bt->description; $expense->transaction_id = $this->bt->id; + $expense->vendor_id = array_key_exists('vendor_id', $this->input) ? $this->input['vendor_id'] : null; $expense->save(); $this->bt->expense_id = $expense->id; + $this->bt->vendor_id = array_key_exists('vendor_id', $this->input) ? $this->input['vendor_id'] : null; $this->bt->status_id = BankTransaction::STATUS_CONVERTED; $this->bt->save(); diff --git a/app/Models/BankTransaction.php b/app/Models/BankTransaction.php index 00d69ceb620e..bfb1c2fc4d52 100644 --- a/app/Models/BankTransaction.php +++ b/app/Models/BankTransaction.php @@ -33,6 +33,7 @@ class BankTransaction extends BaseModel 'description', 'base_type', 'expense_id', + 'vendor_id' ]; protected $dates = [ From 38923c8897958320edb2a7b5268e70d111dc3582 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Sep 2022 19:26:17 +1000 Subject: [PATCH 3/5] Minor fixes --- app/Jobs/Bank/MatchBankTransactions.php | 2 +- app/Transformers/ExpenseTransformer.php | 2 +- app/Transformers/PaymentTransformer.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index de430de319cc..58d12e42c570 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -298,7 +298,7 @@ class MatchBankTransactions implements ShouldQueue if(array_key_exists('ninja_category_id', $this->input)){ $this->bt->ninja_category_id = $this->input['ninja_category_id']; $this->bt->save(); - return $this->input['ninja_category_id']; + return (int)$this->input['ninja_category_id']; } $category = $this->categories->firstWhere('highLevelCategoryId', $this->bt->category_id); diff --git a/app/Transformers/ExpenseTransformer.php b/app/Transformers/ExpenseTransformer.php index 13c8d9b7481c..fb1cb938efb0 100644 --- a/app/Transformers/ExpenseTransformer.php +++ b/app/Transformers/ExpenseTransformer.php @@ -103,7 +103,7 @@ class ExpenseTransformer extends EntityTransformer 'private_notes' => (string) $expense->private_notes ?: '', 'public_notes' => (string) $expense->public_notes ?: '', 'transaction_reference' => (string) $expense->transaction_reference ?: '', - 'transaction_id' => (string) $expense->transaction_id ?: '', + 'transaction_id' => (string) $this->decodePrimaryKey($expense->transaction_id) ?: '', 'date' => $expense->date ?: '', 'number' => (string)$expense->number ?: '', 'payment_date' => $expense->payment_date ?: '', diff --git a/app/Transformers/PaymentTransformer.php b/app/Transformers/PaymentTransformer.php index ae202667355a..f18756964b97 100644 --- a/app/Transformers/PaymentTransformer.php +++ b/app/Transformers/PaymentTransformer.php @@ -79,7 +79,7 @@ class PaymentTransformer extends EntityTransformer 'refunded' => (float) $payment->refunded, 'applied' => (float) $payment->applied, 'transaction_reference' => $payment->transaction_reference ?: '', - 'transaction_id' => $payment->transaction_id ?: '', + 'transaction_id' => $this->decodePrimaryKey($payment->transaction_id) ?: '', 'date' => $payment->date ?: '', 'is_manual' => (bool) $payment->is_manual, 'created_at' => (int) $payment->created_at, From 775ee542b5a853639c8ea1fed7e126ffc0109742 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 24 Sep 2022 07:37:55 +1000 Subject: [PATCH 4/5] Fixes for bank integration routres --- .../BankTransaction/StoreBankTransactionRequest.php | 7 +++---- .../BankTransaction/UpdateBankTransactionRequest.php | 3 +++ app/Repositories/BankIntegrationRepository.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Requests/BankTransaction/StoreBankTransactionRequest.php b/app/Http/Requests/BankTransaction/StoreBankTransactionRequest.php index 94af89011395..b292453df8c5 100644 --- a/app/Http/Requests/BankTransaction/StoreBankTransactionRequest.php +++ b/app/Http/Requests/BankTransaction/StoreBankTransactionRequest.php @@ -41,12 +41,11 @@ class StoreBankTransactionRequest extends Request { $input = $this->all(); + if(array_key_exists('bank_integration_id', $input) && strlen($input['bank_integration_id']) > 1) + $input['bank_integration_id'] = $this->decodePrimaryKey($input['bank_integration_id']); + $this->replace($input); } - public function messages() - { - return []; - } } diff --git a/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php b/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php index ba2ed783029c..b466fdae16c2 100644 --- a/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php +++ b/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php @@ -67,6 +67,9 @@ class UpdateBankTransactionRequest extends Request if(array_key_exists('ninja_category_id', $input) && strlen($input['ninja_category_id']) > 1) $input['ninja_category_id'] = $this->decodePrimaryKey($input['ninja_category_id']); + if(array_key_exists('bank_integration_id', $input) && strlen($input['bank_integration_id']) > 1) + $input['bank_integration_id'] = $this->decodePrimaryKey($input['bank_integration_id']); + $this->replace($input); } diff --git a/app/Repositories/BankIntegrationRepository.php b/app/Repositories/BankIntegrationRepository.php index d3d43bd98f00..aca7ac150b30 100644 --- a/app/Repositories/BankIntegrationRepository.php +++ b/app/Repositories/BankIntegrationRepository.php @@ -21,7 +21,7 @@ use App\Models\TaskStatus; class BankIntegrationRepository extends BaseRepository { - public function store($data, BankIntegration $bank_integration) + public function save($data, BankIntegration $bank_integration) { //stub to store From 2eee0d9c1ffd28f6ce64776e2cd25fab86665403 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 29 Sep 2022 19:43:59 +1000 Subject: [PATCH 5/5] minor fixes --- app/Models/BankIntegration.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Models/BankIntegration.php b/app/Models/BankIntegration.php index 3a103e3f1dcb..dce8b2b36708 100644 --- a/app/Models/BankIntegration.php +++ b/app/Models/BankIntegration.php @@ -18,6 +18,15 @@ class BankIntegration extends BaseModel use SoftDeletes; protected $fillable = [ + 'bank_account_name', + 'provider_name', + 'bank_account_number', + 'bank_account_status', + 'bank_account_type', + 'balance', + 'currency', + 'nickname', + 'from_date', ]; protected $dates = [