Bug 19276 - CanBookBeIssued: unsuccessfully refers to borrower category_type X
Summary: CanBookBeIssued: unsuccessfully refers to borrower category_type X
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 17829
Blocks: 19280
  Show dependency treegraph
 
Reported: 2017-09-08 09:08 UTC by Marcel de Rooy
Modified: 2018-06-04 20:10 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour (3.88 KB, patch)
2017-09-08 15:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour (3.96 KB, patch)
2017-09-09 02:35 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour (4.01 KB, patch)
2017-09-29 12:25 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 19276: Update the number of tests (627 bytes, patch)
2017-09-29 22:40 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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