From 2ae348b088bb581cdb783d0b7f88e600f14dee1e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 9 Jun 2012 23:33:57 -0400 Subject: [PATCH] Fixed issue #06186: Array Question Type: EM doesn't convert condition correctly, AND becomes OR Dev ConvertConditionsToRelevance was not ANDing together conditions from different sub-questions within the same question. Dev the automatic upgrade to database version 155.5 will fix this in the database for all questions --- classes/expressions/LimeExpressionManager.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/classes/expressions/LimeExpressionManager.php b/classes/expressions/LimeExpressionManager.php index ceb3df5e463..b7a492fdea0 100644 --- a/classes/expressions/LimeExpressionManager.php +++ b/classes/expressions/LimeExpressionManager.php @@ -799,6 +799,7 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL) $_qid = $row['qid']; $_scenario = $row['scenario']; $_cqid = $row['cqid']; + $_fieldname = -1; $relAndList = array(); $relOrList = array(); $scenarios = array(); @@ -815,12 +816,14 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL) $relOrList = array(); $_scenario = $row['scenario']; $_cqid = $row['cqid']; + $_fieldname = -1; } if ($row['cqid'] != $_cqid) { $relAndList[] = '(' . implode(' or ', $relOrList) . ')'; $relOrList = array(); $_cqid = $row['cqid']; + $_fieldname = -1; } // fix fieldnames @@ -844,6 +847,12 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL) $fieldname = $row['cfieldname'] . '.NAOK'; $value = $row['value']; } + if ($_fieldname != -1 && $_fieldname != $fieldname) + { + $relAndList[] = '(' . implode(' or ', $relOrList) . ')'; + $relOrList = array(); + } + $_fieldname = $fieldname; // fix values if (preg_match('/^@\d+X\d+X\d+.*@$/',$value)) {