Bug 15414

Summary: Noisy warns when creating new layout for patron card creator
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: ToolsAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: kyle
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15414: Silencing warns triggered by creating a new layout in patron card creator
Bug 15414: Silencing warns triggered by creating a new layout in patron card creator
Bug 15414: Silencing warns triggered by creating a new layout in patron card creator

Description Aleisha Amohia 2015-12-22 23:32:03 UTC
edit-layout.pl: Use of uninitialized value $field in numeric lt (<) at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 239
edit-layout.pl: Use of uninitialized value $field in concatenation (.) or string at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 239
edit-layout.pl: Use of uninitialized value $field in concatenation (.) or string at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 239
edit-layout.pl: Use of uninitialized value $image in numeric lt (<) at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 247
edit-layout.pl: Use of uninitialized value $image in concatenation (.) or string at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 247
edit-layout.pl: Use of uninitialized value $image in concatenation (.) or string at /home/vagrant/kohaclone/patroncards/edit-layout.pl line 247.

To reproduce, go to Tools -> Patron Card Creator -> New layout
Comment 1 Aleisha Amohia 2016-04-25 23:10:57 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2016-04-25 23:39:19 UTC
Comment on attachment 50686 [details] [review]
Bug 15414: Silencing warns triggered by creating a new layout in patron card creator

Review of attachment 50686 [details] [review]:
-----------------------------------------------------------------

::: patroncards/edit-layout.pl
@@ +236,4 @@
>  elsif  ($op eq 'new') { # this is a new layout
>      $layout = C4::Patroncards::Layout->new();
>      my @fields = ();
> +    for (my $field = 0; $field < 4; $field++) {     # limit 3 text fields

Nice catch on the initialization missing.
Comment 3 Mark Tompsett 2016-04-25 23:43:09 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2016-04-28 13:44:24 UTC
Created attachment 50923 [details] [review]
Bug 15414: Silencing warns triggered by creating a new layout in patron card creator

This patch assigns $field and $image values in the for loops

To test:
1) Go to Tools -> Patron Card Creator -> New layout
2) Notice warns
3) Apply patch and refresh page
4) Notice warns are gone and page still works as expected

Sponsored-by: Catalyst IT

NOTE: Trivial initialization in a loop issue.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall (khall) 2016-04-29 11:36:27 UTC
Pushed to master! Should be in the May 2016 release. Grazie Aleisha!