diff --git a/app/Events/Banking/TransactionSplitted.php b/app/Events/Banking/TransactionSplitted.php new file mode 100644 index 000000000..032f88ab2 --- /dev/null +++ b/app/Events/Banking/TransactionSplitted.php @@ -0,0 +1,23 @@ +request = $request; + $this->transaction = $transaction; + } +} diff --git a/app/Events/Banking/TransactionSplitting.php b/app/Events/Banking/TransactionSplitting.php new file mode 100644 index 000000000..2d975713e --- /dev/null +++ b/app/Events/Banking/TransactionSplitting.php @@ -0,0 +1,23 @@ +request = $request; + $this->transaction = $transaction; + } +} diff --git a/app/Jobs/Banking/MatchBankingDocumentTransaction.php b/app/Jobs/Banking/MatchBankingDocumentTransaction.php index 129555ab6..373067a62 100644 --- a/app/Jobs/Banking/MatchBankingDocumentTransaction.php +++ b/app/Jobs/Banking/MatchBankingDocumentTransaction.php @@ -29,7 +29,7 @@ class MatchBankingDocumentTransaction extends Job \DB::transaction(function () { $this->transaction = $this->dispatch(new UpdateTransaction($this->transaction, [ 'document_id' => $this->model->id, - 'type' => $this->transaction->type, // Set missing type get default income typr for UpdateTransaction job. + 'type' => $this->transaction->type, // Set missing type get default income type for UpdateTransaction job. ])); $this->model->save(); diff --git a/app/Jobs/Banking/SplitTransaction.php b/app/Jobs/Banking/SplitTransaction.php index 67e0a0320..3975eb309 100644 --- a/app/Jobs/Banking/SplitTransaction.php +++ b/app/Jobs/Banking/SplitTransaction.php @@ -3,6 +3,8 @@ namespace App\Jobs\Banking; use App\Abstracts\Job; +use App\Events\Banking\TransactionSplitted; +use App\Events\Banking\TransactionSplitting; use App\Interfaces\Job\ShouldUpdate; use App\Models\Document\Document; use App\Traits\Transactions; @@ -17,6 +19,8 @@ class SplitTransaction extends Job implements ShouldUpdate { $this->checkAmount(); + event(new TransactionSplitting($this->request, $this->model)); + DB::transaction(function () { foreach ($this->request->items as $item) { $transaction = $this->model->duplicate(); @@ -44,6 +48,8 @@ class SplitTransaction extends Job implements ShouldUpdate $this->model->save(); }); + event(new TransactionSplitted($this->request, $this->model)); + return $this->request->items; }