View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
17541Bug reportsPluginspublic2021-09-06 10:59
Reporterdschirge Assigned Toollehar  
PrioritynoneSeveritytweak 
Status closedResolutionfixed 
Product Version3.25.12 
Summary17541: pdf export via plugin impossible
DescriptionHello,

we are trying to create an pdf export plugin.
Unfortunately it isn't working because of a bug in the pdf.php.
The reason is that an undefined constant is used. It appears that ot doesn't work because of changes within the PHP language.


Steps To ReproduceCall the internal class ExportSurveyResultsService
with the following parameters: $exportResponses($survey->sid, $survey->language, 'pdf, $formattingOptions, '').
It results in the attached error message.
TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)3.27.12+210816
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL 8.0.21
Server OS (if known)Windows 10
Webserver software & version (if known)APache 2.4.46
PHP Version7.2.33

Users monitoring this issue

User List There are no users monitoring this issue.

Activities

dschirge

dschirge

2021-08-25 14:13

reporter  

image.png (84,708 bytes)   
image.png (84,708 bytes)   
ollehar

ollehar

2021-08-25 14:14

administrator   ~66131

Probably missing a PHP extension?
ollehar

ollehar

2021-08-25 14:19

administrator   ~66132

No, your code is wrong - EXT is defined in index.php:

define('EXT', '.php');
DenisChenu

DenisChenu

2021-08-25 14:27

developer   ~66134

I have export plugin using current pdf function … but never use with command

https://github.com/LimeSurvey/LimeSurvey/blob/bdd2ff84d6bf436893044eae8efef207ebf2a97b/application/libraries/admin/pdf.php#L20

We don't load index : https://github.com/LimeSurvey/LimeSurvey/blob/bdd2ff84d6bf436893044eae8efef207ebf2a97b/index.php#L119

We need to define all of this in command action too.

Pull request can be cool :)
DenisChenu

DenisChenu

2021-08-25 14:27

developer   ~66135

> No, your code is wrong - EXT is defined in index.php:

OUR code is wrong … in my opinion.
dschirge

dschirge

2021-08-25 14:55

reporter   ~66136

@ollehar: I agree with DenisChenu. It would be (at least in my opinion) better, if in the console environment the constants are provided as well. Of course we simply could define EXT, but this would mean that every plugin must define all the necessary constants. I don't believe that's a good idea.
ollehar

ollehar

2021-08-25 15:01

administrator   ~66137

Sure. Feel free to submit a pull request.
DenisChenu

DenisChenu

2021-08-25 15:10

developer   ~66138

> Pull request can be cool :)

for all command action in fact.
See : https://gitlab.com/SondagesPro/mailing/sendMailCron/-/blob/master/sendMailCron.php#L1593
And for 3.X : https://gitlab.com/SondagesPro/mailing/sendMailCron/-/blob/master/sendMailCron.php#L454

1. Lack of constant
2. lack of some common function loaded
3. Lack of some class loaded
4. surely other
Mazi

Mazi

2021-08-25 23:21

partner   ~66147

@dschirge, if this doesn't take more than an hour, please provide a pull request and add this to my bill.

We need this for a project which should start soon but currenty we are unable to get the PDF export working.

As a temporary solution, can we simply define the missing constant(s) within out code (if not defined yet) to get this going?
dschirge

dschirge

2021-08-31 14:17

reporter   ~66243

I created a pull request.
You can find it here: https://github.com/LimeSurvey/LimeSurvey/pull/2025
It is my first pull request in GitHub so I hope I did it in the correct/expected way. If not please let me know what's wrong.
Mazi

Mazi

2021-08-31 14:22

partner   ~66244

@ollehar, please review.
Mazi

Mazi

2021-08-31 14:33

partner   ~66245

@ollehar, would it be possible to include this at the next release so we can use it for our upcoming project beginning of September?
ollehar

ollehar

2021-08-31 14:35

administrator   ~66246

Sure, as soon as it's merged it will be included in the next patch (Monday) release.
ollehar

ollehar

2021-08-31 14:35

administrator   ~66247

You can just patch it locally before that (as long as you know it will be included in the next release, I mean).
guest

guest

2021-09-01 13:38

viewer   ~66253

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=32624
dschirge

dschirge

2021-09-01 15:19

reporter   ~66262

Thank you for merging this! :-)
ollehar

ollehar

2021-09-01 15:20

administrator   ~66263

No probs, hope it works!

Related Changesets

LimeSurvey: 3.x-LTS dec4e2fa

2021-09-01 13:38:49

pop1989_bb


Committer: GitHub Details Diff
Fixed issue 17541: PDF export via plugin not possible (#2025) Affected Issues
17541
add - application/commands/assets/.keep Diff File
mod - application/commands/console.php Diff File
mod - application/core/ConsoleApplication.php Diff File

Issue History

Date Modified Username Field Change
2021-08-25 14:13 dschirge New Issue
2021-08-25 14:13 dschirge File Added: image.png
2021-08-25 14:14 ollehar Note Added: 66131
2021-08-25 14:14 ollehar Bug heat 0 => 2
2021-08-25 14:19 ollehar Note Added: 66132
2021-08-25 14:20 ollehar Assigned To => ollehar
2021-08-25 14:20 ollehar Status new => feedback
2021-08-25 14:27 DenisChenu Note Added: 66134
2021-08-25 14:27 DenisChenu Bug heat 2 => 4
2021-08-25 14:27 DenisChenu Note Added: 66135
2021-08-25 14:33 ollehar Severity block => tweak
2021-08-25 14:33 ollehar Description Updated View Revisions
2021-08-25 14:33 ollehar Steps to Reproduce Updated View Revisions
2021-08-25 14:55 dschirge Note Added: 66136
2021-08-25 14:55 dschirge Bug heat 4 => 6
2021-08-25 14:55 dschirge Status feedback => assigned
2021-08-25 15:01 ollehar Note Added: 66137
2021-08-25 15:10 DenisChenu Note Added: 66138
2021-08-25 23:21 Mazi Note Added: 66147
2021-08-25 23:21 Mazi Bug heat 6 => 8
2021-08-31 14:17 dschirge Note Added: 66243
2021-08-31 14:22 Mazi Note Added: 66244
2021-08-31 14:33 Mazi Note Added: 66245
2021-08-31 14:35 ollehar Note Added: 66246
2021-08-31 14:35 ollehar Note Added: 66247
2021-09-01 13:38 Changeset attached => LimeSurvey 3.x-LTS dec4e2fa
2021-09-01 13:38 guest Note Added: 66253
2021-09-01 13:38 guest Bug heat 8 => 10
2021-09-01 15:19 dschirge Note Added: 66262
2021-09-01 15:20 ollehar Note Added: 66263
2021-09-01 15:20 ollehar Status assigned => resolved
2021-09-01 15:20 ollehar Resolution open => fixed
2021-09-06 10:59 c_schmitz Status resolved => closed