Skip to content

Firefly III: a personal finances manager

Update some logging.

James Cole132d7d9ff8b6
diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.php
index 52643c55f7..09a80af0ff 100644
--- a/app/Factory/PiggyBankEventFactory.php
+++ b/app/Factory/PiggyBankEventFactory.php
@@ -36,9 +36,9 @@ class PiggyBankEventFactory
{
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): void
{
- app('log')->debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
+ Log::debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
if (!$piggyBank instanceof PiggyBank) {
- app('log')->debug('Piggy bank is null');
+ Log::debug('Piggy bank is null');
return;
}
@@ -49,7 +49,7 @@ class PiggyBankEventFactory
$amount = $piggyRepos->getExactAmount($piggyBank, $journal);
if (0 === bccomp($amount, '0')) {
- app('log')->debug('Amount is zero, will not create event.');
+ Log::debug('Amount is zero, will not create event.');
return;
}
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index 4e99d53728..8ef670d2b2 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -263,6 +263,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
[ // @phpstan-ignore-line
'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC');
+ $query->where('rules.active', true);
},
'rules.ruleTriggers' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC');
@@ -319,6 +320,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
[ // @phpstan-ignore-line
'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC');
+ $query->where('rules.active', true);
},
'rules.ruleTriggers' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC');
diff --git a/app/TransactionRules/Actions/UpdatePiggyBank.php b/app/TransactionRules/Actions/UpdatePiggyBank.php
index 9e21497d97..7a0bd2daaf 100644
--- a/app/TransactionRules/Actions/UpdatePiggyBank.php
+++ b/app/TransactionRules/Actions/UpdatePiggyBank.php
@@ -59,9 +59,7 @@ class UpdatePiggyBank implements ActionInterface
$piggyBank = $this->findPiggyBank($user, $actionValue);
if (!$piggyBank instanceof PiggyBank) {
- Log::info(
- sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $actionValue, $this->action->id, $this->action->rule_id)
- );
+ Log::info(sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $actionValue, $this->action->id, $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_piggy', ['name' => $actionValue])));
return false;