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?
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.
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>
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>
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.
Awesome work all! Pushed to master for 19.05
Pushed to 18.11.x for 18.11.05
backported to 18.05.x for 18.05.12
I think this patch needs a small adjustment to be more generally useful. We have OPACAllowUserToChooseBranch set to allow as we're a consortium where users frequently use other libraries than their homebranch Sometimes we want to use the combination Hold policy from any library in combination with Hold pickup library match item's home library Default holds policy by item type is still not respected for this combination when this patch is applied Would it work even for us if we delete this condition? if ( ! C4::Context->preference("OPACAllowUserToChooseBranch")