mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 05:06:37 +00:00
Fix actions and associated tests.
This commit is contained in:
@@ -22,6 +22,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\TransactionRules\Actions;
|
||||
|
||||
use DB;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
@@ -31,8 +32,7 @@ use Log;
|
||||
*/
|
||||
class SetDescription implements ActionInterface
|
||||
{
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
@@ -46,10 +46,11 @@ class SetDescription implements ActionInterface
|
||||
|
||||
/**
|
||||
* Set description to X
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return bool
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function act(TransactionJournal $journal): bool
|
||||
{
|
||||
@@ -75,6 +76,18 @@ class SetDescription implements ActionInterface
|
||||
*/
|
||||
public function actOnArray(array $journal): bool
|
||||
{
|
||||
// TODO: Implement actOnArray() method.
|
||||
DB::table('transaction_journals')
|
||||
->where('id', '=', $journal['transaction_journal_id'])
|
||||
->update(['description' => $this->action->action_value]);
|
||||
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetDescription changed the description of journal #%d from "%s" to "%s".',
|
||||
$journal['transaction_journal_id'],
|
||||
$journal['description'],
|
||||
$this->action->action_value
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user