Bug 23985

Summary: The method Koha::Item-> is not covered by tests!
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: CirculationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: major    
Priority: P5 - low CC: fridolin.somers, gmcharlt, katrin.fischer, kyle.m.hall, martin.renvoize
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.05
Bug Depends on: 21206    
Bug Blocks:    
Attachments: Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set

Description Julian Maurice 2019-11-07 11:23:55 UTC
When checking out an item:

The method Koha::Item-> is not covered by tests!

Trace begun at /home/koha/env/master/src/Koha/Object.pm line 495
Koha::Object::AUTOLOAD('Koha::Item=HASH(0x55c5a43bcfb0)') called at /home/koha/env/master/src/C4/Reserves.pm line 799
C4::Reserves::CheckReserves(9) called at /home/koha/env/master/src/C4/Circulation.pm line 1024
C4::Circulation::CanBookBeIssued('Koha::Patron=HASH(0x55c5a43d6298)', 1, undef, undef, undef, 'HASH(0x55c5a45432b0)') called at /home/koha/env/master/src/circ/circulation.pl line 349

The bad lines are :

my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) );

$hold_fulfillment_policy can apparently be empty, and this is not
checked.

I'm not sure what should be done in this case.

Steps to reproduce:
1. Go to "Circulation and fines rules"
2. Under "Default checkout, hold and return policy", unset "Hold pickup library match" and Save
3. Place a hold on one item for one patron
4. Try to checkout the same item with another patron

Caused by bug 21206
Comment 1 Jonathan Druart 2019-11-12 17:03:43 UTC
Created attachment 95339 [details] [review]
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set

This patch restores the behavior prior to bug 21206.
If "Hold pickup library match" is "Not set", then
hold_fulfillment_policy equals an empty string.

Test plan:
1. Go to "Circulation and fines rules"
2. Under "Default checkout, hold and return policy", unset "Hold pickup
library match" and Save
3. Place a hold on one item for one patron
4. Try to checkout the same item with another patron

=> Without this patch you the checkout list do not show, and the logs
contain "The method Koha::Item-> is not covered by tests!"
=> With this patch applied you see the checkout list

QA will take care of comparing the statement with the one before bug 21206
and make sure they are equivalent
Comment 2 Julian Maurice 2019-11-13 06:29:44 UTC
Created attachment 95352 [details] [review]
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set

This patch restores the behavior prior to bug 21206.
If "Hold pickup library match" is "Not set", then
hold_fulfillment_policy equals an empty string.

Test plan:
1. Go to "Circulation and fines rules"
2. Under "Default checkout, hold and return policy", unset "Hold pickup
library match" and Save
3. Place a hold on one item for one patron
4. Try to checkout the same item with another patron

=> Without this patch you the checkout list do not show, and the logs
contain "The method Koha::Item-> is not covered by tests!"
=> With this patch applied you see the checkout list

QA will take care of comparing the statement with the one before bug 21206
and make sure they are equivalent

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 3 Julian Maurice 2019-11-13 06:30:29 UTC
Works as expected. Thanks for the patch Jonathan
Comment 4 Martin Renvoize 2019-11-13 14:01:23 UTC
Created attachment 95389 [details] [review]
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set

This patch restores the behavior prior to bug 21206.
If "Hold pickup library match" is "Not set", then
hold_fulfillment_policy equals an empty string.

Test plan:
1. Go to "Circulation and fines rules"
2. Under "Default checkout, hold and return policy", unset "Hold pickup
library match" and Save
3. Place a hold on one item for one patron
4. Try to checkout the same item with another patron

=> Without this patch you the checkout list do not show, and the logs
contain "The method Koha::Item-> is not covered by tests!"
=> With this patch applied you see the checkout list

QA will take care of comparing the statement with the one before bug 21206
and make sure they are equivalent

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2019-11-13 14:03:17 UTC
I've checked the queries and am happy they match.. Passing QA
Comment 6 Martin Renvoize 2019-11-13 14:04:06 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin Somers 2019-11-15 12:13:31 UTC
Pushed to 19.05.x for 19.05.05