Testing bug 10731, I found a bug: If the pref ReservesMaxPickUpDelay is not defined, C4::Letters::_parseletter raises an error in some cases.
Created attachment 20909 [details] [review] 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.
Patch applied cleanly, go forth and signoff
Why // 0? An empty string would break it too, so I believe || 0 is better.
(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.
Created attachment 21651 [details] [review] 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.
Created attachment 21686 [details] [review] [SIGNED-OFF] 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>
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.
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!
Pushed to master. Thanks, Jonathan!
This patch has been pushed to 3.12.x, will be in 3.12.8. Thanks Jonathan!