mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
make sure all forms work as expected for b3.
This commit is contained in:
@@ -263,59 +263,16 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
*/
|
||||
public function moveRule(Rule $rule, RuleGroup $ruleGroup, int $order): Rule
|
||||
{
|
||||
$rule->order = $order;
|
||||
if ($rule->rule_group_id !== $ruleGroup->id) {
|
||||
$rule->rule_group_id = $ruleGroup->id;
|
||||
}
|
||||
$rule->save();
|
||||
$rule->refresh();
|
||||
$this->setOrder($rule, $order);
|
||||
|
||||
return $rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleActions(Rule $rule, array $ids): bool
|
||||
{
|
||||
$order = 1;
|
||||
foreach ($ids as $actionId) {
|
||||
/** @var RuleTrigger $trigger */
|
||||
$action = $rule->ruleActions()->find($actionId);
|
||||
if (null !== $action) {
|
||||
$action->order = $order;
|
||||
$action->save();
|
||||
++$order;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleTriggers(Rule $rule, array $ids): bool
|
||||
{
|
||||
$order = 1;
|
||||
foreach ($ids as $triggerId) {
|
||||
/** @var RuleTrigger $trigger */
|
||||
$trigger = $rule->ruleTriggers()->find($triggerId);
|
||||
if (null !== $trigger) {
|
||||
$trigger->order = $order;
|
||||
$trigger->save();
|
||||
++$order;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
|
@@ -132,22 +132,6 @@ interface RuleRepositoryInterface
|
||||
*/
|
||||
public function moveRule(Rule $rule, RuleGroup $ruleGroup, int $order): Rule;
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleActions(Rule $rule, array $ids): bool;
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleTriggers(Rule $rule, array $ids): bool;
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
|
Reference in New Issue
Block a user