Bug 36868: (follow-up) Fix staff interface code

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Sarah Fletcher <sfletcher@ncwlibraries.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lucas Gass 2024-06-06 21:57:23 +00:00 committed by Pedro Amorim
parent 723258423c
commit 42ca5a7b6a
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 20 additions and 4 deletions

View File

@ -286,7 +286,6 @@
</ul>
</div>
[% END %]
[% UNLESS ( multi_hold ) %]
<h2>Place hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %]by [% biblio.author | html %][% END %]</h2>
@ -1564,6 +1563,12 @@
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'select2.inc' %]
<script nonce="[% Koha.CSPNonce | $raw %]">
hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %];
</script>
[% Asset.js("js/holds.js") | $raw %]
[% Asset.js("js/hold-group.js") | $raw %]
[% Asset.js("js/basket.js") | $raw %]
[% SET url_biblio_params = (supplyill ? "supplyill=" _ supplyill _ "&amp;" : "") _ "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
[% IF multi_hold %]
@ -2028,6 +2033,12 @@
if (!localStorage.selectedHolds || document.referrer.replace(/\?.*/, "") !== document.location.origin + document.location.pathname) {
localStorage.selectedHolds = [];
}
[% IF successful_holds && Koha.Preference('AutoDeleteFromCartWhenHoldPlaced').grep('staff').size %]
[% FOREACH success IN successful_holds.split('\|') %]
delSingleRecord('[% success | html %]');
[% END %]
[% END %]
});
</script>
[% UNLESS patron %]

View File

@ -81,6 +81,7 @@ if ( $op eq 'cud-placerequest' && $patron ) {
my %failed_holds;
my @successful_hold_ids;
my @successful_biblionumbers;
foreach my $biblionumber ( keys %bibinfos ) {
my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
@ -121,6 +122,7 @@ if ( $op eq 'cud-placerequest' && $patron ) {
iso18626_payload => \%iso18626_payload,
}
);
push @successful_biblionumbers, $biblionumber;
push @successful_hold_ids, $reserve_id;
$hold_priority++;
@ -154,6 +156,7 @@ if ( $op eq 'cud-placerequest' && $patron ) {
}
);
push @successful_hold_ids, $reserve_id;
push @successful_biblionumbers, $biblionumber;
}
} else {
@ -180,6 +183,7 @@ if ( $op eq 'cud-placerequest' && $patron ) {
}
);
push @successful_hold_ids, $reserve_id;
push @successful_biblionumbers, $biblionumber;
}
}
}
@ -195,6 +199,7 @@ if ( $op eq 'cud-placerequest' && $patron ) {
push( @failed_hold_msgs, $msg );
}
$redirect_url->query_form( biblionumber => [@biblionumbers], failed_holds => \@failed_hold_msgs );
$redirect_url .= "&successful_holds=" . join( '|', @successful_biblionumbers );
print $input->redirect($redirect_url);
} elsif ( $borrowernumber eq '' ) {
print $input->header();

View File

@ -92,7 +92,8 @@ my $exceeded_holds_per_record;
my @failed_holds = $input->multi_param('failed_holds');
my $form_submitted = $input->param('form_submitted');
my $op = $input->param('op') || q{};
my @successful_holds = $input->multi_param('successful_holds');
my $op = $input->param('op') || q{};
if ( $op eq 'cud-move' ) {
my $where = $input->param('where');
@ -803,8 +804,7 @@ $template->param( biblionumbers => \@biblionumbers );
$template->param( pickup => $pickup || C4::Context->userenv->{branch} );
$template->param( borrowernumber => $borrowernumber_hold );
$template->param( failed_holds => \@failed_holds );
$template->param( failed_holds => \@failed_holds, successful_holds => @successful_holds );
# printout the page
output_html_with_http_headers $input, $cookie, $template->output;