From 93244efa3cbb66ff9e98d1eb4871da56a7565e5f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 Jan 2020 10:48:11 +0100 Subject: [PATCH] Bug 16547: Do not display "multi holds" view if only one is selected If a hold is selected from the result list, we should let the ability to select an item-level hold. Test plan: I. Detail page 1/ Go to a bibliographic record detail page 2/ Click "Place hold" 3/ Select a patron => No change expected, you can select an item II. Search result, multiple holds 1/ Search for an item with more than one search result 2/ Select several items, click 'Place hold' 3/ Enter a patron card number => No change expected, item level holds are not available. III. Search result, single hold 1/ Search for an item with more than one search result 2/ Select only one item, click 'Place hold' 3/ Enter a patron card number => With this patch applied, item level hold is available. The screen is the same as when you place a hold from the bibliographic record detail page => Without this patch you cannot place an item-level hold QA notes: We could go a bit further and remove the 2 biblionumbers and biblionumber from hold script, as well as remove the checkMultiHold in request.tt. We should not have a biblionumbers param that contain a list of biblionumber separated by '/' but several biblionumber parameters instead. QA notes 2: About placerequest.pl, see bug 19618 comment 27. Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- .../prog/en/modules/catalogue/results.tt | 1 - .../prog/en/modules/reserve/request.tt | 12 ------------ .../prog/en/modules/virtualshelves/shelves.tt | 1 - reserve/modrequest.pl | 3 +-- reserve/placerequest.pl | 18 +++++++----------- reserve/request.pl | 7 +++---- 6 files changed, 11 insertions(+), 31 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 78ac884a22..c24843edcc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -675,7 +675,6 @@ -
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index dfe26e2e5b..acb9bd9139 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -101,16 +101,11 @@ [% IF multi_hold %] - [% ELSE %] [% END %] - [% IF ( multi_hold ) %] - - - [% END %]
[% IF borrowers %] [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %] @@ -122,16 +117,11 @@ [% IF multi_hold %] - [% ELSE %] [% END %] - [% IF ( multi_hold ) %] - - - [% END %] [% IF clubs %] [% INCLUDE 'clubs-table.inc' destination = "holds" %] @@ -147,7 +137,6 @@
[% IF ( multi_hold ) %] - @@ -384,7 +373,6 @@ [% IF ( multi_hold ) %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 72420dd08c..5beada8871 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -382,7 +382,6 @@ -
diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl index 40c390297f..a1f9733733 100755 --- a/reserve/modrequest.pl +++ b/reserve/modrequest.pl @@ -49,7 +49,6 @@ my @reservedates = $query->multi_param('reservedate'); my @expirationdates = $query->multi_param('expirationdate'); my @branch = $query->multi_param('pickup'); my @itemnumber = $query->multi_param('itemnumber'); -my $multi_hold = $query->param('multi_hold'); my $biblionumbers = $query->param('biblionumbers'); my $count=@rank; @@ -94,7 +93,7 @@ if ( $from eq 'borrower'){ print $query->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrower[0]"); } else { my $url = "/cgi-bin/koha/reserve/request.pl?"; - if ($multi_hold) { + if (@biblionumber > 1) { $url .= "multi_hold=1&biblionumbers=$biblionumbers"; } else { $url .= "biblionumber=$biblionumber[0]"; diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 264ba9690f..88fa59338a 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -56,8 +56,9 @@ my $itemtype = $input->param('itemtype') || undef; my $borrower = Koha::Patrons->find( $borrowernumber ); $borrower = $borrower->unblessed if $borrower; -my $multi_hold = $input->param('multi_hold'); -my $biblionumbers = $multi_hold ? $input->param('biblionumbers') : ($biblionumber . '/'); +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; @@ -118,7 +119,7 @@ if ( $type eq 'str8' && $borrower ) { } - } elsif ($multi_hold) { + } elsif (@biblionumbers > 1) { my $bibinfo = $bibinfos{$biblionumber}; if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { AddReserve( @@ -161,15 +162,10 @@ if ( $type eq 'str8' && $borrower ) { } } - if ($multi_hold) { - if ($bad_bibs) { - $biblionumbers .= $bad_bibs; - } - print $input->redirect("request.pl?biblionumbers=$biblionumbers&multi_hold=1"); - } - else { - print $input->redirect("request.pl?biblionumber=$biblionumber"); + if ($bad_bibs) { + $biblionumbers .= $bad_bibs; } + print $input->redirect("request.pl?biblionumber=$biblionumber"); } elsif ( $borrowernumber eq '' ) { print $input->header(); diff --git a/reserve/request.pl b/reserve/request.pl index 23bd88e2b9..61f853d085 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -168,9 +168,8 @@ if ( $biblionumbers ) { push @biblionumbers, $input->multi_param('biblionumber'); } -my $multihold = scalar $input->param('multi_hold'); -# FIXME multi_hold should not be a variable but depends on the number of elements in @biblionumbers -$template->param(multi_hold => scalar $input->param('multi_hold')); +my $multi_hold = @biblionumbers > 1; +$template->param(multi_hold => $multi_hold); # If we have the borrowernumber because we've performed an action, then we # don't want to try to place another reserve. @@ -461,7 +460,7 @@ foreach my $biblionumber (@biblionumbers) { $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; if ( $do_check && $wants_check ) { $item->{checked_previously} = $do_check; - if ( $multihold ) { + if ( $multi_hold ) { $biblioloopiter{checked_previously} = $do_check; } else { $template->param( checked_previously => $do_check ); -- 2.39.5