Skip to content

Commit

Permalink
Avoid using same var for method parameter and query construction, fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh authored and trasher committed Sep 14, 2018
1 parent bad3335 commit 7837de9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions inc/rule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,7 @@ function getRulesForCriteria($crit) {
/// TODO : not working for SLALevels : no sub_type

//Get all the rules whose sub_type is $sub_type and entity is $ID
$crit = [
$query = [
'SELECT' => $this->getTable() . '.id',
'FROM' => [
getTableForItemType($this->ruleactionclass),
Expand All @@ -2712,10 +2712,10 @@ function getRulesForCriteria($crit) {
];

foreach ($crit as $field => $value) {
$crit['WHERE'][getTableForItemType($this->ruleactionclass).'.'.$field] = $value;
$query['WHERE'][getTableForItemType($this->ruleactionclass).'.'.$field] = $value;
}

$iterator = $DB->request($crit);
$iterator = $DB->request($query);

while ($rule = $iterator->next()) {
$affect_rule = new Rule();
Expand Down
2 changes: 1 addition & 1 deletion inc/ruleimportentity.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function displayAdditionalRuleCondition($condition, $criteria, $name, $value, $t
function getAdditionalCriteriaDisplayPattern($ID, $condition, $pattern) {

$crit = $this->getCriteria($ID);
if ($crit['field'] == '_source') {
if (count($crit) && $crit['field'] == '_source') {
$name = Plugin::getInfo($pattern, 'name');
if (empty($name)) {
return false;
Expand Down

0 comments on commit 7837de9

Please sign in to comment.