Bugzilla – Attachment 92568 Details for
Bug 22284
Add ability to define groups of locations for hold pickup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22284: Add "patron's hold group" as new hold_fulfillment_policy option
Bug-22284-Add-patrons-hold-group-as-new-holdfulfil.patch (text/plain), 7.41 KB, created by
Agustín Moyano
on 2019-09-03 14:45:57 UTC
(
hide
)
Description:
Bug 22284: Add "patron's hold group" as new hold_fulfillment_policy option
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-09-03 14:45:57 UTC
Size:
7.41 KB
patch
obsolete
>From 4a6c653042e35de6c3fa33c21cb8f4a5772508f9 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Mon, 27 May 2019 23:49:05 -0300 >Subject: [PATCH] Bug 22284: Add "patron's hold group" as new > hold_fulfillment_policy option > >This patch adds "patron's hold group" as a new option to Hold pickup library match > >To test: >1. Set ReservesControlBranch preference to item. >2. Create a hold group >3. Go to circulation and fines rules >SUCCESS => in 'Hold pickup library match' there is a new option called "patron's hold group" >4. In a library not in hold group set 'Hold policy' to "any" and 'Hold pickup library match' to "patron's hold group" >5. Search for a user in the hold group >6. 'Search to hold' for items of the library of step 4 >7. Select an item and 'Place hold for [user]' >SUCCESS => in 'Pickup at' you should see patron's hold group as options >8. In OPAC sign in as the same user of step 5 >9. Search for the item in step 7 >SUCCESS => in 'Pick up locations' you should see patron's hold group as options >10. Sign off > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Reserves.pm | 3 +++ > Koha/Item.pm | 16 ++++++++-------- > Koha/Libraries.pm | 3 ++- > .../prog/en/modules/admin/smart-rules.tt | 16 ++++++++++++++++ > reserve/request.pl | 2 +- > 5 files changed, 30 insertions(+), 10 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 482580f130..66c682d0bb 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -494,6 +494,9 @@ sub CanItemBeReserved { > unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) { > return { status => 'pickupNotInHoldGroup' }; > } >+ unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) { >+ return { status => 'pickupNotInHoldGroup' }; >+ } > } > > return { status => 'OK' }; >diff --git a/Koha/Item.pm b/Koha/Item.pm >index f0e1376cd9..9763115610 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -316,19 +316,19 @@ sub pickup_locations { > my $branchitemrule = > C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); > >- my $branch_control = C4::Context->preference('HomeOrHoldingBranch'); >- my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch; >- > my @libs; > if(defined $patron) { >- return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} ); >- return @libs if $branchitemrule->{holdallowed} == 1 && $library->branchcode ne $patron->branchcode; >+ return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} ); >+ return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode; > } > > if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') { >- @libs = $library->get_hold_libraries; >- my $circ_control_library = Koha::Libraries->find($circ_control_branch); >- push @libs, $circ_control_library unless scalar(@libs) > 0; >+ @libs = $self->home_branch->get_hold_libraries; >+ push @libs, $self->home_branch unless scalar(@libs) > 0; >+ } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') { >+ my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode}); >+ @libs = $plib->get_hold_libraries; >+ push @libs, $self->home_branch unless scalar(@libs) > 0; > } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') { > push @libs, $self->home_branch; > } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') { >diff --git a/Koha/Libraries.pm b/Koha/Libraries.pm >index bc92f0bb10..ebd552b3fc 100644 >--- a/Koha/Libraries.pm >+++ b/Koha/Libraries.pm >@@ -28,6 +28,7 @@ use Koha::Database; > use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Library; >+use Koha::Patrons; > > use base qw(Koha::Objects); > >@@ -75,7 +76,7 @@ sub pickup_locations { > ); > } > unless (! defined $patron || ref($patron) eq 'Koha::Patron') { >- $patron = Koha::Items->find($patron); >+ $patron = Koha::Patrons->find($patron); > } > > # Select libraries that are configured as pickup locations >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 7da8f8a0f3..e1d90c8824 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -496,6 +496,16 @@ > </option> > [% END %] > >+ [% IF hold_fulfillment_policy == 'patrongroup' %] >+ <option value="patrongroup" selected="selected"> >+ patron's hold group >+ </option> >+ [% ELSE %] >+ <option value="patrongroup"> >+ patron's hold group >+ </option> >+ [% END %] >+ > [% IF hold_fulfillment_policy == 'homebranch' %] > <option value="homebranch" selected="selected"> > item's home library >@@ -774,6 +784,8 @@ > <span>item's home library</span> > [% ELSIF hold_fulfillment_policy == 'holdgroup' %] > <span>item's hold group</span> >+ [% ELSIF hold_fulfillment_policy == 'patrongroup' %] >+ <span>patron's hold group</span> > [% ELSIF hold_fulfillment_policy == 'holdingbranch' %] > <span>item's holding library</span> > [% END %] >@@ -819,6 +831,10 @@ > item's hold group > </option> > >+ <option value="patrongroup"> >+ patron's hold group >+ </option> >+ > <option value="homebranch"> > item's home library > </option> >diff --git a/reserve/request.pl b/reserve/request.pl >index 06a49ceb7b..605f64c2e7 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -494,7 +494,7 @@ foreach my $biblionumber (@biblionumbers) { > if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) { > $item->{pickup_locations} = 'Any library'; > } else { >- $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations()); >+ $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations({ patron => $patron })); > } > > push( @available_itemtypes, $item->{itype} ); >-- >2.17.1
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 22284
:
88138
|
88139
|
88140
|
88141
|
88142
|
88143
|
88144
|
88145
|
88369
|
88561
|
88793
|
88794
|
88795
|
88796
|
88797
|
88798
|
88799
|
88800
|
88801
|
88802
|
88939
|
88940
|
88941
|
88942
|
88943
|
88944
|
88945
|
88946
|
88947
|
88948
|
88949
|
88955
|
88956
|
88957
|
88958
|
88959
|
88960
|
88961
|
88962
|
88963
|
88964
|
88965
|
89060
|
89061
|
89062
|
89063
|
89064
|
89065
|
89066
|
89067
|
89068
|
89069
|
89070
|
89071
|
89072
|
89073
|
89074
|
89075
|
89076
|
89077
|
89078
|
89079
|
89080
|
89081
|
89082
|
89083
|
89084
|
89085
|
89122
|
89123
|
89124
|
89125
|
89126
|
89127
|
89128
|
89129
|
89130
|
89131
|
89132
|
89133
|
89134
|
89135
|
89523
|
89836
|
89837
|
89838
|
89839
|
89840
|
89841
|
89842
|
89843
|
89844
|
89845
|
89846
|
89847
|
89848
|
89849
|
90133
|
90134
|
90197
|
90198
|
90199
|
90200
|
90201
|
90469
|
90525
|
91261
|
91262
|
91263
|
91264
|
91265
|
91266
|
91267
|
91268
|
91269
|
91270
|
91271
|
91272
|
91273
|
91274
|
91275
|
91276
|
91277
|
91278
|
91279
|
91280
|
91282
|
91701
|
91702
|
91703
|
91704
|
91705
|
91706
|
91707
|
91708
|
91709
|
91710
|
91711
|
91712
|
91713
|
91714
|
91715
|
91716
|
91717
|
91718
|
91719
|
91720
|
91721
|
91750
|
91751
|
91752
|
91753
|
91754
|
91755
|
91756
|
91757
|
91758
|
92554
|
92555
|
92556
|
92557
|
92558
|
92559
|
92560
|
92561
|
92562
|
92563
|
92564
|
92565
|
92566
|
92567
|
92568
|
92569
|
92570
|
92571
|
92572
|
92573
|
92574
|
92752
|
92753
|
92754
|
92755
|
92756
|
92757
|
92758
|
92759
|
92760
|
92761
|
92762
|
92763
|
92764
|
92849
|
92850
|
92851
|
92852
|
92853
|
92854
|
92855
|
92856
|
92857
|
92858
|
92859
|
92860
|
92861
|
94483
|
94484
|
94485
|
94486
|
94487
|
94488
|
94489
|
94490
|
94491
|
94492
|
94493
|
94494
|
94495
|
96437
|
96438
|
96439
|
96440
|
96441
|
96442
|
96443
|
96444
|
96445
|
96446
|
96447
|
96448
|
96449
|
96450
|
96544
|
96545
|
96546
|
96547
|
96548
|
96549
|
96550
|
96551
|
96552
|
96553
|
96554
|
96555
|
96556
|
96557
|
96558
|
115202