mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Refactor some code for recurrences.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use FireflyIII\Events\StoredTransactionGroup;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
@@ -39,7 +40,7 @@ class StoredGroupEventHandler
|
||||
* @param StoredTransactionGroup $storedJournalEvent
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function processRules(StoredTransactionGroup $storedJournalEvent): bool
|
||||
{
|
||||
@@ -47,6 +48,7 @@ class StoredGroupEventHandler
|
||||
if(false === $storedJournalEvent->applyRules) {
|
||||
return true;
|
||||
}
|
||||
// TODO fix this
|
||||
die('cannot apply rules yet');
|
||||
// create objects:
|
||||
/** @var RuleGroupRepositoryInterface $ruleGroupRepos */
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use FireflyIII\Events\UpdatedTransactionGroup;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
@@ -39,13 +40,14 @@ class UpdatedGroupEventHandler
|
||||
* @param UpdatedTransactionGroup $updatedJournalEvent
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function processRules(UpdatedTransactionGroup $updatedJournalEvent): bool
|
||||
{
|
||||
// get all the user's rule groups, with the rules, order by 'order'.
|
||||
$journals = $updatedJournalEvent->transactionGroup->transactionJournals;
|
||||
|
||||
// TODO fix this
|
||||
die('cannot apply rules yet');
|
||||
/** @var RuleGroupRepositoryInterface $ruleGroupRepos */
|
||||
$ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
||||
|
||||
|
@@ -25,7 +25,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Handlers\Events;
|
||||
|
||||
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\RequestedVersionCheckStatus;
|
||||
use FireflyIII\Helpers\Update\UpdateTrait;
|
||||
use FireflyIII\Models\Configuration;
|
||||
@@ -71,7 +70,7 @@ class VersionCheckEventHandler
|
||||
}
|
||||
|
||||
/** @var Configuration $lastCheckTime */
|
||||
$lastCheckTime = FireflyConfig::get('last_update_check', time());
|
||||
$lastCheckTime = app('fireflyconfig')->get('last_update_check', time());
|
||||
$now = time();
|
||||
$diff = $now - $lastCheckTime->data;
|
||||
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
@@ -90,6 +89,6 @@ class VersionCheckEventHandler
|
||||
// flash info
|
||||
session()->flash('info', $resultString);
|
||||
}
|
||||
FireflyConfig::set('last_update_check', time());
|
||||
app('fireflyconfig')->set('last_update_check', time());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user