Skip to content

Commit

Permalink
Fixed issue PHP errors thrown if use invalid array filter question
Browse files Browse the repository at this point in the history
Dev converted exclusive_option to use is_empty() instead of != ""
Dev Confirmed that exclusive_option works for all single-entry multiple question types
  • Loading branch information
TMSWhite committed Jun 17, 2012
1 parent fc4fe01 commit ec41d47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion classes/expressions/LimeExpressionManager.php
Expand Up @@ -1085,6 +1085,10 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
{
$sgq = ((isset($this->qcode2sgq[$_caf])) ? $this->qcode2sgq[$_caf] : $_caf);
$fqid = explode('X',$sgq);
if (!isset($fqid[2]))
{
continue;
}
$fqid = $fqid[2];
$fsqs = array();
foreach ($this->q2subqInfo[$fqid]['subqs'] as $fsq)
Expand All @@ -1103,6 +1107,10 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
{
$sgq = ((isset($this->qcode2sgq[$_cafe])) ? $this->qcode2sgq[$_cafe] : $_cafe);
$fqid = explode('X',$sgq);
if (!isset($fqid[2]))
{
continue;
}
$fqid = $fqid[2];
$fsqs = array();
foreach ($this->q2subqInfo[$fqid]['subqs'] as $fsq)
Expand Down Expand Up @@ -1281,8 +1289,16 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
}
switch ($type)
{
case ':': //ARRAY (Multi Flexi) 1 to 10
case 'A': //ARRAY (5 POINT CHOICE) radio-buttons
case 'B': //ARRAY (10 POINT CHOICE) radio-buttons
case 'C': //ARRAY (YES/UNCERTAIN/NO) radio-buttons
case 'E': //ARRAY (Increase/Same/Decrease) radio-buttons
case 'F': //ARRAY (Flexible) - Row Format
case 'M': //Multiple choice checkbox
case 'P': //Multiple choice with comments checkbox + text
case 'K': //MULTIPLE NUMERICAL QUESTION
case 'Q': //MULTIPLE SHORT TEXT
if ($this->sgqaNaming)
{
$sq_name = $qinfo['sgqa'] . trim($exclusive_option) . '.NAOK';
Expand All @@ -1300,7 +1316,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
'qtype' => $type,
'type' => 'exclude_all_others',
'rowdivid' => $sq['rowdivid'],
'eqn' => '(' . $sq_name . ' == "")',
'eqn' => 'is_empty(' . $sq_name . ')',
'qid' => $questionNum,
'sgqa' => $qinfo['sgqa'],
);
Expand Down
2 changes: 1 addition & 1 deletion common_functions.php
Expand Up @@ -3377,7 +3377,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT('Sub-question validation tip'));

$qattributes["exclude_all_others"]=array(
"types"=>"MP",
"types"=>":ABCEFMPKQ",
'category'=>$clang->gT('Logic'),
'sortorder'=>130,
'inputtype'=>'text',
Expand Down

0 comments on commit ec41d47

Please sign in to comment.