Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Small check in tags.
James Cole0683c87e529a
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex 508269047b..5f00090c97 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -40,7 +40,7 @@ class JournalRepository implements JournalRepositoryInterface** @param TransactionJournal $journal*- * @return mixed+ * @return int*/public function getAssetAccount(TransactionJournal $journal){@@ -135,7 +135,19 @@ class JournalRepository implements JournalRepositoryInterface// only if this is a deposit.if ($journal->transaction_type_id == $deposit->id) {- $journal->tags()->save($tag);++ // if this is a deposit, account must match the current only journal+ // (if already present):+ $currentWithdrawal = $tag->transactionjournals()->where('transaction_type_id', $withdrawal->id)->first();+ if ($currentWithdrawal && $this->getAssetAccount($currentWithdrawal) == $this->getAssetAccount($journal)) {+ $journal->tags()->save($tag);+ } else {+ if (is_null($currentWithdrawal)) {+ $journal->tags()->save($tag);+ }+ }++}}@@ -165,10 +177,6 @@ class JournalRepository implements JournalRepositoryInterface);$journal->save();- if (isset($data['tags']) && is_array($data['tags'])) {- $this->saveTags($journal, $data['tags']);- }-// store or get categoryif (strlen($data['category']) > 0) {@@ -203,6 +211,11 @@ class JournalRepository implements JournalRepositoryInterface$journal->completed = 1;$journal->save();+ // store tags+ if (isset($data['tags']) && is_array($data['tags'])) {+ $this->saveTags($journal, $data['tags']);+ }+return $journal;