View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
05057Bug reportsSurvey takingpublic2012-01-24 21:39
Reporteruser12634Assigned Tolemeur  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00a1 
Fixed in Version1.92RC1 
Summary05057: using only "other" subquestion as a dynamic text (through SGQA) doesn't work
Description

"other" subqestions in multiple select questions has answer id "other" (eg. for multiple select question with SGQ 12X34X56 it would be 12X34X56other), but using {INSERTANS:12X34X56other} always produce "no answer" instead of the given answer.
I developed a quick and dirty modyfication of funcion retrieve_Answer() in common_functions.php (see below - I have added the code between "//<--MATEUSZ 25.03.2011" and "//-->") which solves this problem for me, but I'm not sure if it is correct for all use cases of that function.

function retrieve_Answer($code, $phpdateformat=null)
{
//This function checks to see if there is an answer saved in the survey session
//data that matches the $code. If it does, it returns that data.
//It is used when building a questions text to allow incorporating the answer
//to an earlier question into the text of a later question.
//IE: Q1: What is your name? [Jason]
// Q2: Hi [Jason] how are you ?
//This function is called from the retriveAnswers function.
global $dbprefix, $connect, $clang;
//Find question details
if (isset($_SESSION[$code]))
{
$questiondetails=getsidgidqidaidtype($code);
//the getsidgidqidaidtype function is in common.php and returns
//a SurveyID, GroupID, QuestionID and an Answer code
//extracted from a "fieldname" - ie: 1X2X3a
// also returns question type

    if ($questiondetails['type'] == &quot;M&quot; ||
    $questiondetails['type'] == &quot;P&quot;)
    {
        $query=&quot;SELECT * FROM {$dbprefix}questions WHERE parent_qid='&quot;.$questiondetails['qid'].&quot;' AND language='&quot;.$_SESSION['s_lang'].&quot;'&quot;;
        $result=db_execute_assoc($query) or safe_die(&quot;Error getting answer<br />$query<br />&quot;.$connect->ErrorMsg());  //Checked
        while($row=$result->FetchRow())
        {
            if (isset($_SESSION[$code.$row['title']]) && $_SESSION[$code.$row['title']] == &quot;Y&quot;)
            {
                $returns[] = $row['question'];
            }
            elseif (isset($_SESSION[$code]) && $_SESSION[$code] == &quot;Y&quot; && $questiondetails['aid']==$row['title'])
            {
                return $row['question'];
            }
        }
        //&lt;--MATEUSZ 25.03.2011
        if (isset($_SESSION[$code]) && $_SESSION[$code])
        {
            return $_SESSION[$code];
        }
        //-->
        if (isset($_SESSION[$code.&quot;other&quot;]) && $_SESSION[$code.&quot;other&quot;])
        {
            $returns[]=$_SESSION[$code.&quot;other&quot;];
        }
        if (isset($returns))
        {
            $return=implode(&quot;, &quot;, $returns);
            if (strpos($return, &quot;,&quot;))
            {
                $return=substr_replace($return, &quot; &&quot;, strrpos($return, &quot;,&quot;), 1);
            }
        }
        else
        {
            $return=$clang->gT(&quot;No answer&quot;);
        }
    }
    elseif (!$_SESSION[$code] && $_SESSION[$code] !=0)
    {
        $return=$clang->gT(&quot;No answer&quot;);
    }
    else
    {
        $return=getextendedanswer($code, $_SESSION[$code], 'INSERTANS',$phpdateformat);
    }
}
else
{
    $return=$clang->gT(&quot;Error&quot;) . &quot;($code)&quot;;
}
return html_escape($return);

}

TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)9797
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql 5.1
Server OS (if known)Ubuntu server 9.04
Webserver software & version (if known)Apache 2.2.12
PHP Version5.2.10

Relationships

has duplicate 05055 closedc_schmitz SGQA identifier with "ohter" answer in multiple select questions works bad 

Users monitoring this issue

There are no users monitoring this issue.

Activities

lemeur

lemeur

2011-03-29 22:33

developer   ~14612

thx for the detailed report,
I'll have a look at the provided fix soon.

lemeur

lemeur

2011-06-14 23:08

developer   ~15443

Last edited: 2011-06-14 23:08

another one for you bennettestone ;-)

c_schmitz

c_schmitz

2011-07-11 18:12

administrator   ~15726

Bennett, any progess?

c_schmitz

c_schmitz

2011-09-11 10:07

administrator   ~16259

lemeur, any progress?

lemeur

lemeur

2011-09-20 21:46

developer   ~16307

The other field beeing a Database field, it should handled by the new Expression Manager.
This means that Thomas has fixed this in a way ;-)

lemeur

lemeur

2011-10-11 22:03

developer   ~16393

Setting the target version to 2.0 since this has been implemented in the _ci branch by Thomas.

TMSWhite

TMSWhite

2012-01-20 17:09

reporter   ~16874

This is fixed in 1.92

Issue History

Date Modified Username Field Change
2011-03-25 23:54 user12634 New Issue
2011-03-25 23:54 user12634 Issue Monitored: user12634
2011-03-26 11:39 c_schmitz Assigned To => lemeur
2011-03-26 11:39 c_schmitz Status new => assigned
2011-03-26 11:55 c_schmitz Relationship added has duplicate 05055
2011-03-29 22:33 lemeur Note Added: 14612
2011-06-14 23:08 lemeur Assigned To lemeur => user14355
2011-06-14 23:08 lemeur Note Added: 15443
2011-06-14 23:08 lemeur Note Edited: 15443
2011-07-11 18:12 c_schmitz Note Added: 15726
2011-07-29 17:10 c_schmitz Assigned To user14355 => lemeur
2011-09-11 10:07 c_schmitz Note Added: 16259
2011-09-11 10:08 c_schmitz Status assigned => feedback
2011-09-20 21:46 lemeur Note Added: 16307
2011-10-11 22:02 lemeur Product Version 1.91RC4 => 2.00a1
2011-10-11 22:03 lemeur Note Added: 16393
2012-01-20 17:09 TMSWhite Note Added: 16874
2012-01-20 17:09 TMSWhite Status feedback => resolved
2012-01-20 17:09 TMSWhite Resolution open => fixed
2012-01-24 21:39 c_schmitz Fixed in Version => 1.92RC1
2012-01-24 21:39 c_schmitz Status resolved => closed