Bug 14783: Change pickup location from opac.
This patch allows users to change the pickup location for their holds from the opac. A syspref (OPACAllowUserToChangeBranch) controls at what stage a hold can be changed. To test: 1. Set up holds with diffrent statuses for a patron (pending, waiting, in transit, suspended) 2. No pickup locations for any hold should be able to be changed. 3. Turn on and off the different options under OPACAllowUserToChangeBranch. Make sure that only the corresponding holds can be changed from the opac. Check eg in the staff client that pickup location has changed. 4. The available pickup locations should respect any transfer restrictions. (Same as the holds list for a biblio in staff client) 5. For an in-transit hold: Check in the item at the original pickup location. 6. Note that it will be redirected to the new location. Sponsored-by: Lunds Universitetsbibliotek Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
ace48e8911
commit
4ef87fe837
6 changed files with 47 additions and 15 deletions
20
Koha/Hold.pm
20
Koha/Hold.pm
|
@ -906,6 +906,26 @@ sub to_api_mapping {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head3 can_change_branch_opac
|
||||||
|
|
||||||
|
returns if a hold can change pickup location from opac
|
||||||
|
|
||||||
|
my $can_change_branch_opac = $hold->can_change_branch_opac;
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub can_change_branch_opac {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
my @statuses = split /,/, C4::Context->preference("OPACAllowUserToChangeBranch");
|
||||||
|
foreach my $status ( @statuses ){
|
||||||
|
return 1 if ($status eq 'pending' && !$self->is_found && !$self->is_suspended );
|
||||||
|
return 1 if ($status eq 'intransit' && $self->is_in_transit);
|
||||||
|
return 1 if ($status eq 'suspended' && $self->is_suspended);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
=head2 Internal methods
|
=head2 Internal methods
|
||||||
|
|
||||||
=head3 _type
|
=head3 _type
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
$DBversion = 'XXX'; # will be replaced by the RM
|
||||||
|
if( CheckVersion( $DBversion ) ) {
|
||||||
|
$dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple');" );
|
||||||
|
$dbh->do( "UPDATE systempreferences set value = (SELECT CASE WHEN value = 1 THEN 'intransit' ELSE '' END FROM systempreferences WHERE variable = 'OPACInTransitHoldPickupLocationChange')");
|
||||||
|
$dbh->do( "DELETE FROM systempreferences WHERE variable = 'OPACInTransitHoldPickupLocationChange' ");
|
||||||
|
# Always end with this (adjust the bug info)
|
||||||
|
NewVersion( $DBversion, 14783, "Allow patrons to change pickup location for non-waiting holds");
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -695,12 +695,6 @@ Circulation:
|
||||||
1: Allow
|
1: Allow
|
||||||
0: "Don't allow"
|
0: "Don't allow"
|
||||||
- a patron to renew an item with unfilled holds if other available items can fill that hold.
|
- a patron to renew an item with unfilled holds if other available items can fill that hold.
|
||||||
-
|
|
||||||
- pref: OPACInTransitHoldPickupLocationChange
|
|
||||||
choices:
|
|
||||||
1: Allow
|
|
||||||
0: "Don't allow"
|
|
||||||
- patrons to change their in transit holds pickup location.
|
|
||||||
-
|
-
|
||||||
- pref: AllowHoldPolicyOverride
|
- pref: AllowHoldPolicyOverride
|
||||||
choices:
|
choices:
|
||||||
|
@ -801,6 +795,13 @@ Circulation:
|
||||||
1: Allow
|
1: Allow
|
||||||
0: "Don't allow"
|
0: "Don't allow"
|
||||||
- a user to choose the library to pick up a hold from.
|
- a user to choose the library to pick up a hold from.
|
||||||
|
-
|
||||||
|
- 'Allow users to change the library to pick up a hold for these statuses:'
|
||||||
|
- pref: OPACAllowUserToChangeBranch
|
||||||
|
multiple:
|
||||||
|
pending: Pending
|
||||||
|
intransit: In transit
|
||||||
|
suspended: Suspended
|
||||||
-
|
-
|
||||||
- pref: ReservesNeedReturns
|
- pref: ReservesNeedReturns
|
||||||
choices:
|
choices:
|
||||||
|
|
|
@ -82,16 +82,17 @@
|
||||||
[% UNLESS( singleBranchMode) %]
|
[% UNLESS( singleBranchMode) %]
|
||||||
<td class="branch">
|
<td class="branch">
|
||||||
<span class="tdlabel">Pick up location:</span>
|
<span class="tdlabel">Pick up location:</span>
|
||||||
[% IF Koha.Preference('OPACInTransitHoldPickupLocationChange') && HOLD.is_in_transit %]
|
[% IF ( HOLD.can_change_branch_opac ) %]
|
||||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
|
<form class="change_branch" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
|
||||||
<input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
|
<select name="new_branch" >
|
||||||
<select name="new_pickup_location" class="new_pickup_location" onchange="this.form.submit()">
|
[% PROCESS options_for_libraries libraries = Branches.pickup_locations({ search_params => { biblio => HOLD.biblionumber, patron => HOLD.borrower }, selected => HOLD.branchcode }) %]
|
||||||
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { item => HOLD.itemnumber, patron => logged_in_user }, selected => HOLD.branchcode }) %]
|
</select>
|
||||||
</select>
|
<input type="hidden" name="new_branch_reserveid" value="[% HOLD.reserve_id | html %]" />
|
||||||
|
<button class="btn btn-primary" type="submit" name="change_branch" value="1">Change</button>
|
||||||
</form>
|
</form>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
[% HOLD.branch.branchname | html %]
|
[% HOLD.branch.branchname | html %]
|
||||||
[% END %]
|
[% END %]
|
||||||
</td>
|
</td>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% IF ( showpriority ) %]
|
[% IF ( showpriority ) %]
|
||||||
|
|
|
@ -60,7 +60,7 @@ if ( $reserve_id && $borrowernumber ) {
|
||||||
}
|
}
|
||||||
elsif ( $new_pickup_location ) {
|
elsif ( $new_pickup_location ) {
|
||||||
|
|
||||||
if ( C4::Context->preference('OPACInTransitHoldPickupLocationChange') ) {
|
if ($hold->can_change_branch_opac){
|
||||||
$hold->set_pickup_location({ library_id => $new_pickup_location });
|
$hold->set_pickup_location({ library_id => $new_pickup_location });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue