Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix some rule things.
James Colef3b979821684
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex a2fb2224de..6a77568244 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -248,7 +248,7 @@ class JournalRepository implements JournalRepositoryInterface/** @var Collection $transactions */$transactions = $journal->transactions()- ->groupBy('transactions.id')+ ->groupBy($groupBy)->orderBy('transactions.id')->get($fields);break;case TransactionType::WITHDRAWAL:diff --git a/app/Rules/Actions/SetBudget.php b/app/Rules/Actions/SetBudget.phpindex 441b617186..106b9fe706 100644--- a/app/Rules/Actions/SetBudget.php+++ b/app/Rules/Actions/SetBudget.php@@ -15,6 +15,7 @@ namespace FireflyIII\Rules\Actions;use FireflyIII\Models\Budget;use FireflyIII\Models\RuleAction;use FireflyIII\Models\TransactionJournal;+use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use Log;@@ -55,13 +56,22 @@ class SetBudget implements ActionInterfacereturn $current->name == $search;})->first();- if (!is_null($budget)) {- Log::debug(sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal->id, $budget->id, $budget->name));+ if (is_null($budget)) {+ Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal->id, $search));- $journal->budgets()->sync([$budget->id]);+ return true;}- Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal->id, $search));+ if ($journal->transactionType->type == TransactionType::TRANSFER) {+ Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a transfer.', $journal->id, $search));++ return true;+ }++ Log::debug(sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal->id, $budget->id, $budget->name));++ $journal->budgets()->sync([$budget->id]);+return true;}diff --git a/app/Rules/Processor.php b/app/Rules/Processor.phpindex 139b86bb8d..530b996718 100644--- a/app/Rules/Processor.php+++ b/app/Rules/Processor.php@@ -63,14 +63,6 @@ final class ProcessorLog::debug(sprintf('Making new rule from Rule %d', $rule->id));$self = new self;$self->rule = $rule;-- /*- * The number of "found triggers" must start at -1, because the first- * trigger is "create-journal" or "update-journal" when this Processor- * is called from a Rule.- */- $self->setFoundTriggers(-1);-$triggerSet = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();/** @var RuleTrigger $trigger */foreach ($triggerSet as $trigger) {@@ -189,7 +181,7 @@ final class Processorforeach ($this->actions as $action) {/** @var ActionInterface $actionClass */$actionClass = ActionFactory::getAction($action);- Log::debug(sprintf('Fire action %s on journal #%d', $actionClass, $this->journal->id));+ Log::debug(sprintf('Fire action %s on journal #%d', get_class($actionClass), $this->journal->id));$actionClass->act($this->journal);if ($action->stop_processing) {Log::debug('Stop processing now and break.');@@ -212,6 +204,7 @@ final class ProcessorLog::debug('start of Processor::triggered()');$foundTriggers = $this->getFoundTriggers();$hitTriggers = 0;+ Log::debug(sprintf('Found triggers starts at %d', $foundTriggers));/** @var AbstractTrigger $trigger */foreach ($this->triggers as $trigger) {$foundTriggers++;