@@ -, +, @@
where all items notforloan Bug 30742: Remove 'bad_bibs' and send a list of
holdable bibs Bug 30892: (bug 30742 follow-up) Send single bib as a holdable
bib
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 | 52 ++++++++++++-------
reserve/placerequest.pl | 5 +-
reserve/request.pl | 11 ++--
3 files changed, 41 insertions(+), 27 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -206,14 +206,17 @@
[% IF ( multi_hold ) %]
-
[% FOREACH biblioloo IN biblioloop %]
-
-
+ [% UNLESS biblioloo.none_avail %]
+
+
+
+ [% END %]
[% END %]
[% ELSE %]
+
[% END # /IF multi_hold %]
@@ -403,6 +406,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 %]
@@ -450,14 +455,17 @@
[% IF ( multi_hold ) %]
-
[% FOREACH biblioloo IN biblioloop %]
-
-
+ [% UNLESS biblioloo.none_avail %]
+
+
+
+ [% END %]
[% END %]
[% ELSE %]
+
[% END # /IF multi_hold %]
@@ -666,6 +674,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 %]
@@ -760,6 +770,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 %]
@@ -886,13 +898,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 %]
@@ -1383,15 +1403,7 @@
return false;
}
- var badSpans = $(".not_holdable");
- var badBibs = "";
- $(badSpans).each(function() {
- var bibnum = $(this).attr("title");
- badBibs += bibnum + "/";
- });
-
$("#multi_hold_bibs").val(biblionumbers);
- $("#bad_bibs").val(badBibs);
$('#hold-request-form').preventDoubleFormSubmit();
--- a/reserve/placerequest.pl
+++ a/reserve/placerequest.pl
@@ -36,6 +36,7 @@ checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet');
my @bibitems = $input->multi_param('biblioitem');
my @reqbib = $input->multi_param('reqbib');
+my @holdable_bibs = $input->multi_param('holdable_bibs');
my $biblionumber = $input->param('biblionumber');
my $borrowernumber = $input->param('borrowernumber');
my $notes = $input->param('notes');
@@ -55,7 +56,6 @@ $borrower = $borrower->unblessed if $borrower;
my $biblionumbers = $input->param('biblionumbers');
$biblionumbers ||= $biblionumber . '/';
-my $bad_bibs = $input->param('bad_bibs');
my $holds_to_place_count = $input->param('holds_to_place_count') || 1;
my %bibinfos = ();
@@ -164,9 +164,6 @@ if ( $type eq 'str8' && $borrower ) {
}
}
- if ($bad_bibs) {
- $biblionumbers .= $bad_bibs;
- }
print $input->redirect("request.pl?biblionumbers=$biblionumbers");
}
elsif ( $borrowernumber eq '' ) {
--- a/reserve/request.pl
+++ a/reserve/request.pl
@@ -320,6 +320,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+$|;
@@ -443,7 +444,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my @available_itemtypes;
foreach my $biblioitemnumber (@biblioitemnumbers) {
my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber};
- my $num_available = 0;
+ my $num_items_available = 0;
my $num_override = 0;
my $hiddencount = 0;
my $num_alreadyheld = 0;
@@ -556,6 +557,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
}
# If there is no loan, return and transfer, we show a checkbox.
+ $item->{notforloanitype} = $itemtypes->{$item->{itype}}{notforloan};
$item->{notforloan} ||= 0;
# if independent branches is on we need to check if the person can reserve
@@ -580,6 +582,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{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 } );
@@ -597,7 +600,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;
@@ -659,7 +662,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{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;
@@ -767,9 +770,11 @@ 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 );
--