mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Last code optimization before release.
This commit is contained in:
@@ -32,9 +32,6 @@ use Log;
|
||||
*/
|
||||
class ClearBudget implements ActionInterface
|
||||
{
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*
|
||||
@@ -42,7 +39,6 @@ class ClearBudget implements ActionInterface
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,9 +32,6 @@ use Log;
|
||||
*/
|
||||
class ClearCategory implements ActionInterface
|
||||
{
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*
|
||||
@@ -42,7 +39,6 @@ class ClearCategory implements ActionInterface
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,9 +32,6 @@ use Log;
|
||||
*/
|
||||
class ClearNotes implements ActionInterface
|
||||
{
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*
|
||||
@@ -42,7 +39,6 @@ class ClearNotes implements ActionInterface
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,9 +31,6 @@ use Log;
|
||||
*/
|
||||
class RemoveAllTags implements ActionInterface
|
||||
{
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*
|
||||
@@ -41,7 +38,6 @@ class RemoveAllTags implements ActionInterface
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,11 @@ class SetCategory implements ActionInterface
|
||||
$factory = app(CategoryFactory::class);
|
||||
$factory->setUser($journal->user);
|
||||
$category = $factory->findOrCreate(null, $name);
|
||||
if (null === $category) {
|
||||
Log::error(sprintf('Action SetCategory did not fire because "%s" did not result in a valid category.', $name));
|
||||
|
||||
return true;
|
||||
}
|
||||
$journal->categories()->detach();
|
||||
// set category on transactions:
|
||||
/** @var Transaction $transaction */
|
||||
|
||||
@@ -100,7 +100,12 @@ class SetSourceAccount implements ActionInterface
|
||||
|
||||
// update source transaction with new source account:
|
||||
// get source transaction:
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
if (null === $transaction) {
|
||||
Log::error(sprintf('Cannot change source account of journal #%d because no source transaction exists.', $journal->id));
|
||||
|
||||
return false;
|
||||
}
|
||||
$transaction->account_id = $this->newSourceAccount->id;
|
||||
$transaction->save();
|
||||
$journal->touch();
|
||||
@@ -130,7 +135,7 @@ class SetSourceAccount implements ActionInterface
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function findRevenueAccount()
|
||||
private function findRevenueAccount(): void
|
||||
{
|
||||
$account = $this->repository->findByName($this->action->action_value, [AccountType::REVENUE]);
|
||||
if (null === $account) {
|
||||
|
||||
Reference in New Issue
Block a user