Bug 19276

Summary: CanBookBeIssued: unsuccessfully refers to borrower category_type X
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Kyle M Hall <kyle>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, kyle
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15438
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 17829    
Bug Blocks: 19280    
Attachments: Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour
Bug 19276: Update the number of tests

Description Marcel de Rooy 2017-09-08 09:08:49 UTC
This code seems to be unused now:
    if ( $borrower->{'category_type'} eq 'X' && (  $item->{barcode}  )) {
        # stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1  .
        &UpdateStats({
...

Why? The key category_type does not exist. Or perhaps does no longer exist. Perhaps it has been refactored to a Koha object hash or something ?
The check itself refers to a column in the categories table that formerly got included in the borrower hash.
Comment 1 Marcel de Rooy 2017-09-08 09:09:27 UTC
Found while testing 15438
Comment 2 Jonathan Druart 2017-09-08 15:14:05 UTC
This may have bad side-effects.
Comment 3 Jonathan Druart 2017-09-08 15:49:13 UTC
Created attachment 66997 [details] [review]
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour

Bug 17829 must have been handle this specific case: GetMember set
category_type, but now $borrower is a Koha::Patron unblessed and does
not contain the category_type.
The fix is to call ->category->category_type on the Koha::Patron object
to be able to know if they are a statistic patrons.

Test plan:
Run the tests
Comment 4 Jonathan Druart 2017-09-08 15:51:56 UTC
Lowering the severity, it's not in stable releases
Comment 5 Alex Buckley 2017-09-09 02:35:14 UTC
Created attachment 67028 [details] [review]
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour

Bug 17829 must have been handle this specific case: GetMember set
category_type, but now $borrower is a Koha::Patron unblessed and does
not contain the category_type.
The fix is to call ->category->category_type on the Koha::Patron object
to be able to know if they are a statistic patrons.

Test plan:
Run the tests

Tests pass, as does QA test tool
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 6 Kyle M Hall 2017-09-29 12:25:41 UTC
Created attachment 67445 [details] [review]
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour

Bug 17829 must have been handle this specific case: GetMember set
category_type, but now $borrower is a Koha::Patron unblessed and does
not contain the category_type.
The fix is to call ->category->category_type on the Koha::Patron object
to be able to know if they are a statistic patrons.

Test plan:
Run the tests

Tests pass, as does QA test tool
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Jonathan Druart 2017-09-29 20:18:17 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 8 Jonathan Druart 2017-09-29 22:40:00 UTC
Created attachment 67491 [details] [review]
Bug 19276: Update the number of tests
Comment 9 Jonathan Druart 2017-09-29 22:40:24 UTC
(In reply to Jonathan Druart from comment #8)
> Created attachment 67491 [details] [review] [review]
> Bug 19276: Update the number of tests

Pushed to master!
Comment 10 Fridolin Somers 2017-10-27 11:58:57 UTC
Depends on Bug 17829 that is not in 17.05.x