Circulation::TooMany gets itemtype from $item var beeing a Koha::Item unblessed. When itemtype is at biblio level, calling $item->{'itemtype'} is wrong.
Created attachment 91891 [details] [review] Bug 23404: add UT to show bug Run prove t/db_dependent/Circulation/TooMany.t It fails on : # Failed test 'We are only allowed one, and we have one (itemtype on biblioitem)' # at t/db_dependent/Circulation/TooMany.t line 547. # Structures begin differing at: # $got->{reason} = 'NO_RULE_DEFINED' # $expected->{reason} = 'TOO_MANY_CHECKOUTS'
Created attachment 91892 [details] [review] Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level Circulation::TooMany gets itemtype from $item var beeing a Koha::Item unblessed. When itemtype is at biblio level, calling $item->{'itemtype'} is wrong. Test plan : 1) On a catalog with itemtype at item level : pref item-level_itypes=1 2) Create a biblio record with itemtype BOOK 3) Create an item on this biblio record with itemtype BOOK 4) Delete all issuing rules 5) Create a issuing rule with itemtype BOOK, any catagorie, any branch 6) Check-out the item 7) => Checkout is allowed 8) Check-in item 9) Change itemtype at biblio level : pref item-level_itypes=0 10) Check-out the item 11) => Checkout is not allowed You see message "No circulation rule is defined for this patron and itemtype combination"
Created attachment 91893 [details] [review] Bug 23404: Change UT calls Run prove t/db_dependent/Circulation/TooMany.t Tests are OK
(In reply to Fridolin SOMERS from comment #2) > Created attachment 91892 [details] [review] [review] > Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level > > Circulation::TooMany gets itemtype from $item var beeing a Koha::Item > unblessed. > When itemtype is at biblio level, calling $item->{'itemtype'} is wrong. > Note that patch removes in TooMany() method second arg $biblionumber, it is useless.
18.11.x needs to add to C4::Circulation::CanBookBeIssued : my $item_object = Koha::Items->find({barcode => $barcode }); after my $item = GetItem(undef, $barcode );
Created attachment 92626 [details] [review] Bug 23404: add UT to show bug Run prove t/db_dependent/Circulation/TooMany.t It fails on : # Failed test 'We are only allowed one, and we have one (itemtype on biblioitem)' # at t/db_dependent/Circulation/TooMany.t line 547. # Structures begin differing at: # $got->{reason} = 'NO_RULE_DEFINED' # $expected->{reason} = 'TOO_MANY_CHECKOUTS' Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 92627 [details] [review] Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level Circulation::TooMany gets itemtype from $item var beeing a Koha::Item unblessed. When itemtype is at biblio level, calling $item->{'itemtype'} is wrong. Test plan : 1) On a catalog with itemtype at item level : pref item-level_itypes=1 2) Create a biblio record with itemtype BOOK 3) Create an item on this biblio record with itemtype BOOK 4) Delete all issuing rules 5) Create a issuing rule with itemtype BOOK, any catagorie, any branch 6) Check-out the item 7) => Checkout is allowed 8) Check-in item 9) Change itemtype at biblio level : pref item-level_itypes=0 10) Check-out the item 11) => Checkout is not allowed You see message "No circulation rule is defined for this patron and itemtype combination" Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 92628 [details] [review] Bug 23404: Change UT calls Run prove t/db_dependent/Circulation/TooMany.t Tests are OK Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 92655 [details] [review] Bug 23404: add UT to show bug Run prove t/db_dependent/Circulation/TooMany.t It fails on : # Failed test 'We are only allowed one, and we have one (itemtype on biblioitem)' # at t/db_dependent/Circulation/TooMany.t line 547. # Structures begin differing at: # $got->{reason} = 'NO_RULE_DEFINED' # $expected->{reason} = 'TOO_MANY_CHECKOUTS' Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 92656 [details] [review] Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level Circulation::TooMany gets itemtype from $item var beeing a Koha::Item unblessed. When itemtype is at biblio level, calling $item->{'itemtype'} is wrong. Test plan : 1) On a catalog with itemtype at item level : pref item-level_itypes=1 2) Create a biblio record with itemtype BOOK 3) Create an item on this biblio record with itemtype BOOK 4) Delete all issuing rules 5) Create a issuing rule with itemtype BOOK, any catagorie, any branch 6) Check-out the item 7) => Checkout is allowed 8) Check-in item 9) Change itemtype at biblio level : pref item-level_itypes=0 10) Check-out the item 11) => Checkout is not allowed You see message "No circulation rule is defined for this patron and itemtype combination" Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 92657 [details] [review] Bug 23404: Change UT calls Run prove t/db_dependent/Circulation/TooMany.t Tests are OK Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 92658 [details] [review] Bug 23404: (QA follow-up) Minor fix Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Nice work! Pushed to master for 19.11.00
Pushed to 19.05.x for 19.05.04