From a8f42e950c61ea8bb53943e27e9ee6e67cd45146 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 25 Jun 2021 12:53:35 -0400 Subject: [PATCH] Bug 26282: Show reason only if notice exists --- .../intranet-tmpl/prog/en/includes/holds_table.inc | 8 ++++++++ .../intranet-tmpl/prog/en/modules/reserve/request.tt | 10 ++++++---- reserve/request.pl | 7 +++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 59f33cd2a0..c3bcb07181 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -75,6 +75,14 @@ + + [% IF cancel_notice_branches.size %] + [% SET bc = hold.patron.branchcode %] + [% SET all_bc = "" %] + [% UNLESS cancel_notice_branches.$bc || cancel_notice_branches.$all_bc %] + Cancellation will not recieve a notice. + [% END %] + [% END %] [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] 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 34642b9fa7..2f999fb056 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -879,7 +879,7 @@
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] - [% IF hold_cancellation %] + [% IF hold_cancellation && cancel_notice_branches.size %] @@ -1092,12 +1092,14 @@ $.fn.select2.defaults.set("dropdownAutoWidth", true ); $(document).ready(function() { - $('#cancellation-reason-fieldset').hide(); + $('#cancellation-reason-fieldset, .no-notice-warning').hide(); $('.rank-request').on('change', function() { if ( $(".rank-request option:selected[value='del']").length ) { $('#cancellation-reason-fieldset').show(); + $('.no-notice-warning').show(); } else { $('#cancellation-reason-fieldset').hide(); + $('.no-notice-warning').hide(); } }); diff --git a/reserve/request.pl b/reserve/request.pl index 17f52b66ea..e62b146f8e 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -769,7 +769,14 @@ if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) { $template->param( reserve_in_future => 1 ); } +my $cancel_notify_templates = Koha::Notice::Templates->search({ module => 'reserves', code => 'HOLD_CANCELLATION' }); +my $cancel_notice_branches; +while ( my $notice = $cancel_notify_templates->next ) { + $cancel_notice_branches->{$notice->branchcode} = 1; +} + $template->param( + cancel_notice_branches => $cancel_notice_branches, SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), ); -- 2.30.1 (Apple Git-130)