Skip to content

Commit

Permalink
Fix #9601 - Fix bug where report conditions parenthesis pairs would n…
Browse files Browse the repository at this point in the history
…ot save correctly.
  • Loading branch information
MikeyJC authored and jack7anderson7 committed Jun 22, 2023
1 parent de449e6 commit 558c1a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/AOR_Conditions/AOR_Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ public function save_lines($post_data, $parent, $key = '')
}
}
}
if ($field_name == 'parenthesis' && $post_data[$key . $field_name][$i] == 'END') {
if (!isset($lastParenthesisStartConditionId)) {
if ($field_name === 'parenthesis' && $post_data[$key . $field_name][$i] !== 'START') {
if (!isset($lastParenthesisStartConditionIds)) {
throw new Exception('a closure parenthesis has no starter pair');
}
$condition->parenthesis = $lastParenthesisStartConditionId;
$condition->parenthesis = array_pop($lastParenthesisStartConditionIds);
} else {
$condition->$field_name = $post_data[$key . $field_name][$i];
}
Expand All @@ -149,8 +149,8 @@ public function save_lines($post_data, $parent, $key = '')
}
$condition->aor_report_id = $parent->id;
$conditionId = $condition->save();
if ($condition->parenthesis == 'START') {
$lastParenthesisStartConditionId = $conditionId;
if ($condition->parenthesis === 'START') {
$lastParenthesisStartConditionIds[] = $conditionId;
}
}
}
Expand Down

0 comments on commit 558c1a1

Please sign in to comment.