Touch journals so issue #1036 is fixed.

This commit is contained in:
James Cole 2017-12-04 20:57:33 +01:00
parent 462439a5ab
commit 1b56765da3
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
11 changed files with 11 additions and 3 deletions

View File

@ -60,6 +60,7 @@ class AddTag implements ActionInterface
$count = $journal->tags()->where('tag_id', $tag->id)->count();
if (0 === $count) {
$journal->tags()->save($tag);
$journal->touch();
Log::debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal->id));
return true;

View File

@ -54,6 +54,7 @@ class ClearBudget implements ActionInterface
public function act(TransactionJournal $journal): bool
{
$journal->budgets()->detach();
$journal->touch();
Log::debug(sprintf('RuleAction ClearBudget removed all budgets from journal %d.', $journal->id));
return true;

View File

@ -54,6 +54,7 @@ class ClearCategory implements ActionInterface
public function act(TransactionJournal $journal): bool
{
$journal->categories()->detach();
$journal->touch();
Log::debug(sprintf('RuleAction ClearCategory removed all categories from journal %d.', $journal->id));
return true;

View File

@ -60,6 +60,7 @@ class ClearNotes implements ActionInterface
foreach ($notes as $note) {
$note->delete();
}
$journal->touch();
return true;
}

View File

@ -55,6 +55,7 @@ class RemoveAllTags implements ActionInterface
{
Log::debug(sprintf('RuleAction ClearCategory removed all tags from journal %d.', $journal->id));
$journal->tags()->detach();
$journal->touch();
return true;
}

View File

@ -66,7 +66,7 @@ class RemoveTag implements ActionInterface
if (null !== $tag) {
Log::debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal->id));
$journal->tags()->detach([$tag->id]);
$journal->touch();
return true;
}
Log::debug(sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag exists.', $name, $journal->id));

View File

@ -88,7 +88,7 @@ class SetBudget implements ActionInterface
Log::debug(sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal->id, $budget->id, $budget->name));
$journal->budgets()->sync([$budget->id]);
$journal->touch();
return true;
}
}

View File

@ -57,7 +57,7 @@ class SetCategory implements ActionInterface
$name = $this->action->action_value;
$category = Category::firstOrCreateEncrypted(['name' => $name, 'user_id' => $journal->user->id]);
$journal->categories()->sync([$category->id]);
$journal->touch();
Log::debug(sprintf('RuleAction SetCategory set the category of journal #%d to budget #%d ("%s").', $journal->id, $category->id, $category->name));
return true;

View File

@ -66,6 +66,7 @@ class SetDescription implements ActionInterface
$this->action->action_value
)
);
$journal->touch();
return true;
}

View File

@ -103,6 +103,7 @@ class SetDestinationAccount implements ActionInterface
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$transaction->account_id = $this->newDestinationAccount->id;
$transaction->save();
$journal->touch();
Log::debug(sprintf('Updated transaction #%d and gave it new account ID.', $transaction->id));
return true;

View File

@ -104,6 +104,7 @@ class SetSourceAccount implements ActionInterface
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$transaction->account_id = $this->newSourceAccount->id;
$transaction->save();
$journal->touch();
Log::debug(sprintf('Updated transaction #%d and gave it new account ID.', $transaction->id));
return true;