Bug 21263 - Pickup library not set correctly when using Default holds policy by item type
Summary: Pickup library not set correctly when using Default holds policy by item type
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Target Milestone: ---
Assignee: Maryse Simard
QA Contact: Martin Renvoize
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-23 14:54 UTC by Caroline Cyr La Rose
Modified: 2019-04-19 16:29 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.05


Attachments
Bug 21263: Pickup library not set correctly when using Default holds policy (3.04 KB, patch)
2019-02-07 13:29 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 21263: Pickup library not set correctly when using Default holds policy (3.11 KB, patch)
2019-03-08 02:25 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 21263: Pickup library not set correctly when using Default holds policy (3.17 KB, patch)
2019-04-09 08:03 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2018-08-23 14:54:42 UTC
Not sure if this is a bug or just me misunderstanding the options

- Make sure OPACAllowUserToChooseBranch is set to don't allow
- Make sure you have two branches A and B
- Have one item whose homebranch is B
- Have one user whose homebranch is A
- Make sure the circulation rules allow the user to reserve the item's item type

1. Go to Administration > Circulation and fines rules
2. Create a Default holds policy by item type for that item type
    - Item type = item's item type
    - Hold policy = From any library
    - Hold pickup library branch = item's home library
    - Return policy = item returns home
3. Go to the OPAC and log in with the user's credentials
4. Search for the item
5. Click on "Place hold"
6. Confirm hold
7. In the user's file on the OPAC and check the reservation's pickup library

What I understand :
- Hold policy = From any library: Users from any library can reserve this item type
- Hold pickup library branch = item's home library: the pickup library must be the item's homebranch (in this case, B)
- Return policy = item returns home: upon return, the items is transferred to its homebranch

Therefore, the pickup library in the case above should be B, but it is automatically set to A.

P.S. note that I have item-level_itypes set to specific item, and Item level holds set to don't allow. I feel like in this case it should maybe fall back to the record-level item type?
Comment 1 Maryse Simard 2019-02-07 13:29:29 UTC
Created attachment 84846 [details] [review]
Bug 21263: Pickup library not set correctly when using Default holds policy

In the case of a specific item hold, it can only be fulfilled if the pickup library
matches the hold fulfillment policy. Therefore, if OPACAllowUserToChooseBranch is
set to don't allow, the pickup library should correspond to the policy.

In case of hold that does not specify an item, the homebranch or holdingbranch
can't be determined at this time, so the pickup library still defaults to the
homebranch of the borrower. Same if there is no policy or it states 'any'.

To test:
- Make sure OPACAllowUserToChooseBranch is set to don't allow
- Make sure you have two branches A and B
- Have one item whose homebranch is B
- Have one user whose homebranch is A
- Make sure the circulation rules allow the user to reserve the item's item type

1. Go to Administration > Circulation and fines rules
2. Create a Default holds policy by item type for that item type
    - Item type = item's item type
    - Hold policy = From any library
    - Hold pickup library match = item's home library
    - Return policy = item returns home
3. Go to the OPAC and log in with the user's credentials
4. Search for the item
5. Click on "Place hold"
6. Select a specific item and confirm hold
7. In the user's file on the OPAC and check the reservation's pickup library. It should be the item's homebranch

You can then repeat the steps for 'item's holding library' or 'any library' as
the Hold pickup library match. It should also work the same way if there is no
'Default holds policy by item type' for this item type but a 'Default checkout,
hold and return policy' set.

Finally, check that placing a hold without selecting a specific item still
defaults the pickup library to the borrower's homebranch.
Comment 2 Hayley Mapley 2019-03-08 02:25:16 UTC
Created attachment 86335 [details] [review]
Bug 21263: Pickup library not set correctly when using Default holds policy

In the case of a specific item hold, it can only be fulfilled if the pickup library
matches the hold fulfillment policy. Therefore, if OPACAllowUserToChooseBranch is
set to don't allow, the pickup library should correspond to the policy.

In case of hold that does not specify an item, the homebranch or holdingbranch
can't be determined at this time, so the pickup library still defaults to the
homebranch of the borrower. Same if there is no policy or it states 'any'.

To test:
- Make sure OPACAllowUserToChooseBranch is set to don't allow
- Make sure you have two branches A and B
- Have one item whose homebranch is B
- Have one user whose homebranch is A
- Make sure the circulation rules allow the user to reserve the item's item type

1. Go to Administration > Circulation and fines rules
2. Create a Default holds policy by item type for that item type
    - Item type = item's item type
    - Hold policy = From any library
    - Hold pickup library match = item's home library
    - Return policy = item returns home
3. Go to the OPAC and log in with the user's credentials
4. Search for the item
5. Click on "Place hold"
6. Select a specific item and confirm hold
7. In the user's file on the OPAC and check the reservation's pickup library. It should be the item's homebranch

You can then repeat the steps for 'item's holding library' or 'any library' as
the Hold pickup library match. It should also work the same way if there is no
'Default holds policy by item type' for this item type but a 'Default checkout,
hold and return policy' set.

Finally, check that placing a hold without selecting a specific item still
defaults the pickup library to the borrower's homebranch.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 3 Martin Renvoize 2019-04-09 08:03:30 UTC
Created attachment 87582 [details] [review]
Bug 21263: Pickup library not set correctly when using Default holds policy

In the case of a specific item hold, it can only be fulfilled if the pickup library
matches the hold fulfillment policy. Therefore, if OPACAllowUserToChooseBranch is
set to don't allow, the pickup library should correspond to the policy.

In case of hold that does not specify an item, the homebranch or holdingbranch
can't be determined at this time, so the pickup library still defaults to the
homebranch of the borrower. Same if there is no policy or it states 'any'.

To test:
- Make sure OPACAllowUserToChooseBranch is set to don't allow
- Make sure you have two branches A and B
- Have one item whose homebranch is B
- Have one user whose homebranch is A
- Make sure the circulation rules allow the user to reserve the item's item type

1. Go to Administration > Circulation and fines rules
2. Create a Default holds policy by item type for that item type
    - Item type = item's item type
    - Hold policy = From any library
    - Hold pickup library match = item's home library
    - Return policy = item returns home
3. Go to the OPAC and log in with the user's credentials
4. Search for the item
5. Click on "Place hold"
6. Select a specific item and confirm hold
7. In the user's file on the OPAC and check the reservation's pickup library. It should be the item's homebranch

You can then repeat the steps for 'item's holding library' or 'any library' as
the Hold pickup library match. It should also work the same way if there is no
'Default holds policy by item type' for this item type but a 'Default checkout,
hold and return policy' set.

Finally, check that placing a hold without selecting a specific item still
defaults the pickup library to the borrower's homebranch.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2019-04-09 08:03:45 UTC
I sort of wish this was within the Modules rather than at the controller/script side and as such I could request tests.

We could test it via selenium integration tests to prevent regression but that feels like a fairly big ask here.

As I can't find any regressions and it appears to work as expected I'm going to PQA.. but I'd love to see a more thorough treatment and unit tests down the line.
Comment 5 Nick Clemens 2019-04-11 13:55:59 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize 2019-04-16 13:00:35 UTC
Pushed to 18.11.x for 18.11.05
Comment 7 Lucas Gass 2019-04-19 16:29:10 UTC
backported to 18.05.x for 18.05.12