Skip to content

Commit

Permalink
Fix import rule (fata error) when the criteria or action is a dropdow… (
Browse files Browse the repository at this point in the history
#31)

* Fix import rule (fata error) when the criteria or action is a dropdown and the id has been deleted
  • Loading branch information
ddurieux authored Feb 20, 2024
1 parent 191adc9 commit cf07e50
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/rulecollection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ static function previewImportRules() {
if (self::isCriteraADropdown($available_criteria,
$criteria['condition'], $crit)) {
//escape pattern
if (is_array($criteria['pattern'])
&& empty($criteria['pattern'])) {
continue;
}
$criteria['pattern'] = $DB->escape(Html::entity_decode_deep($criteria['pattern']));
$itemtype = getItemTypeForTable($available_criteria[$crit]['table']);
$item = new $itemtype();
Expand Down Expand Up @@ -1121,6 +1125,10 @@ static function previewImportRules() {
}

//escape value
if (is_array($action['value'])
&& empty($action['value'])) {
continue;
}
$action['value'] = $DB->escape(Html::entity_decode_deep($action['value']));
$itemtype = getItemTypeForTable($available_actions[$act]['table']);
$item = new $itemtype();
Expand Down

0 comments on commit cf07e50

Please sign in to comment.