Bugzilla – Attachment 135204 Details for
Bug 23659
Allow hold pickup location to default to item home branch for item-level holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23659: Add DefaultHoldPickupLocation system preference
Bug-23659-Add-DefaultHoldPickupLocation-system-pre.patch (text/plain), 7.55 KB, created by
Andrew Fuerste-Henry
on 2022-05-19 13:40:02 UTC
(
hide
)
Description:
Bug 23659: Add DefaultHoldPickupLocation system preference
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2022-05-19 13:40:02 UTC
Size:
7.55 KB
patch
obsolete
>From 3974477be767fc44ce505a94341377b040958024 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 18 May 2022 14:21:35 +0000 >Subject: [PATCH] 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> >--- > ...23659_add_default_pickup_location_syspref.pl | 17 +++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../modules/admin/preferences/circulation.pref | 8 ++++++++ > reserve/request.pl | 17 ++++++++++++----- > 4 files changed, 38 insertions(+), 5 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_23659_add_default_pickup_location_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_23659_add_default_pickup_location_syspref.pl b/installer/data/mysql/atomicupdate/bug_23659_add_default_pickup_location_syspref.pl >new file mode 100755 >index 0000000000..b9c49f9852 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23659_add_default_pickup_location_syspref.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "23659", >+ description => "Add DefaultHoldPickupLocation syspref", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('DefaultHoldPickupLocation','loggedinlibrary','loggedinlibrary|homebranch|holdingbranch','Which branch should a hold pickup location default to. ','choice') >+ }); >+ # Print useful stuff here >+ say $out "Added DefaultHoldPickupLocation syspref"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index d8f6f094dd..9e57b030e5 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -164,6 +164,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('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'), > ('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'), > ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'), > ('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the borrower's account when the LOST value of the item changes to n.", 'integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 750e731832..208d312d9e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -930,6 +930,14 @@ Circulation: > months: months > years: years > - from reserve date. >+ - >+ - When placing a hold via the staff client default the pickup location to the >+ - pref: DefaultHoldPickupLocation >+ default: loggedinlibrary >+ choices: >+ loggedinlibrary: "logged in library" >+ homebranch: "item's home branch" >+ holdingbranch: "item's holding branch" > Interlibrary loans: > - > - pref: ILLModule >diff --git a/reserve/request.pl b/reserve/request.pl >index c89a89ee90..73a3368637 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -489,6 +489,16 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); > >+ my $default_hold_pickup_location_pref = C4::Context->preference('DefaultHoldPickupLocation'); >+ my $default_pickup_branch; >+ if( $default_hold_pickup_location_pref eq 'homebranch' ){ >+ $default_pickup_branch = $item->{homebranch}; >+ } elsif ( $default_hold_pickup_location_pref eq 'holdingbranch' ){ >+ $default_pickup_branch = $item->{holdingbranch}; >+ } else { >+ $default_pickup_branch = C4::Context->userenv->{branch}; >+ } >+ > if ( > !$item->{cantreserve} > && !$exceeded_maxreserves >@@ -505,7 +515,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $num_available++; > $item->{available} = 1; > # pass the holding branch for use as default >- my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; >+ my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; > $item->{default_pickup_location} = $default_pickup_location; > } > else { >@@ -529,10 +539,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > my $default_pickup_location; > >- # Default to logged-in, if valid >- if ( C4::Context->userenv->{branch} ) { >- ($default_pickup_location) = grep { $_->branchcode eq C4::Context->userenv->{branch} } @pickup_locations; >- } >+ ($default_pickup_location) = grep { $_->branchcode eq $default_pickup_branch } @pickup_locations; > > $item->{default_pickup_location} = $default_pickup_location; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23659
:
135120
|
135204
|
135263
|
135278
|
135279