Last code optimization before release.

This commit is contained in:
James Cole
2018-07-28 10:45:16 +02:00
parent d35470a79e
commit 0c7b652a70
42 changed files with 217 additions and 301 deletions

View File

@@ -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;
}
/**

View File

@@ -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;
}
/**

View File

@@ -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;
}
/**

View File

@@ -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;
}
/**

View File

@@ -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 */

View File

@@ -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) {