Skip to content

Commit

Permalink
Fixed issue #6854: INSERTANS or .shown not working for comment on Mul…
Browse files Browse the repository at this point in the history
…tiple options with comments

Fixed issue: EM return code for single choice question .shown
  • Loading branch information
Shnoulle committed Nov 21, 2012
1 parent 4528cb2 commit 1b47394
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion application/helpers/expressions/em_manager_helper.php
Expand Up @@ -6481,7 +6481,7 @@ private function _GetVarAttribute($name,$attr,$default,$gseq,$qseq)
{
$q = $var['q'];
$ansArray = isset($var['ansArray']) ? $var['ansArray'] : null;
return $q->getVarAttributeValueNAOK($name, $default, $gseq, $qseq, $ansArray);
return $q->getVarAttributeShown($name, $default, $gseq, $qseq, $ansArray);
}
case 'relevanceStatus':
$gseq = (isset($var['gseq'])) ? $var['gseq'] : -1;
Expand Down
9 changes: 3 additions & 6 deletions application/modules/CheckQuestion.php
Expand Up @@ -584,14 +584,11 @@ public function includeRelevanceStatus()

public function getVarAttributeShown($name, $default, $gseq, $qseq, $ansArray)
{
$code = LimeExpressionManager::GetVarAttribute($name,'code',$default,$gseq,$qseq);
if ($code == 'Y' && isset($this->sq) && !preg_match('/comment$/',$this->fieldname))
$code = parent::getVarAttributeShown($name,'code',$default,$gseq,$qseq);
if ($code == 'Y')
{
return $this->sq;
}
elseif (preg_match('/comment$/',$this->fieldname) && isset($_SESSION[$this->fieldname])) {
return $_SESSION[$this->fieldname];
}
else
{
return $default;
Expand Down Expand Up @@ -861,4 +858,4 @@ public function questionProperties($prop = false)
return $prop?$props[$prop]:$props;
}
}
?>
?>
14 changes: 13 additions & 1 deletion application/modules/CommentCheckQuestion.php
Expand Up @@ -316,6 +316,18 @@ public function getShownJS()
. 'return htmlspecialchars_decode(attr.question);';
}

public function getVarAttributeShown($name, $default, $gseq, $qseq, $ansArray)
{
$name=preg_replace('/\.shown$/','',$name);
if (preg_match('/comment$/',$name)) {
return LimeExpressionManager::GetVarAttribute($name,'code',$default,$gseq,$qseq);
}
else
{
return parent::getVarAttributeShown($name, $default, $gseq, $qseq, $ansArray);
}
}

public function getDataEntryView($language)
{
$meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$this->id} AND language='{$language->getlangcode()}' ORDER BY question_order, question";
Expand Down Expand Up @@ -412,4 +424,4 @@ public function questionProperties($prop = false)
return $prop?$props[$prop]:$props;
}
}
?>
?>
2 changes: 1 addition & 1 deletion application/modules/QuestionModule.php
Expand Up @@ -542,4 +542,4 @@ public function QueXMLAppendAnswers(&$question)
abstract public function availableAttributes($attr = false);
abstract public function questionProperties($prop = false);
}
?>
?>

0 comments on commit 1b47394

Please sign in to comment.