@@ -, +, @@
items notforloan
1 - Find or create a record with all items of itemtype marked 'notforloan'
2 - Attempt to place single hold on this record from staff client
3 - See one disab;ed button, one enabled 'Place holds' button
4 - Click 'Place holds' - hold placed
5 - Cancel hold
6 - Place multiple holds with some bibs that can be held, and this one that cannot
7 - Notice message that 'Cannot place hold on some items'
8 - Click 'Place holds' - hold is generated for the notforloan bib
9 - Apply patch
---
.../prog/en/modules/reserve/request.tt | 26 ++++++++++++++-----
reserve/request.pl | 21 ++++++++++-----
2 files changed, 35 insertions(+), 12 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -399,6 +399,8 @@
Too many holds for [% biblioloo.title | html %] : [% patron.firstname | html %] [% patron.surname | html %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.
[% END %]
[% END %]
+ [% ELSIF ( none_available ) %]
+ No items available: One or more records have no items that can be held
[% END # /IF exceeded_maxreserves %]
[% END # /UNLESS multi_hold %]
@@ -663,6 +665,8 @@
Library is not a pickup location
[% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
No valid pickup location
+ [% ELSIF itemloo.not_holdable == 'notforloan' %]
+ Not for loan
[% ELSE %]
[% itemloo.not_holdable | html %]
[% END %]
@@ -769,6 +773,8 @@
[% IF ( itemloo.notforloan ) %]
Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])
+ [% ELSIF ( itemloo.notforloanitype ) %]
+ Not for loan (Itemtype not for loan)
[% END %]
@@ -883,13 +889,21 @@
[% IF ( patron AND patron.borrowernumber ) %]
- [% IF ( override_required ) %]
- Place holds
- [% ELSIF ( none_available ) %]
- Place holds
- [% ELSE %]
- [% IF ( multi_hold ) %]
+ [% IF ( multi_hold ) %]
+ [% IF ( override_required ) %]
+ Place holds
+ [% ELSIF ( no_bibs_available ) %]
+ Place holds
+ [% ELSIF ( none_available ) %]
+ Place holds
+ [% ELSE %]
Place holds
+ [% END %]
+ [% ELSE %]
+ [% IF ( override_required ) %]
+ Place hold
+ [% ELSIF ( none_available ) %]
+ Place hold
[% ELSE %]
Place hold
[% END %]
--- a/reserve/request.pl
+++ a/reserve/request.pl
@@ -71,7 +71,7 @@ my $pickup = $input->param('pickup');
my $itemtypes = {
map {
$_->itemtype =>
- { %{ $_->unblessed }, image_location => $_->image_location }
+ { %{ $_->unblessed }, image_location => $_->image_location, notforloan => $_->notforloan }
} Koha::ItemTypes->search_with_localization->as_list
};
@@ -294,6 +294,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my $itemdata_ccode = 0;
my @biblioloop = ();
my $no_reserves_allowed = 0;
+ my $num_bibs_available = 0;
foreach my $biblionumber (@biblionumbers) {
next unless $biblionumber =~ m|^\d+$|;
@@ -382,7 +383,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
if ( $club_hold or $borrowernumber_hold ) {
my @available_itemtypes;
- my $num_available = 0;
+ my $num_items_available = 0;
my $num_override = 0;
my $hiddencount = 0;
my $num_alreadyheld = 0;
@@ -462,6 +463,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
}
# If there is no loan, return and transfer, we show a checkbox.
+ $item->{notforloanitype} = $item->{itemtype}->{notforloan};
$item->{notforloan} ||= 0;
# if independent branches is on we need to check if the person can reserve
@@ -486,6 +488,8 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status};
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
+ $item->{not_holdable} ||= 'notforloan' if ( $item->{notforloanitype} || $item->{notforloan} > 0 );
+
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
@@ -502,7 +506,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my $pickup_locations = $item_object->pickup_locations({ patron => $patron });
$item->{pickup_locations_count} = $pickup_locations->count;
if ( $item->{pickup_locations_count} > 0 ) {
- $num_available++;
+ $num_items_available++;
$item->{available} = 1;
# pass the holding branch for use as default
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next;
@@ -524,7 +528,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
$item->{pickup_locations_count} = scalar @pickup_locations;
if ( @pickup_locations ) {
- $num_available++;
+ $num_items_available++;
$item->{available} = 1;
my $default_pickup_location;
@@ -543,9 +547,11 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
} else { $num_alreadyheld++ }
push( @available_itemtypes, $item->{itype} );
+ } else {
+ # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
+ $item->{available} = 0;
}
- # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
# Show serial enumeration when needed
if ($item->{enumchron}) {
@@ -567,7 +573,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioloopiter{itemloop} } ) ) {
# That is, if all items require an override
$template->param( override_required => 1 );
- } elsif ( $num_available == 0 ) {
+ } elsif ( $num_items_available == 0 ) {
$template->param( none_available => 1 );
$biblioloopiter{warn} = 1;
$biblioloopiter{none_avail} = 1;
@@ -675,9 +681,12 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
$biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ];
}
+ $num_bibs_available++ unless $biblioloopiter{none_avail};
push @biblioloop, \%biblioloopiter;
}
+ $template->param( no_bibs_available => 1 ) unless $num_bibs_available > 0;
+
$template->param( biblioloop => \@biblioloop );
$template->param( no_reserves_allowed => $no_reserves_allowed );
$template->param( exceeded_maxreserves => $exceeded_maxreserves );
--