From 6b80cda4c9dc3d519975114068b9e9927e2fa113 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 13 May 2022 15:23:30 +0000 Subject: [PATCH] Bug 30742: Remove 'bad_bibs' and send a list of holdable bibs Currently place request gets a list of bad_bibs that is created via javascript on the template. It ignores this list Ths patch instead doesn't add info for bad bibs, and provides a list of the bibs that can be held To test: 1 - Attempt multi hold with some items that can be held, and one that cannot due to notforloan 2 - Fill in pickup locations and place hold 3 - Note hold is place on bib with no avilable items and hsows twice in results 4 - Apply patch 5 - repeat with another patron 6 - Note no aidditonal hold on record with notforloan items 7 - Note with with not for loan items appears only once in results --- .../prog/en/modules/reserve/request.tt | 27 ++++++++----------- reserve/placerequest.pl | 8 ++---- 2 files changed, 13 insertions(+), 22 deletions(-) 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 f4812ad94e..96faff5868 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -200,11 +200,13 @@
[% IF ( multi_hold ) %] - [% FOREACH biblioloo IN biblioloop %] - - + [% UNLESS biblioloo.none_avail %] + + + + [% END %] [% END %] [% ELSE %] @@ -446,15 +448,17 @@ [% FOREACH biblionumber IN biblionumbers %] - + [% END %] [% IF ( multi_hold ) %] - [% FOREACH biblioloo IN biblioloop %] - - + [% UNLESS biblioloo.none_avail %] + + + + [% END %] [% END %] [% ELSE %] @@ -1411,15 +1415,6 @@ return false; } - var badSpans = $(".not_holdable"); - var badBibs = ""; - $(badSpans).each(function() { - var bibnum = $(this).attr("title"); - badBibs += bibnum + "/"; - }); - - $("#bad_bibs").val(badBibs); - $('#hold-request-form').preventDoubleFormSubmit(); return true; diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 0a8d6dd64e..7b8f7f84ac 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -37,6 +37,7 @@ checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet'); my @reqbib = $input->multi_param('reqbib'); my @biblionumbers = $input->multi_param('biblionumber'); +my @holdable_bibs = $input->multi_param('holdable_bibs'); my $borrowernumber = $input->param('borrowernumber'); my $notes = $input->param('notes'); my $branch = $input->param('pickup'); @@ -51,12 +52,10 @@ my $non_priority = $input->param('non_priority'); my $patron = Koha::Patrons->find( $borrowernumber ); -my $bad_bibs_param = $input->param('bad_bibs'); -my @bad_bibs = split '/', $bad_bibs_param; my $holds_to_place_count = $input->param('holds_to_place_count') || 1; my %bibinfos = (); -foreach my $bibnum (@biblionumbers) { +foreach my $bibnum ( @holdable_bibs ) { my %bibinfo = (); $bibinfo{title} = $input->param("title_$bibnum"); $bibinfo{rank} = $input->param("rank_$bibnum"); @@ -148,9 +147,6 @@ if ( $type eq 'str8' && $patron ) { } } - if (@bad_bibs) { - push @biblionumbers, @bad_bibs; - } my $redirect_url = URI->new("request.pl"); $redirect_url->query_form( biblionumber => [@biblionumbers]); print $input->redirect($redirect_url); -- 2.30.2