mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Fix for #1406
This commit is contained in:
@@ -161,28 +161,41 @@ class UpgradeDatabase extends Command
|
|||||||
'order' => 2,
|
'order' => 2,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
if ($bill->amount_max !== $bill->amount_min) {
|
||||||
// add triggers for amounts:
|
// add triggers for amounts:
|
||||||
RuleTrigger::create(
|
RuleTrigger::create(
|
||||||
[
|
[
|
||||||
'rule_id' => $rule->id,
|
'rule_id' => $rule->id,
|
||||||
'trigger_type' => 'amount_less',
|
'trigger_type' => 'amount_less',
|
||||||
'trigger_value' => round($bill->amount_max, $currency->decimal_places),
|
'trigger_value' => round($bill->amount_max, $currency->decimal_places),
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'stop_processing' => 0,
|
'stop_processing' => 0,
|
||||||
'order' => 3,
|
'order' => 3,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
RuleTrigger::create(
|
RuleTrigger::create(
|
||||||
[
|
[
|
||||||
'rule_id' => $rule->id,
|
'rule_id' => $rule->id,
|
||||||
'trigger_type' => 'amount_more',
|
'trigger_type' => 'amount_more',
|
||||||
'trigger_value' => round($bill->amount_min, $currency->decimal_places),
|
'trigger_value' => round($bill->amount_min, $currency->decimal_places),
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'stop_processing' => 0,
|
'stop_processing' => 0,
|
||||||
'order' => 4,
|
'order' => 4,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
if($bill->amount_max === $bill->amount_min) {
|
||||||
|
RuleTrigger::create(
|
||||||
|
[
|
||||||
|
'rule_id' => $rule->id,
|
||||||
|
'trigger_type' => 'amount_exactly',
|
||||||
|
'trigger_value' => round($bill->amount_min, $currency->decimal_places),
|
||||||
|
'active' => 1,
|
||||||
|
'stop_processing' => 0,
|
||||||
|
'order' => 3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// create action
|
// create action
|
||||||
RuleAction::create(
|
RuleAction::create(
|
||||||
@@ -602,12 +615,16 @@ class UpgradeDatabase extends Command
|
|||||||
$opposing->transaction_currency_id = $currency->id;
|
$opposing->transaction_currency_id = $currency->id;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
$opposing->save();
|
$opposing->save();
|
||||||
Log::debug(sprintf('Currency for account "%s" is %s, and currency for account "%s" is also
|
Log::debug(
|
||||||
|
sprintf(
|
||||||
|
'Currency for account "%s" is %s, and currency for account "%s" is also
|
||||||
%s, so %s #%d (#%d and #%d) has been verified to be to %s exclusively.',
|
%s, so %s #%d (#%d and #%d) has been verified to be to %s exclusively.',
|
||||||
$opposing->account->name, $opposingCurrency->code,
|
$opposing->account->name, $opposingCurrency->code,
|
||||||
$transaction->account->name, $transaction->transactionCurrency->code,
|
$transaction->account->name, $transaction->transactionCurrency->code,
|
||||||
$journal->transactionType->type, $journal->id,
|
$journal->transactionType->type, $journal->id,
|
||||||
$transaction->id, $opposing->id, $currency->code));
|
$transaction->id, $opposing->id, $currency->code
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user