Bug 17453: Add exceptions
This patch adds the ability to define patron categories not affected by the behavior of OPACHoldsIfAvailableAtPickup. The new pref OPACHoldsIfAvailableAtPickupExceptions get a list of patron categories (separated by pipes |). Signed-off-by: Nick Clemens <nick@bywatersolutions.com> https://bugs.koha-community.org/show_bug.cgi?id=14753 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
00c5929c1a
commit
d1d12fc770
4 changed files with 18 additions and 3 deletions
|
@ -1,2 +1,4 @@
|
|||
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
|
||||
('OPACHoldsIfAvailableAtPickup','1','','Allow to pickup up holds at libraries where the item is available','YesNo');
|
||||
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
|
||||
('OPACHoldsIfAvailableAtPickupExceptions','','','List the patron categories not affected by OPACHoldsIfAvailableAtPickup if off','Free');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -653,6 +653,10 @@ Circulation:
|
|||
yes: Allow
|
||||
no: "Don't allow"
|
||||
- to pickup up holds at libraries where the item is available.
|
||||
-
|
||||
- "Patron categories not affected by OPACHoldsIfAvailableAtPickup"
|
||||
- pref: OPACHoldsIfAvailableAtPickupExceptions
|
||||
- "(list of patron categories separated with a pipe '|')"
|
||||
Fines Policy:
|
||||
-
|
||||
- Calculate fines based on days overdue
|
||||
|
|
|
@ -73,6 +73,14 @@ sub get_out {
|
|||
my ( $borr ) = GetMember( borrowernumber => $borrowernumber );
|
||||
my $patron = Koha::Patrons->find( $borrowernumber );
|
||||
|
||||
my $can_place_hold_if_available_at_pickup = C4::Context->preference('OPACHoldsIfAvailableAtPickup');
|
||||
unless ( $can_place_hold_if_available_at_pickup ) {
|
||||
my @patron_categories = split '\|', C4::Context->preference('OPACHoldsIfAvailableAtPickupExceptions');
|
||||
if ( @patron_categories ) {
|
||||
$can_place_hold_if_available_at_pickup = grep /$borr->{categorycode}/, @patron_categories;
|
||||
}
|
||||
}
|
||||
|
||||
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
|
||||
if ( $patron->category->effective_BlockExpiredPatronOpacActions ) {
|
||||
|
||||
|
@ -278,7 +286,7 @@ if ( $query->param('place_reserve') ) {
|
|||
$canreserve = 0;
|
||||
}
|
||||
|
||||
unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
|
||||
unless ( $can_place_hold_if_available_at_pickup ) {
|
||||
$canreserve = 0 if Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch })->count;
|
||||
}
|
||||
|
||||
|
@ -526,7 +534,7 @@ foreach my $biblioNum (@biblionumbers) {
|
|||
}
|
||||
$numCopiesAvailable++;
|
||||
|
||||
if ( not C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
|
||||
unless ( $can_place_hold_if_available_at_pickup ) {
|
||||
push @not_available_at, $itemInfo->{holdingbranch};
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +570,7 @@ foreach my $biblioNum (@biblionumbers) {
|
|||
$biblioLoopIter{not_available_at} = \@not_available_at ;
|
||||
}
|
||||
|
||||
unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
|
||||
unless ( $can_place_hold_if_available_at_pickup ) {
|
||||
@not_available_at = uniq @not_available_at;
|
||||
$biblioLoopIter{not_available_at} = \@not_available_at ;
|
||||
# The record is not holdable is not available at any of the libraries
|
||||
|
|
Loading…
Reference in a new issue