View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05013 | Bug reports | Print View | public | 2011-03-09 19:27 | 2011-04-11 11:30 |
Reporter | Assigned To | lemeur | |||
Priority | low | Severity | text | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.90+ | ||||
Fixed in Version | 1.91RC6 | ||||
Summary | 05013: GSOC - Filter settings based on token information not properly displayed in printable version | ||||
Description | Sorry if this has been reported or solved already (didn't find anything): When conditions are based on token information (or more precisely, on additional token fields), these information is not correctly displayed in the printable survey view. Instead of displaying any useful information (e.g., only answer if 'man = yes'), the following text is presented: "Only answer this question if the following conditions are met: Seems wrong because (1) these conditions aren't based on questions and (2) no information about actual filter (source, value) is given. | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
Attached Files | 05013-stable c.patch (8,106 bytes)
Index: printablesurvey.php =================================================================== --- printablesurvey.php (revision 9914) +++ printablesurvey.php (working copy) @@ -400,6 +400,7 @@ $group['ODD_EVEN'] = ' g-row-even'; } + //Loop through questions foreach ($deqrows as $deqrow) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -418,6 +419,7 @@ $scenarioquery="SELECT DISTINCT ".db_table_name("conditions").".scenario FROM ".db_table_name("conditions")." WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} ORDER BY scenario"; $scenarioresult=db_execute_assoc($scenarioquery); + //Loop through distinct scenarios, thus grouping them together. while ($scenariorow=$scenarioresult->FetchRow()) { if($s == 0 && $scenarioresult->RecordCount() > 1) @@ -430,13 +432,14 @@ } $x=0; - $distinctquery="SELECT cqid, method + $distinctquery="SELECT cqid, method, cfieldname, value FROM ".db_table_name("conditions")." WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']} group by cqid, method ORDER BY cqid"; $distinctresult=db_execute_assoc($distinctquery); + //Loop through each condition for a particular scenario. while ($distinctrow=$distinctresult->FetchRow()) { $subquery='select title, question from '.db_table_name("questions")." where qid={$distinctrow['cqid']} AND parent_qid=0 AND language='{$surveyprintlang}'"; @@ -451,38 +454,78 @@ $distinctrow['method']='=='; } - if($distinctrow['method']=='==') - { - $explanation .= $clang->gT("Answer was")." "; + if($distinctrow['cqid']){ + if($distinctrow['method']=='==') + { + $explanation .= $clang->gT("Answer was")." "; + } + elseif($distinctrow['method']=='!=') + { + $explanation .= $clang->gT("Answer was NOT")." "; + } + elseif($distinctrow['method']=='<') + { + $explanation .= $clang->gT("Answer was less than")." "; + } + elseif($distinctrow['method']=='<=') + { + $explanation .= $clang->gT("Answer was less than or equal to")." "; + } + elseif($distinctrow['method']=='>=') + { + $explanation .= $clang->gT("Answer was greater than or equal to")." "; + } + elseif($distinctrow['method']=='>') + { + $explanation .= $clang->gT("Answer was greater than")." "; + } + elseif($distinctrow['method']=='RX') + { + $explanation .= $clang->gT("Answer matched (regexp)")." "; + } + else + { + $explanation .= $clang->gT("Answer was")." "; + } } - elseif($distinctrow['method']=='!=') - { - $explanation .= $clang->gT("Answer was NOT")." "; + if(!$distinctrow['cqid']){ + $tokenData = GetTokenFieldsAndNames($surveyid); + preg_match('/^{TOKEN:([^}]*)}$/',$distinctrow['cfieldname'],$extractedTokenAttr); + $explanation .= "Your ".$tokenData[strtolower($extractedTokenAttr[1])]." "; + if($distinctrow['method']=='==') + { + $explanation .= $clang->gT("is")." "; + } + elseif($distinctrow['method']=='!=') + { + $explanation .= $clang->gT("is NOT")." "; + } + elseif($distinctrow['method']=='<') + { + $explanation .= $clang->gT("is less than")." "; + } + elseif($distinctrow['method']=='<=') + { + $explanation .= $clang->gT("is less than or equal to")." "; + } + elseif($distinctrow['method']=='>=') + { + $explanation .= $clang->gT("is greater than or equal to")." "; + } + elseif($distinctrow['method']=='>') + { + $explanation .= $clang->gT("is greater than")." "; + } + elseif($distinctrow['method']=='RX') + { + $explanation .= $clang->gT("is matched (regexp)")." "; + } + else + { + $explanation .= $clang->gT("is")." "; + } + $answer_section = $distinctrow['value']; } - elseif($distinctrow['method']=='<') - { - $explanation .= $clang->gT("Answer was less than")." "; - } - elseif($distinctrow['method']=='<=') - { - $explanation .= $clang->gT("Answer was less than or equal to")." "; - } - elseif($distinctrow['method']=='>=') - { - $explanation .= $clang->gT("Answer was greater than or equal to")." "; - } - elseif($distinctrow['method']=='>') - { - $explanation .= $clang->gT("Answer was greater than")." "; - } - elseif($distinctrow['method']=='RX') - { - $explanation .= $clang->gT("Answer matched (regexp)")." "; - } - else - { - $explanation .= $clang->gT("Answer was")." "; - } $conquery="SELECT cid, cqid, q.title,\n" ."q.question, value, q.type, cfieldname\n" @@ -689,7 +732,12 @@ unset($conditions); // Following line commented out because answer_section was lost, but is required for some question types //$explanation .= " ".$clang->gT("to question")." '".$mapquestionsNumbers[$distinctrow['cqid']]."' $answer_section "; - $explanation .= " ".$clang->gT("at question")." '".$mapquestionsNumbers[$distinctrow['cqid']]." [".$subresult['title']."]' (".strip_tags($subresult['question'])."$answer_section)" ; + if($distinctrow['cqid']){ + $explanation .= " ".$clang->gT("at question")." '".$mapquestionsNumbers[$distinctrow['cqid']]." [".$subresult['title']."]' (".strip_tags($subresult['question'])."$answer_section)" ; + } + else{ + $explanation .= " ".$distinctrow['value'] ; + } //$distinctrow $x++; } | ||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 9642 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | Firefox 3 | ||||
Database type & version | MySQL | ||||
Server OS (if known) | don't know | ||||
Webserver software & version (if known) | don't know | ||||
PHP Version | don't know | ||||
If a GSoC applicant wants do give it a try, the fix is to be applied to admin/printablesurvey.php below line 391. Conditions based on token information use the {TOKEN:XXX} placeholder as then condition value. See my comment in ticket 05031 |
|
Hi Lemeur, Please see my attempt at a patch above. The survey I attached was what I used to test and the resulting printout. In case you have difficulties with the survey I have added a after (05013.png) and before (05013 pre patch.png) screenshot. Not too sure if it is an appropriate fix, especially with regards to translations. Would love some feedback:) Regards, |
|
Sorry for the delay, |
|
Good work. Thx, PS: if you want a more challenging ticket, have a look at "05031: GSOC - update answercodes does not update conditions" |
|
1.91RC6 released. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-09 19:27 |
|
New Issue | |
2011-03-10 12:27 | c_schmitz | Assigned To | => lemeur |
2011-03-10 12:27 | c_schmitz | Status | new => assigned |
2011-03-20 07:44 | lemeur | Summary | Filter settings based on token information not properly displayed in printable version => GSOC - Filter settings based on token information not properly displayed in printable version |
2011-03-20 07:46 | lemeur | Note Added: 14469 | |
2011-03-28 02:08 | pasmaill | File Added: 05013-stable c.patch | |
2011-03-28 02:08 | pasmaill | File Added: limesurvey_survey_85474b.lss | |
2011-03-28 02:37 | pasmaill | Note Added: 14583 | |
2011-03-28 02:39 | pasmaill | File Added: 05013.png | |
2011-03-28 02:42 | pasmaill | File Added: 05013 pre patch.png | |
2011-03-28 02:44 | pasmaill | Note Edited: 14583 | |
2011-03-29 00:45 | pasmaill | Issue Monitored: pasmaill | |
2011-03-29 18:39 |
|
Issue Monitored: user13064 | |
2011-03-29 22:01 | lemeur | Note Added: 14609 | |
2011-03-29 22:28 | lemeur | Note Added: 14610 | |
2011-03-29 22:28 | lemeur | Note Edited: 14610 | |
2011-03-29 22:29 | lemeur | Status | assigned => resolved |
2011-03-29 22:29 | lemeur | Fixed in Version | => 1.91RC6 |
2011-03-29 22:29 | lemeur | Resolution | open => fixed |
2011-03-29 23:57 |
|
Issue End Monitor: user13064 | |
2011-04-11 11:30 | c_schmitz | Note Added: 14754 | |
2011-04-11 11:30 | c_schmitz | Status | resolved => closed |
2021-08-02 16:48 | guest | Bug heat | 6 => 8 |