mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix bill from rule
This commit is contained in:
parent
ed17600f79
commit
63794cab07
@ -118,15 +118,26 @@ trait ModelInformation
|
|||||||
*/
|
*/
|
||||||
protected function getTriggersForBill(Bill $bill): array // get info and augument
|
protected function getTriggersForBill(Bill $bill): array // get info and augument
|
||||||
{
|
{
|
||||||
$result = [];
|
// TODO duplicated code.
|
||||||
$triggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
|
$operators = config('firefly.search.operators');
|
||||||
$values = [
|
$triggers = [];
|
||||||
|
foreach ($operators as $key => $operator) {
|
||||||
|
if ('user_action' !== $key && false === $operator['alias']) {
|
||||||
|
|
||||||
|
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
asort($triggers);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
$billTriggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
|
||||||
|
$values = [
|
||||||
$bill->transactionCurrency()->first()->name,
|
$bill->transactionCurrency()->first()->name,
|
||||||
round((float) $bill->amount_min, 12),
|
round((float) $bill->amount_min, 12),
|
||||||
round((float) $bill->amount_max, 12),
|
round((float) $bill->amount_max, 12),
|
||||||
$bill->name,
|
$bill->name,
|
||||||
];
|
];
|
||||||
foreach ($triggers as $index => $trigger) {
|
foreach ($billTriggers as $index => $trigger) {
|
||||||
try {
|
try {
|
||||||
$string = view(
|
$string = view(
|
||||||
'rules.partials.trigger',
|
'rules.partials.trigger',
|
||||||
@ -135,6 +146,7 @@ trait ModelInformation
|
|||||||
'oldValue' => $values[$index],
|
'oldValue' => $values[$index],
|
||||||
'oldChecked' => false,
|
'oldChecked' => false,
|
||||||
'count' => $index + 1,
|
'count' => $index + 1,
|
||||||
|
'triggers' => $triggers,
|
||||||
]
|
]
|
||||||
)->render();
|
)->render();
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
@ -161,8 +173,8 @@ trait ModelInformation
|
|||||||
private function getTriggersForJournal(TransactionJournal $journal): array
|
private function getTriggersForJournal(TransactionJournal $journal): array
|
||||||
{
|
{
|
||||||
// TODO duplicated code.
|
// TODO duplicated code.
|
||||||
$operators = config('firefly.search.operators');
|
$operators = config('firefly.search.operators');
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
foreach ($operators as $key => $operator) {
|
foreach ($operators as $key => $operator) {
|
||||||
if ('user_action' !== $key && false === $operator['alias']) {
|
if ('user_action' !== $key && false === $operator['alias']) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user