Bug 23659

Summary: Allow hold pickup location to default to item home branch for item-level holds
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: Hold requestsAssignee: Nick Clemens (kidclamp) <nick>
Status: RESOLVED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, caroline.cyr-la-rose, cbrannon, dch, gmcharlt, jonathan.druart, katrin.fischer, lucas, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29349
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/616
Text to go in the release notes:
This patch adds a new system preference 'DefaultHoldPickupLocation' This preference will allow the library to determine which library is the default for pickup location dropdowns while placing holds in the staff client. The options are logged in library, homebranch, or holdingbranch Previously the behavior was inconsistent, and varied between versions. Libraries may need to adjust this preference after upgrade to mirror their expected workflow
Version(s) released in:
22.11.00, 22.05.01
Bug Depends on: 29660    
Bug Blocks: 30811, 30990    
Attachments: Bug 23659: Add DefaultHoldPickupLocation system preference
Bug 23659: Add DefaultHoldPickupLocation system preference
Bug 23659: (follow-up) Correct syspref.sql to match atomicupdate
Bug 23659: Add DefaultHoldPickupLocation system preference
Bug 23659: (follow-up) Correct syspref.sql to match atomicupdate

Description Andrew Fuerste-Henry 2019-09-20 19:35:28 UTC
Koha defaults hold pickup location to the patron's home branch. Some libraries would prefer that hold pickup default to the item's home branch instead.
Comment 1 Christopher Brannon 2021-10-13 23:12:44 UTC
Actually, right now in 21.05, it looks like there is a bug and pickup location for specific items is defaulting to the item's home branch.  This is certainly not a desired effect for all libraries.
Comment 2 Nick Clemens (kidclamp) 2022-05-06 10:20:54 UTC
Currently in master:
If a hold is allowed, we default the pickup location to the item's home library
If a hold is allowed via override, we default to the logged in library

Before bug 29660:
If a hold was allowed, we default the pickup location to the logged in library
If a hold was allowed via override, we default to the item's home library

This means master and stables have reversed the defaults

I think we need to make this configurable and consistent
Comment 3 Nick Clemens (kidclamp) 2022-05-18 14:28:31 UTC
Created attachment 135120 [details] [review]
Bug 23659: Add DefaultHoldPickupLocation system preference

On the staff side behaviour differs for default pickup location when placing a hold or
placing an overridden hold. Additionally, the behaviour has changed betwee master and stables

We should provide a consistent default, and allow the library to specify their choice

Note this only affects staff client as there is only a single dropdown on OPAC and it is not
tied to items

To test:
 1 - Apply patch
 2 - Update database
 3 - Find a record with items from various branches, and at least one with a different home/holding branch
 4 - Ensure there is an item that requires override to hold, and  AllowHoldPolicyOverride  is enabled
 4 - Attempt to place hold
 5 - Confirm all dropdowns default to logged in library
 6 - Set DefaultHoldPickupLocation to item's home branch
 7 - Refresh and confirm all dropdowns match item home library except biblio level hold - still logged in library
 8 - Set DefaultHoldPickupLocation to item's holding branch
 9 - Refresh and confirm defaults
10 - Mark one of the items holding library as 'not a pickup location' in Admin->Libraries
11 - Refresh and confirm dropdown is now empty for that item
Comment 4 Andrew Fuerste-Henry 2022-05-19 13:40:02 UTC
Created attachment 135204 [details] [review]
Bug 23659: Add DefaultHoldPickupLocation system preference

On the staff side behaviour differs for default pickup location when placing a hold or
placing an overridden hold. Additionally, the behaviour has changed betwee master and stables

We should provide a consistent default, and allow the library to specify their choice

Note this only affects staff client as there is only a single dropdown on OPAC and it is not
tied to items

To test:
 1 - Apply patch
 2 - Update database
 3 - Find a record with items from various branches, and at least one with a different home/holding branch
 4 - Ensure there is an item that requires override to hold, and  AllowHoldPolicyOverride  is enabled
 4 - Attempt to place hold
 5 - Confirm all dropdowns default to logged in library
 6 - Set DefaultHoldPickupLocation to item's home branch
 7 - Refresh and confirm all dropdowns match item home library except biblio level hold - still logged in library
 8 - Set DefaultHoldPickupLocation to item's holding branch
 9 - Refresh and confirm defaults
10 - Mark one of the items holding library as 'not a pickup location' in Admin->Libraries
11 - Refresh and confirm dropdown is now empty for that item

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 5 Martin Renvoize 2022-05-23 11:11:12 UTC
Comment on attachment 135204 [details] [review]
Bug 23659: Add DefaultHoldPickupLocation system preference

Review of attachment 135204 [details] [review]:
-----------------------------------------------------------------

::: installer/data/mysql/mandatory/sysprefs.sql
@@ +164,4 @@
>  ('DefaultHoldExpirationdate','0','','Automatically set expiration date for holds','YesNo'),
>  ('DefaultHoldExpirationdatePeriod','0','','How long into the future default expiration date is set to be.','integer'),
>  ('DefaultHoldExpirationdateUnitOfTime','days','days|months|years','Which unit of time is used when setting the default expiration date. ','choice'),
> +('DefaultHoldPickupLocation','loggedinlibrary','loggedinlibrary|homelibrary','Which branch should a hold pickup location default to. ','choice'),

loggedinlibrary|homelibrary doesn't match the options in the upgrade of 'loggedinlibrary|homebranch|holdingbranch' here.
Comment 6 Nick Clemens (kidclamp) 2022-05-23 13:00:30 UTC
Created attachment 135263 [details] [review]
Bug 23659: (follow-up) Correct syspref.sql to match atomicupdate

Missed updating this file when I added another option and renamed another
Comment 7 Martin Renvoize 2022-05-23 15:21:03 UTC
Created attachment 135278 [details] [review]
Bug 23659: Add DefaultHoldPickupLocation system preference

On the staff side behaviour differs for default pickup location when placing a hold or
placing an overridden hold. Additionally, the behaviour has changed betwee master and stables

We should provide a consistent default, and allow the library to specify their choice

Note this only affects staff client as there is only a single dropdown on OPAC and it is not
tied to items

To test:
 1 - Apply patch
 2 - Update database
 3 - Find a record with items from various branches, and at least one with a different home/holding branch
 4 - Ensure there is an item that requires override to hold, and  AllowHoldPolicyOverride  is enabled
 4 - Attempt to place hold
 5 - Confirm all dropdowns default to logged in library
 6 - Set DefaultHoldPickupLocation to item's home branch
 7 - Refresh and confirm all dropdowns match item home library except biblio level hold - still logged in library
 8 - Set DefaultHoldPickupLocation to item's holding branch
 9 - Refresh and confirm defaults
10 - Mark one of the items holding library as 'not a pickup location' in Admin->Libraries
11 - Refresh and confirm dropdown is now empty for that item

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2022-05-23 15:21:07 UTC
Created attachment 135279 [details] [review]
Bug 23659: (follow-up) Correct syspref.sql to match atomicupdate

Missed updating this file when I added another option and renamed another

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2022-05-23 15:21:31 UTC
Thanks Nick.. all looking good now.. PQA
Comment 10 Tomás Cohen Arazi 2022-06-06 14:47:28 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 11 Lucas Gass 2022-06-16 14:40:58 UTC
Pushed to 22.05.x for 22.05.01
Comment 12 Arthur Suzuki 2022-06-21 13:59:12 UTC
depends on 29660, not relevant for 21.11.
won't backport
Comment 13 Katrin Fischer 2023-06-10 23:45:41 UTC
*** Bug 32024 has been marked as a duplicate of this bug. ***