View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
06748Bug reportsOtherpublic2012-11-02 21:42
Reportermpolo Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Fixed in Version2.00+ 
Summary06748: In PDF export the token table fields placeholders are not replaced
Description

If I use in my questions the token table fields placeholders (e.g. {TOKEN:FIRSTNAME}, {TOKEN:ATTRIBUTE_1} etc.), when the user prints the suvey at end they are correctly replaced in the onscreen printout, but if the user exports the survey answers in PDF with the button, he gets a PDF with the placeholders unreplaced (e.g. in the form {TOKEN:FIRSTNAME}, {TOKEN:ATTRIBUTE_1} )

Steps To Reproduce
  • create a survey using the token table fields placeholders, with the option to be printed and exported in PDF by the users
  • activate the survey
  • let a user completely fill the survey
  • he follows the link for printing the answers
  • in the print answers page he presses the button for exporting to PDF
  • the output PDF cotains unreplaced token table fields placeholders
Additional Information

I did by myself a little patch that solves the problem. Maybe it's not the cleanest solution, but it works fine. I hope this can be of any help and maybe introduced in future release.

in file
application\controllers\PrintanswersController.php

at line 212 substitute
$pdf->intopdf(flattenText($fname[0].$fname[1],false,true).": ".$fname[2]);

with
$pdf->intopdf(flattenText(templatereplace($fname[0]).$fname[1],false,true).": ".$fname[2]);

I've called templatereplace to let the function translate the placeholders in the field. In my case the placeholders are just in the survey question text of "text display" type, so I translated just $fname[0] and I din't need to tranlsate also $fname[1] and $fname[2], but I think for general use you have to templatereplace both.

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build)121019
I will donate to the project if issue is resolved
Browser
Database type & version
Server OS (if known)
Webserver software & version (if known)
PHP Version

Users monitoring this issue

mpolo

Activities

mdekker

mdekker

2012-10-24 11:57

reporter   ~21592

Could you please add a samplesurvey demonstrating the problem?

mpolo

mpolo

2012-10-25 01:07

reporter   ~21638

Hello, I've uploaded a sample PDF export with the placeholders unreplaced like they appeared before my little patch.

c_schmitz

c_schmitz

2012-10-30 20:38

administrator   ~21802

Can you please attach the survey as .lss file? Thank you.

mpolo

mpolo

2012-11-01 20:58

reporter   ~21881

I'm sorry I can't export the survey, it says
"XMLWriter class not compiled into PHP, please contact your system administrator"
but I can't put hands on the PHP installation.
Can I help you in some other way?

I would say just create a test survey with just one text-display question with a {TOKEN:FIRSTNAME} field in the "Question" field and try to answer and export in PDF...

c_schmitz

c_schmitz

2012-11-02 13:14

administrator   ~21909

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=10112

c_schmitz

c_schmitz

2012-11-02 13:15

administrator   ~21910

Thank you very much.

c_schmitz

c_schmitz

2012-11-02 14:02

administrator   ~21915

Fix committed to 2.1 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=10117

c_schmitz

c_schmitz

2012-11-02 21:42

administrator   ~21931

New version 2.00+ Build 121102 released.

Related Changesets

LimeSurvey: master 127432a5

2012-11-02 12:14:35

c_schmitz

Details Diff
Fixed issue 06748: In PDF export the token table fields placeholders are not replaced Affected Issues
06748
mod - application/controllers/PrintanswersController.php Diff File

LimeSurvey: 2.1 62d1735e

2012-11-02 13:01:00

c_schmitz

Details Diff
Fixed issue 06748: In PDF export the token table fields placeholders are not replaced Affected Issues
06748
mod - application/controllers/PrintanswersController.php Diff File

Issue History

Date Modified Username Field Change
2012-10-22 12:53 mpolo New Issue
2012-10-22 13:13 mpolo Issue Monitored: mpolo
2012-10-24 11:57 mdekker Assigned To => mdekker
2012-10-24 11:57 mdekker Status new => assigned
2012-10-24 11:57 mdekker Note Added: 21592
2012-10-24 11:57 mdekker Project @2@ => Bug reports
2012-10-24 11:57 mdekker Category Print view => Other issues
2012-10-25 01:05 mpolo File Added: istanza-per-il-conferimento-di-incarico-dirigenziale-936913.pdf
2012-10-25 01:07 mpolo Note Added: 21638
2012-10-30 09:13 mdekker Assigned To mdekker =>
2012-10-30 09:14 mdekker Status assigned => new
2012-10-30 20:38 c_schmitz Note Added: 21802
2012-10-30 20:38 c_schmitz Assigned To => c_schmitz
2012-10-30 20:38 c_schmitz Status new => feedback
2012-11-01 20:58 mpolo Note Added: 21881
2012-11-01 20:58 mpolo Status feedback => assigned
2012-11-02 13:14 c_schmitz Changeset attached => LimeSurvey master 127432a5
2012-11-02 13:14 c_schmitz Note Added: 21909
2012-11-02 13:14 c_schmitz Resolution open => fixed
2012-11-02 13:15 c_schmitz Note Added: 21910
2012-11-02 13:15 c_schmitz Status assigned => resolved
2012-11-02 13:15 c_schmitz Fixed in Version => 2.00+
2012-11-02 14:02 c_schmitz Changeset attached => LimeSurvey 2.1 62d1735e
2012-11-02 14:02 c_schmitz Note Added: 21915
2012-11-02 21:42 c_schmitz Note Added: 21931
2012-11-02 21:42 c_schmitz Status resolved => closed
2021-08-03 01:04 guest Bug heat 6 => 8