Small code cleanup.

This commit is contained in:
James Cole
2024-03-16 23:06:16 +01:00
parent 1bd3019c16
commit 7224f1be6f
11 changed files with 93 additions and 87 deletions
@@ -473,6 +473,18 @@ class SearchRuleEngine implements RuleEngineInterface
return false;
}
private function addNotes(array $transaction): array
{
$transaction['notes'] = '';
$dbNote = Note::where('noteable_id', (int)$transaction['transaction_journal_id'])->where('noteable_type', TransactionJournal::class)->first(['notes.*']);
if (null !== $dbNote) {
$transaction['notes'] = $dbNote->text;
}
Log::debug(sprintf('Notes of journal #%d filled in.', $transaction['transaction_journal_id']));
return $transaction;
}
/**
* Return true if the rule is fired (the collection is larger than zero).
*
@@ -542,16 +554,4 @@ class SearchRuleEngine implements RuleEngineInterface
}
}
}
private function addNotes(array $transaction): array
{
$transaction['notes'] = '';
$dbNote = Note::where('noteable_id', (int)$transaction['transaction_journal_id'])->where('noteable_type', TransactionJournal::class)->first(['notes.*']);
if (null !== $dbNote) {
$transaction['notes'] = $dbNote->text;
}
Log::debug(sprintf('Notes of journal #%d filled in.', $transaction['transaction_journal_id']));
return $transaction;
}
}