Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #12694
James Colea0688c990f3f
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.phpindex 6dd05d2347..6f635686f7 100644--- a/app/Services/Internal/Update/JournalUpdateService.php+++ b/app/Services/Internal/Update/JournalUpdateService.php@@ -544,6 +544,7 @@ class JournalUpdateService$recordCurrency = $origSourceTransaction->transactionCurrency;$originalSourceAmount = $makePositive ? Steam::positive($originalSourceAmount) : Steam::negative($originalSourceAmount);$value = $makePositive ? Steam::positive($value) : Steam::negative($value);+ $this->transactionJournal->touch();// should not return in NULL but seems to do.event(@@ -573,6 +574,8 @@ class JournalUpdateService$bill = $this->billRepository->findBill($billId, $billName);$this->transactionJournal->bill_id = $bill?->id;Log::debug('Updated bill ID');+ $this->transactionJournal->touch();+}}@@ -582,10 +585,12 @@ class JournalUpdateServiceif ($this->hasFields(['budget_id', 'budget_name'])) {Log::debug('Will update budget.');$this->storeBudget($this->transactionJournal, new NullArrayObject($this->data));+ $this->transactionJournal->touch();}// is transfer? remove budgetif (TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type) {$this->transactionJournal->budgets()->sync([]);+ $this->transactionJournal->touch();}}@@ -596,6 +601,7 @@ class JournalUpdateServiceLog::debug('Will update category.');$this->storeCategory($this->transactionJournal, new NullArrayObject($this->data));+ $this->transactionJournal->touch();}}@@ -621,6 +627,7 @@ class JournalUpdateService$dest->save();// refresh transactions.+ $this->transactionJournal->touch();$this->sourceTransaction->refresh();$this->destinationTransaction->refresh();Log::debug(sprintf('Updated currency to #%d (%s)', $currency->id, $currency->code));@@ -666,6 +673,7 @@ class JournalUpdateService}$factory->updateOrCreate($set);}+ $this->transactionJournal->touch();event(new TransactionGroupRequestsAuditLogEntry($this->transactionJournal->user,@@ -738,6 +746,7 @@ class JournalUpdateServiceLog::debug(sprintf('Update foreign info to %s (#%d) %s', $foreignCurrency->code, $foreignCurrency->id, $foreignAmount));// refresh transactions.+ $this->transactionJournal->touch();$this->sourceTransaction->refresh();$this->destinationTransaction->refresh();@@ -764,7 +773,6 @@ class JournalUpdateService$recordCurrency = $source->foreignCurrency;$originalSourceAmount = $makePositive ? Steam::positive($originalSourceAmount) : Steam::negative($originalSourceAmount);$value = $makePositive ? Steam::positive($foreignAmount) : Steam::negative($foreignAmount);-// should not return in NULL but seems to do.event(new TransactionGroupRequestsAuditLogEntry(@@ -792,6 +800,9 @@ class JournalUpdateService$dest->foreign_currency_id = null;$dest->foreign_amount = null;$dest->save();+ $this->transactionJournal->touch();+ $this->sourceTransaction->refresh();+ $this->destinationTransaction->refresh();Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));return;@@ -809,12 +820,12 @@ class JournalUpdateService// if all are null or zero, delete current location.if (null === $this->data['longitude'] && null === $this->data['latitude'] && null === $this->data['zoom_level']) {$this->transactionJournal->locations()->delete();-+ $this->transactionJournal->touch();return;}if ('' === $this->data['longitude'] && '' === $this->data['latitude'] && null === $this->data['zoom_level']) {$this->transactionJournal->locations()->delete();-+ $this->transactionJournal->touch();return;}$location = $this->transactionJournal->locations()->first();@@ -826,6 +837,7 @@ class JournalUpdateService$location->latitude = $this->data['latitude'];$location->zoom_level = $this->data['zoom_level'];$location->save();+ $this->transactionJournal->touch();}}@@ -865,6 +877,7 @@ class JournalUpdateService// also set date with timezone.$set = ['journal' => $this->transactionJournal, 'name' => sprintf('%s_tz', $field), 'data' => $value?->format('e')];$factory->updateOrCreate($set);+ $this->transactionJournal->touch();}}}@@ -880,6 +893,7 @@ class JournalUpdateServiceLog::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));$set = ['journal' => $this->transactionJournal, 'name' => $field, 'data' => $value];$factory->updateOrCreate($set);+ $this->transactionJournal->touch();}}}@@ -890,6 +904,7 @@ class JournalUpdateServiceif ($this->hasFields(['notes'])) {$notes = '' === (string) $this->data['notes'] ? null : $this->data['notes'];$this->storeNotes($this->transactionJournal, $notes);+ $this->transactionJournal->touch();}}@@ -897,6 +912,7 @@ class JournalUpdateService{if (array_key_exists('reconciled', $this->data) && is_bool($this->data['reconciled'])) {$this->transactionJournal->transactions()->update(['reconciled' => $this->data['reconciled']]);+ $this->transactionJournal->touch();}}diff --git a/changelog.md b/changelog.mdindex 01f94cead3..2c8099a3b8 100644--- a/changelog.md+++ b/changelog.md@@ -48,6 +48,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).- [PR 12642](https://github.com/firefly-iii/firefly-iii/pull/12642) (Fix [Issue 12639](https://github.com/firefly-iii/firefly-iii/issues/12639) (Test rules endpoint always returns no results unless optional accounts argument is passed) reported by @grgar: match accounts arg of rule trigger & test) reported by @grgar- [Issue 12662](https://github.com/firefly-iii/firefly-iii/issues/12662) (A Search for Tags returns more page groups than required) reported by @PAS-BC- [Issue 12687](https://github.com/firefly-iii/firefly-iii/issues/12687) (Changing budgeted amount in a budget deletes notes.) reported by @rdesbo+- #12694- Setting an invalid language would break your account.### Security