[Bug 14641] New: Warns in subscription-add.pl
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Bug ID: 14641 Summary: Warns in subscription-add.pl Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Serials Assignee: koha-bugs@lists.koha-community.org Reporter: aleishaamohia@hotmail.com QA Contact: testopia@bugs.koha-community.org CC: colin.campbell@ptfs-europe.com subscription-add.pl: Use of uninitialized value $selected_lettercode in string eq at /home/vagrant/kohaclone/serials/subscription-add.pl line 231 subscription-add.pl: Use of uninitialized value $selected_lettercode in string eq at /home/vagrant/kohaclone/serials/subscription-add.pl line 231 To reproduce, go to Serials and click New Subscription. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 --- Comment #1 from Aleisha Amohia <aleishaamohia@hotmail.com> --- Created attachment 41325 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41325&action=edit Bug 14641: Warns in subscription-add.pl I think the warns are being triggered because there are brackets around it (like my ($selected_lettercode) ) which doesn't seem necessary as we're only declaring one variable? So I've removed the brackets. To test: 1) Reproduce warns by clicking New Subscription 2) Apply patch 3) Click New Subscription again 4) Confirm warns are gone -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Joonas Kylmälä <j.kylmala@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |j.kylmala@gmail.com --- Comment #2 from Joonas Kylmälä <j.kylmala@gmail.com> --- The warning is triggered when get_letter_loop() is called without an argument. We should maybe check if @_ is true, and if it's not then use $_ or "" as the value? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor Status|Needs Signoff |Failed QA Assignee|koha-bugs@lists.koha-commun |aleishaamohia@hotmail.com |ity.org | CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- The brackets should be kept, for consistency at least. I haven't tested, but this patch is certainly wrong. Moreover, tests should be provided. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41325|0 |1 is obsolete| | --- Comment #4 from Aleisha Amohia <aleishaamohia@hotmail.com> --- Created attachment 45623 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=45623&action=edit Bug 14641: Warns in subscription-add.pl These warns now appear on line 242. Have changed get_letter_loop() to be empty unless given a value ( get_letter_loop //= '') To test: 1) Reproduce warns by clicking New Subscription 2) Apply patch 3) Click New Subscription again 4) Confirm warns are gone -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Aleisha, with this patch the parameter sent to the subroutine is not taken into account anymore. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 --- Comment #6 from Aleisha Amohia <aleishaamohia@hotmail.com> --- (In reply to Joonas Kylmälä from comment #2)
The warning is triggered when get_letter_loop() is called without an argument. We should maybe check if @_ is true, and if it's not then use $_ or "" as the value?
I'm pretty new to perl so don't really know how I would write this. Do you have any suggestions so that we can give this bug a patch? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- The verbose way to do it is: my ($selected_lettercode) = @_; if ( not defined $selected_lettercode ) { $selected_lettercode = ''; } A better way, IMO is to use `unless` instead of `if not` my ($selected_lettercode) = @_; unless ( defined $selected_lettercode ) { $selected_lettercode = ''; } A much more better way is to do the same but more readable (because less verbose): my ($selected_lettercode) = @_; $selected_lettercode //= ''; `//=` means `assign what is at the right if what is at the left is not defined` `||=` would means `assign what is at the right if what is at the left is not defined or is 0 or is an empty string` -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #45623|0 |1 is obsolete| | --- Comment #8 from Aleisha Amohia <aleishaamohia@hotmail.com> --- Created attachment 46500 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=46500&action=edit Bug 14641: Warns in subscription-add.pl Removes warn using Jonathan's suggestion! To test: 1) Reproduce warns by clicking New Subscription 2) Apply patch 3) Click New Subscription again 4) Confirm warns are gone -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #46500|0 |1 is obsolete| | --- Comment #9 from Magnus Enger <magnus@libriotech.no> --- Created attachment 46560 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=46560&action=edit Bug 14641: [SIGNED-OFF] Warns in subscription-add.pl Removes warn using Jonathan's suggestion! To test: 1) Reproduce warns by clicking New Subscription 2) Apply patch 3) Click New Subscription again 4) Confirm warns are gone Signed-off-by: Magnus Enger <magnus@libriotech.no> Patch removes the warn that come when clicking "New subscription" -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #46560|0 |1 is obsolete| | --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 46580 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=46580&action=edit Bug 14641: [SIGNED-OFF] Warns in subscription-add.pl Removes warn using Jonathan's suggestion! To test: 1) Reproduce warns by clicking New Subscription 2) Apply patch 3) Click New Subscription again 4) Confirm warns are gone Signed-off-by: Magnus Enger <magnus@libriotech.no> Patch removes the warn that come when clicking "New subscription" Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org