Skip to content

Commit c81fd09

Browse files
committed
EventRuleConfigForm: Fix zero condition escalation assignment for new event rule
1 parent 4bbe6f0 commit c81fd09

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

application/forms/EventRuleConfigForm.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,15 @@ protected function assemble(): void
139139
]
140140
);
141141

142-
$this->addElement('hidden', 'zero-condition-escalation');
142+
$defaultEscalationPrefix = bin2hex('1');
143143
$ruleId = $this->config['id'];
144144

145+
$this->addElement(
146+
'hidden',
147+
'zero-condition-escalation',
148+
['value' => $ruleId === '-1' ? $defaultEscalationPrefix : null]
149+
);
150+
145151
$configFilter = new EventRuleConfigFilter($this->searchEditorUrl, $this->config['object_filter']);
146152
$this->registerElement($configFilter);
147153

@@ -156,20 +162,14 @@ protected function assemble(): void
156162
);
157163

158164
$this->registerElement($addEscalationButton);
159-
$prefixesElement = $this->createElement('hidden', 'prefixes-map', ['value' => bin2hex('1')]);
165+
$prefixesElement = $this->createElement('hidden', 'prefixes-map', ['value' => $defaultEscalationPrefix]);
160166
$this->addElement($prefixesElement);
161167
$this->handleAdd();
162168

163169
$prefixesMapString = $prefixesElement->getValue();
164170
$prefixesMap = explode(',', $prefixesMapString);
165171
$escalationCount = count($prefixesMap);
166172
$zeroConditionEscalation = $this->getValue('zero-condition-escalation');
167-
168-
if ($ruleId === '-1' && $escalationCount === 1 && $zeroConditionEscalation === null) {
169-
$zeroConditionEscalation = bin2hex('1');
170-
$this->getElement('zero-condition-escalation')->setValue($zeroConditionEscalation);
171-
}
172-
173173
$removePosition = null;
174174
$removeEscalationButtons = [];
175175

0 commit comments

Comments
 (0)