Bug 18734

Summary: Internal server error in cash_register_stats.pl when exporting to file
Product: Koha Reporter: Marc Véron <veron>
Component: ReportsAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, katrin.fischer, mtj, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 6934    
Bug Blocks: 18694    
Attachments: Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file

Description Marc Véron 2017-06-06 09:13:03 UTC
To reproduce:

- Go to Home > Reports > Cash register statistics
- Select a date range
- Output to screen in browser: Displays OK
- Output to a file: Internal Server Error

Plack error log says:

CGI::param called in list context from package CGI::Compile::ROOT::home_marc_koha_reports_cash_register_stats_2epl line 64, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436.
CGI::param called in list context from package CGI::Compile::ROOT::home_marc_koha_reports_cash_register_stats_2epl line 66, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436.
exited nonzero: 1 at /home/marc/koha/reports/cash_register_stats.pl line 201.
Comment 1 Marc Véron 2017-06-07 16:46:52 UTC
The internal server error can be fixed by changing line 174 from exit(1); to exit(0);

But then an new issue appears: The export has an empty line above the header line, and the header line is mixed with and without double quotes:

mfirstname;card number;firstname;branchname;date;accounttype;amount;title;barcode;"itype"
Comment 2 Nick Clemens 2017-06-09 14:19:21 UTC
Created attachment 64137 [details] [review]
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file

To test:
Output cash reigster stats report to file
Internal server error
Apply patch
Export to file
File is generated and correctly formed
Comment 3 Marc Véron 2017-06-09 14:44:47 UTC
Created attachment 64142 [details] [review]
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file

To test:
Output cash reigster stats report to file
Internal server error
Apply patch
Export to file
File is generated and correctly formed

Signed-off-by: Marc Véron <veron@veron.ch>
Comment 4 Marc Véron 2017-06-09 14:58:01 UTC
Created attachment 64146 [details] [review]
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file

To test:
Output cash reigster stats report to file
Internal server error
Apply patch
Export to file
File is generated and correctly formed

Signed-off-by: Marc Véron <veron@veron.ch>
Comment 5 Jonathan Druart 2017-06-12 17:32:48 UTC
Created attachment 64230 [details] [review]
Bug 18734 - Internal server error in cash_register_stats.pl when exporting to file

To test:
Output cash reigster stats report to file
Internal server error
Apply patch
Export to file
File is generated and correctly formed

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2017-06-12 20:59:00 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 7 Fridolin Somers 2017-06-13 07:16:53 UTC
Pushed to 17.05.x, will be in 17.05.01
Comment 8 Katrin Fischer 2017-06-13 20:41:57 UTC
This patch has been pushed to 16.11.x and will be in 16.11.09.
Comment 9 Mason James 2017-09-19 23:21:32 UTC
Patchset has conflicts, skipping for 16.05.x
Comment 10 Mason James 2017-09-19 23:28:27 UTC
(In reply to Mason James from comment #9)
> Patchset has conflicts, skipping for 16.05.x

depends on BZ 6934