Skip to content

Commit

Permalink
Fixed #4534: Sometimes multiple options questions get the other field…
Browse files Browse the repository at this point in the history
… while they shouldn't

dev: fieldmap function corrected, if code reads survey db table it still finds the extra fields!

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@9065 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
mennodekker committed Aug 17, 2010
1 parent d09325e commit 636a9b9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions common.php
Expand Up @@ -2395,7 +2395,6 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
$aresult = db_execute_assoc($aquery) or safe_die ("Couldn't get list of questions in createFieldMap function.<br />$query<br />".$connect->ErrorMsg()); //Checked
while ($arow=$aresult->FetchRow()) //With each question, create the appropriate field(s)
{

if ($arow['hasconditions']>0)
{
$conditions = "Y";
Expand Down Expand Up @@ -2511,7 +2510,6 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
"qid"=>$arow['qid'],
"aid"=>$abrow['title']."_".$answer['title'],
"sqid"=>$abrow['qid']);
if ($abrow['other']=="Y") {$alsoother="Y";}
if ($style == "full")
{
$fieldmap[$fieldname]['title']=$arow['title'];
Expand Down Expand Up @@ -2590,7 +2588,6 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
{
$fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}";
$fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title']);
if ($abrow['other']=="Y") {$alsoother="Y";}
if ($style == "full")
{
$fieldmap[$fieldname]['title']=$arow['title'];
Expand Down Expand Up @@ -2618,7 +2615,7 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
}
}
}
if ((isset($alsoother) && $alsoother=="Y") && ($arow['type']=="M" || $arow['type']=="P"))
if ($arow['other']=="Y" && ($arow['type']=="M" || $arow['type']=="P"))
{
$fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}other";
$fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>"other");
Expand Down

0 comments on commit 636a9b9

Please sign in to comment.