Migrate actions

This commit is contained in:
James Cole
2022-10-02 06:23:31 +02:00
parent f2f3d69aa8
commit 10d2a91d99
26 changed files with 319 additions and 33 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
use DB;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\Account;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Transaction;
@@ -86,7 +87,7 @@ class SetSourceAccount implements ActionInterface
return false;
}
// account must not be deleted (in the mean time):
// account must not be deleted (in the meantime):
if (null === $destination->account) {
Log::error('Could not find destination transaction account.');
@@ -117,6 +118,8 @@ class SetSourceAccount implements ActionInterface
->where('amount', '<', 0)
->update(['account_id' => $newAccount->id]);
event(new TriggeredAuditLog($this->action->rule, $object, 'set_source', null, $newAccount->name));
Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new source account ID.', $object->id, $object->transaction_group_id));
return true;