[Bug 20537] New: Warnings in overdue_notices.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Bug ID: 20537 Summary: Warnings in overdue_notices.pl Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz We've seen a warning from overdue_notices.pl: Use of uninitialized value in concatenation (.) or string at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 575. I checked in our version and in master and think it happens for users withut a surname (organisations usually): 576 $borrowernumber = $data->{'borrowernumber'}; 577 my $borr = 578 $data->{'firstname'} . ', ' 579 . $data->{'surname'} . ' (' 580 . $borrowernumber . ')'; 581 $verbose Should we check here if firstname/surname are defined? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Katrin Fischer from comment #0)
Should we check here if firstname/surname are defined?
yes -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |Academy -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |hayleymapley@catalyst.net.n |ity.org |z CC| |hayleymapley@catalyst.net.n | |z Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 --- Comment #2 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Created attachment 86124 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86124&action=edit Bug 20537: Added check to remove warning from overdue_notices.pl When executing overdue_notices.pl on borrowers that lack a surname, we see this error: Use of uninitialized value in concatenation (.) or string at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 575. This patch fixes this issue by setting the $borr variable based on the information that has been defined. To test: 1) Create a borrower and set its surname to null 2) Checkout an item to the borrower and set it to be overdue 3) Navigate to kohaclone/misc/cronjobs and enter a koha-shell 4) Run the script: ./overdue_notices.pl 5) Observe the error appears 6) Apply the patch 7) Repeat steps 3-4 8) Observe the error is gone 9) Sign off! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Hi Hayley, It will work, but I am wondering if something like that would not be more readable: my $borr = sprintf( "%s%s%s (%s)", $data->{surname} || '', $data->{firstname} && $data->{surname} ? ', ' : '', $data->{firstname} || '', $borrowernumber ); What do you think? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 --- Comment #4 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- (In reply to Jonathan Druart from comment #3)
Hi Hayley,
It will work, but I am wondering if something like that would not be more readable:
my $borr = sprintf( "%s%s%s (%s)", $data->{surname} || '', $data->{firstname} && $data->{surname} ? ', ' : '', $data->{firstname} || '', $borrowernumber );
What do you think?
Hi Jonathan, I'm happy to implement your solution, however it looks like maybe this error is not present on master anymore. Would you mind confirming this? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- The code is the same in master so I bet the warning is still there. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #86124|0 |1 is obsolete| | --- Comment #6 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Created attachment 89368 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89368&action=edit Bug 20537: Added checks to remove warning from overdue_notices.pl When executing overdue_notices.pl on borrowers that lack a surname, we see this error: Use of uninitialized value in concatenation (.) or string at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 575. This patch fixes this issue by setting the $borr variable based on the information that has been defined. To test: 1) Create a borrower and set its surname to null 2) Checkout an item to the borrower and set it to be overdue 3) Navigate to kohaclone/misc/cronjobs and enter a koha-shell 4) Run the script: ./overdue_notices.pl 5) Observe the error appears 6) Apply the patch 7) Repeat steps 3-4 8) Observe the error is gone 9) Sign off! Sponsored-by: Catalyst IT -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|Academy | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wizzyrea@gmail.com Status|Needs Signoff |RESOLVED Resolution|--- |WORKSFORME --- Comment #7 from Liz Rea <wizzyrea@gmail.com> --- Hayley is right, the behaviour doesn't seem to appear in current master, even though that code is the same. I think we can call this one fixed? Cheers, Liz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WORKSFORME |--- Status|RESOLVED |REOPENED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |Needs Signoff --- Comment #8 from Liz Rea <wizzyrea@gmail.com> --- Actually, I was wrong and we do see this - I didn't have a rule defined for overdue notices for the borrower I was looking at. Bum. So, having another look. :) Liz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #89368|0 |1 is obsolete| | --- Comment #9 from Liz Rea <wizzyrea@gmail.com> --- Created attachment 90085 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=90085&action=edit Bug 20537: Added checks to remove warning from overdue_notices.pl When executing overdue_notices.pl on borrowers that lack a surname, we see this error: Use of uninitialized value in concatenation (.) or string at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 575. This patch fixes this issue by setting the $borr variable based on the information that has been defined. To test: 1) Create a borrower and set its surname to null 2) Checkout an item to the borrower and set it to be overdue 3) Navigate to kohaclone/misc/cronjobs and enter a koha-shell 4) Run the script: ./overdue_notices.pl 5) Observe the error appears 6) Apply the patch 7) Repeat steps 3-4 8) Observe the error is gone 9) Sign off! Sponsored-by: Catalyst IT Signed-off-by: Liz Rea <wizzyrea@gmail.com> patch wouldn't apply on current master, so I fixed that. Work is the same. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #90085|0 |1 is obsolete| | --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 90086 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=90086&action=edit Bug 20537: Added checks to remove warning from overdue_notices.pl When executing overdue_notices.pl on borrowers that lack a surname, we see this error: Use of uninitialized value in concatenation (.) or string at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 575. This patch fixes this issue by setting the $borr variable based on the information that has been defined. To test: 1) Create a borrower and set its surname to null 2) Checkout an item to the borrower and set it to be overdue 3) Navigate to kohaclone/misc/cronjobs and enter a koha-shell 4) Run the script: ./overdue_notices.pl 5) Observe the error appears 6) Apply the patch 7) Repeat steps 3-4 8) Observe the error is gone 9) Sign off! Sponsored-by: Catalyst IT Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #11 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 19.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20537 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |martin.renvoize@ptfs-europe | |.com Version(s)| |19.05.00, 18.11.06 released in| | --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Pushed to 18.11.x for 18.11.06 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org