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,7 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
use DB;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use Log;
/**
@@ -48,6 +50,10 @@ class SetDescription implements ActionInterface
*/
public function actOnArray(array $journal): bool
{
/** @var TransactionJournal $journal */
$journal = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
$before = $journal->description;
DB::table('transaction_journals')
->where('id', '=', $journal['transaction_journal_id'])
->update(['description' => $this->action->action_value]);
@@ -61,6 +67,8 @@ class SetDescription implements ActionInterface
)
);
event(new TriggeredAuditLog($this->action->rule, $journal, 'update_description', $before, $this->action->action_value));
return true;
}
}