Bug 8490 - Error when adding label layout under plack
Summary: Error when adding label layout under plack
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: 3.10
Hardware: All All
: P5 - low blocker (vote)
Assignee: Paul Poulain
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-21 14:14 UTC by Mirko Tietgen
Modified: 2019-06-27 09:24 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 8490 fixing Plack error (1.40 KB, patch)
2012-11-02 11:16 UTC, Paul Poulain
Details | Diff | Splinter Review
Bug 8490: fix Plack error when creating label layout (1.63 KB, patch)
2012-11-02 12:17 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mirko Tietgen 2012-07-21 14:14:52 UTC
Error message "Can't bless non-reference value at /home/pi/koha/C4/Creators/Layout.pm line 111." when trying to add a label layout while using plack.

To reproduce: go to Tools> Label creator> Layouts> New layout; edit layout name and press 'Save.
Comment 1 Paul Poulain 2012-11-02 11:14:23 UTC
Chris_n => THIS IS FOR YOU !

I think I've understood why the problem occurs:
the $layout_id variable is set to 5001 on my setup. And 5001 is the Unix port where I run Plack. 
WTH is this value stored in this variable ? 
Because of 
my $layout_id = $cgi->param('layout_id') || $cgi->param('element_id') || $ARGV[1] || '';
in label-edit-layout.pl

Removing $ARGV[1] solves the problem

Why is the ARGV[1] here, I have no idea. Is this script sometimes run from commandline ? I don't think so.

This ||ARGV[1] has been added by chris_n in the commit : 12663796ca87cf87f89fd1ba1f2949ec33b76b85

Auteur: Chris Nighswonger <cnighswonger@foundations.edu>  2009-07-20 19:24:49
    [8/40] Adding new layout management page
    
    This moves the layouts off of the labels tool start page to bring it into
    conformity with the other parts of this tool.


assigning bug to me, and adding chris_n in cc:
Comment 2 Paul Poulain 2012-11-02 11:16:37 UTC Comment hidden (obsolete)
Comment 3 Paul Poulain 2012-11-02 11:17:10 UTC
Upgrading severity because there's no workaround, it's a blocker to use Plack
Comment 4 Chris Nighswonger 2012-11-02 12:10:39 UTC
(In reply to comment #2)
> Removing $ARGV[1] solves the problem
> Also removing $ARG[0] because I also don't think it's useful

You're right about the cli args, Paul. In this script they were there for my debugging very early on and should have been removed.

No functionality should be broken by removing them.

IIRC this may not be true for all of the label/patron card related scripts, however. Ie. those that generate the PDF, CSV, etc. files from batches, etc.
Comment 5 Jared Camins-Esakov 2012-11-02 12:17:39 UTC
Created attachment 13208 [details] [review]
Bug 8490: fix Plack error when creating label layout

This patch fixes "Error message "Can't bless non-reference value at
/home/pi/koha/C4/Creators/Layout.pm line 111." when trying to add a
label layout while using plack."

The $layout_id variable is set to 5001 on my setup. And 5001 is the Unix
port where I run Plack. WTH is this value stored in this variable ?
Because of
> my $layout_id = $cgi->param('layout_id') || $cgi->param('element_id') || $ARGV[1] || '';
in label-edit-layout.pl

Removing $ARGV[1] solves the problem
Also removing $ARG[0] because I also don't think it's useful

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed off after confirming with Chris Nighswonger that these scripts
were not intended to be run from the command line. Works as promised.
Comment 6 Jonathan Druart 2012-11-05 10:04:35 UTC
QA Comment:
No regression introduced with this patch.
So I mark it as Passed QA.
Comment 7 Jared Camins-Esakov 2012-11-05 13:49:39 UTC
This patch has been pushed to master.
Comment 8 Paul Poulain 2012-11-05 15:57:40 UTC
Patch pushed to branch 3.10.x
Comment 9 Chris Cormack 2013-04-22 08:27:54 UTC
Released in 3.10.0