Bug 10843 - print a slip can cause an error
Summary: print a slip can cause an error
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 10298
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-09 12:10 UTC by Jonathan Druart
Modified: 2015-06-04 23:23 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10843: the DateTime->add method takes a scalar, not undef (2.29 KB, patch)
2013-09-09 12:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 10843: the DateTime->add method takes a scalar, not undef (2.29 KB, patch)
2013-09-30 09:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10843: the DateTime->add method takes a scalar, not undef (2.34 KB, patch)
2013-09-30 23:15 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
[PASSED QA] Bug 10843: the DateTime->add method takes a scalar, not undef (2.63 KB, patch)
2013-10-05 19:41 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2013-09-09 12:10:22 UTC
Testing bug 10731, I found a bug:
If the pref ReservesMaxPickUpDelay is not defined, C4::Letters::_parseletter raises an error in some cases.
Comment 1 Jonathan Druart 2013-09-09 12:22:15 UTC Comment hidden (obsolete)
Comment 2 I'm just a bot 2013-09-29 05:54:48 UTC
Patch applied cleanly, go forth and signoff
Comment 3 Srdjan Jankovic 2013-09-30 05:42:58 UTC
Why // 0? An empty string would break it too, so I believe || 0 is better.
Comment 4 Jonathan Druart 2013-09-30 09:09:39 UTC
(In reply to Srdjan Jankovic from comment #3)
> Why // 0? An empty string would break it too, so I believe || 0 is better.

Yes, you are right!
I will fix it.
Comment 5 Jonathan Druart 2013-09-30 09:09:52 UTC Comment hidden (obsolete)
Comment 6 Srdjan Jankovic 2013-09-30 23:15:07 UTC Comment hidden (obsolete)
Comment 7 Katrin Fischer 2013-10-05 19:29:28 UTC
The tests pass, but there are a lot of warnings. Could you take a look, Jonathan?
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 128.
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 133.
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 138.
Use of uninitialized value $date_format in string eq at /home/katrin/kohaclone/Koha/DateUtils.pm line 67.
Use of uninitialized value $date_format in string eq at /home/katrin/kohaclone/Koha/DateUtils.pm line 72.
Use of uninitialized value $date_format in string eq at /home/katrin/kohaclone/Koha/DateUtils.pm line 77.
Use of uninitialized value $date_format in string eq at /home/katrin/kohaclone/Koha/DateUtils.pm line 80.
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 128.
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 133.
Use of uninitialized value $_ in pattern match (m//) at /home/katrin/kohaclone/Koha/DateUtils.pm line 138.
Comment 8 Katrin Fischer 2013-10-05 19:41:15 UTC
Created attachment 21825 [details] [review]
[PASSED QA] Bug 10843: the DateTime->add method takes a scalar, not undef

Test plan:
1) set an empty string for the ReservesMaxPickUpDelay pref
2) place a hold on an item
3) check in the item
4) click on "Print and confirm"
5) an error occurs
> The 'days' parameter (undef) to DateTime::Duration::new was an 'undef'
6) apply the patch
7) repeat steps 1 to 4
8) the error does not occur anymore.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
An empty string didn't do it for me, I had to set the
variable for the systempreference to NULL. I am not sure
if this can happen when editing from the interface, but
this change should not have any ill side effects and it has
unit tests!
Comment 9 Galen Charlton 2013-10-18 06:19:07 UTC
Pushed to master.  Thanks, Jonathan!
Comment 10 Tomás Cohen Arazi 2013-12-05 13:00:41 UTC
This patch has been pushed to 3.12.x, will be in 3.12.8.

Thanks Jonathan!