Anonymous Login
2016-12-09 00:54 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
05439Bug reports[All Projects] Survey takingpublic2011-09-07 09:16
Reporterronvdburg 
Assigned Toc_schmitz 
PriorityhighSeveritymajor 
StatusclosedResolutionfixed 
Product Version1.91+ 
Target VersionFixed in Version1.91+ 
Summary05439: {TOKEN:ATTRIBUTE_1} is not replaced everywhere
DescriptionI used {TOKEN:ATTRIBUTE_1} in the question text.
This works properly when taking a survey.
This works properly when printing (printanswers.php).

However, the token attribute replacement is NOT done in exporting the answers to pdf (PDF Export).
Steps To ReproduceMake sure you have a survey with at least 1 (user defined) attribute.
Change a question text containing {TOKEN:ATTRIBUTE_1}.
Make the survey active & closed.
Create a token entry and add a proper text to the Token's attribute 1.
Take the survey and see:
= The question text properly replaces {TOKEN:ATTRIBUTE_1} with the proper text.
Now finish the survey and press submit.
Do print the survey and verify:
= The (html version) of the printable survey replaces properly.
= The PDF version shows {TOKEN:ATTRIBUTE_1} in stead of replacing it.
Additional InformationCould you please have repaired this today, my customer wants to send out the survey tomorrow.

If not possible, can you give me a hint to fix it myself (and uploading the patch)?

I see there exists a tokenReplace function in replacements.php.
TagsNo tags attached.
Complete LimeSurvey version number (& build)10746
I will donate to the project if issue is resolvedNo
Browser
Database & DB-Versionmysql 14.12
Operating System (Server)Centos 2.2.3 (Linux version 2.6.18-194.3.1.el5)
Webserver software & versionApache/2.2.3 (CentOS)
PHP Version5.1.6
Attached Files
  • txt file icon printanswers.php.svn-diff.txt (1,453 bytes) 2011-09-02 13:57 -
    Index: printanswers.php
    ===================================================================
    --- printanswers.php	(revision 10920)
    +++ printanswers.php	(working copy)
    @@ -224,7 +224,7 @@
         {
             if(isset($_POST['printableexport']))
             {
    -            $pdf->intopdf(FlattenText($fname[0].$fname[1],true).": ".$fname[2]);
    +            $pdf->intopdf(FlattenText(tokenReplace($fname[0].$fname[1]),true).": ".$fname[2]);
                 $pdf->ln(2);
             }
             else
    Index: admin/printablesurvey.php
    ===================================================================
    --- admin/printablesurvey.php	(revision 10920)
    +++ admin/printablesurvey.php	(working copy)
    @@ -779,7 +779,7 @@
                 $question = array(
     					 'QUESTION_NUMBER' => $total_questions	// content of the question code field
                 ,'QUESTION_CODE' => $deqrow['title']
    -            ,'QUESTION_TEXT' => preg_replace('/(?:<br ?\/?>|<\/(?:p|h[1-6])>)$/is' , '' , $deqrow['question'])	// content of the question field
    +            ,'QUESTION_TEXT' => preg_replace('/(?:<br ?\/?>|<\/(?:p|h[1-6])>)$/is' , '' , tokenReplace($deqrow['question']))	// content of the question field
                 ,'QUESTION_SCENARIO' => $explanation	// if there are conditions on a question, list the conditions.
                 ,'QUESTION_MANDATORY' => ''		// translated 'mandatory' identifier
                 ,'QUESTION_ID' => $deqrow['qid']    // id to be added to wrapping question div
    
    txt file icon printanswers.php.svn-diff.txt (1,453 bytes) 2011-09-02 13:57 +

-Relationships
+Relationships

-Notes

~16188

c_schmitz (administrator)

Hi ronvdburg

are you a donator?

~16191

ronvdburg (reporter)

No, not with money, but I donate all the patches that I need (and are paid) by my customer.

~16192

c_schmitz (administrator)

ok, will have a look

~16208

ronvdburg (reporter)

Hi Carsten,

I found the issue and repaired it for my survey.
The patch is uploaded. Indeed it was so easy that I am ashamed that it took me so long.

The patch only does a tokenReplace in the question text; if you would like to also replace token fields elsewhere (e.g. the Group text), please let me know and I will send a new patch / svn-diff.

Regards,

Ron

~16215

c_schmitz (administrator)

Thank you. No further patch is needed for that because the replacement functions will be completel rewritten in the next version.

~16242

c_schmitz (administrator)

New version released
+Notes

-Issue History
Date Modified Username Field Change
2011-09-01 16:11 ronvdburg New Issue
2011-09-01 18:51 c_schmitz Note Added: 16188
2011-09-01 18:51 c_schmitz Assigned To => c_schmitz
2011-09-01 18:51 c_schmitz Status new => feedback
2011-09-01 19:29 ronvdburg Note Added: 16191
2011-09-01 19:29 ronvdburg Status feedback => assigned
2011-09-01 21:22 c_schmitz Note Added: 16192
2011-09-02 13:57 ronvdburg File Added: printanswers.php.svn-diff.txt
2011-09-02 14:01 ronvdburg Note Added: 16208
2011-09-02 17:27 c_schmitz Note Added: 16215
2011-09-02 17:27 c_schmitz Status assigned => resolved
2011-09-02 17:27 c_schmitz Fixed in Version => 1.91+
2011-09-02 17:27 c_schmitz Resolution open => fixed
2011-09-07 09:16 c_schmitz Note Added: 16242
2011-09-07 09:16 c_schmitz Status resolved => closed
+Issue History