Bug 23404 - Circulation::TooMany error on itemtype when at biblio level
Summary: Circulation::TooMany error on itemtype when at biblio level
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Fridolin SOMERS
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-31 13:02 UTC by Fridolin SOMERS
Modified: 2019-09-13 12:35 UTC (History)
3 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:
19.11.00,19.05.04


Attachments
Bug 23404: add UT to show bug (3.04 KB, patch)
2019-07-31 14:00 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level (2.82 KB, patch)
2019-07-31 14:01 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 23404: Change UT calls (17.67 KB, patch)
2019-07-31 14:01 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 23404: add UT to show bug (3.11 KB, patch)
2019-09-06 10:32 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level (2.89 KB, patch)
2019-09-06 10:33 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 23404: Change UT calls (17.74 KB, patch)
2019-09-06 10:33 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 23404: add UT to show bug (3.15 KB, patch)
2019-09-06 18:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23404: fix Circulation::TooMany error on itemtype when at biblio level (2.92 KB, patch)
2019-09-06 18:55 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23404: Change UT calls (17.78 KB, patch)
2019-09-06 18:55 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23404: (QA follow-up) Minor fix (792 bytes, patch)
2019-09-06 18:55 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin SOMERS 2019-07-31 13:02:25 UTC
Circulation::TooMany gets itemtype from $item var beeing a Koha::Item unblessed.
When itemtype is at biblio level, calling $item->{'itemtype'} is wrong.
Comment 1 Fridolin SOMERS 2019-07-31 14:00:42 UTC
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'
Comment 2 Fridolin SOMERS 2019-07-31 14:01:00 UTC
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"
Comment 3 Fridolin SOMERS 2019-07-31 14:01:14 UTC
Created attachment 91893 [details] [review]
Bug 23404: Change UT calls

Run prove t/db_dependent/Circulation/TooMany.t
Tests are OK
Comment 4 Fridolin SOMERS 2019-07-31 14:41:01 UTC
(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.
Comment 5 Fridolin SOMERS 2019-07-31 14:49:36 UTC
18.11.x needs to add to C4::Circulation::CanBookBeIssued :

    my $item_object = Koha::Items->find({barcode => $barcode });
after
    my $item = GetItem(undef, $barcode );
Comment 6 Kyle M Hall 2019-09-06 10:32:48 UTC
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>
Comment 7 Kyle M Hall 2019-09-06 10:33:02 UTC
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>
Comment 8 Kyle M Hall 2019-09-06 10:33:05 UTC
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>
Comment 9 Tomás Cohen Arazi 2019-09-06 18:54:58 UTC
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>
Comment 10 Tomás Cohen Arazi 2019-09-06 18:55:03 UTC
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>
Comment 11 Tomás Cohen Arazi 2019-09-06 18:55:13 UTC
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>
Comment 12 Tomás Cohen Arazi 2019-09-06 18:55:17 UTC
Created attachment 92658 [details] [review]
Bug 23404: (QA follow-up) Minor fix

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Martin Renvoize 2019-09-09 10:17:01 UTC
Nice work!

Pushed to master for 19.11.00
Comment 14 Fridolin SOMERS 2019-09-13 12:35:47 UTC
Pushed to 19.05.x for 19.05.04