From 75612e84b0450937370364a7cc5ee189be5d4c78 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 27 Nov 2020 09:31:26 +0100 Subject: [PATCH] Bug 26282: Disable the checkbox if no reason selected On this bug report we want to explicitly tell the librarian than a notice will be generate if a cancellation reason is selected. If the new checkbox we have a situation if the checkbox is selected and no reason selected => no notice will be generated This patch is not the optimal solution but answers the original need, without string changes (today is release day...) and without too many modifications in the code. Additional follow-up bug report must be opened to deal properly with this specific use case. --- .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 7 ++++++- .../intranet-tmpl/prog/en/modules/circ/pendingreserves.tt | 5 +++++ .../intranet-tmpl/prog/en/modules/members/moremember.tt | 8 +++++++- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 7 ++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index c4afd39bea..92449cb58b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -970,7 +970,7 @@ [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] [% IF hold_cancellation %] - [% FOREACH reason IN hold_cancellation %] @@ -1187,6 +1187,11 @@ } }); [% END %] + $("#cancellation-reason").on("change", function(e){ + $("#cancellation-notify-patron").prop("disabled", $(this).val() == ""); + }); + $("#cancellation-reason").change(); + }); [% INCLUDE 'str/members-menu.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c9a04b6dff..9a64bfed70 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -323,6 +323,11 @@ holdst.fnFilter( $(this).val(), 10 ); }); }); + + $("#cancellation-reason").on("change", function(e){ + $("#cancellation-notify-patron").prop("disabled", $(this).val() == ""); + }); + $("#cancellation-reason").change(); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index b5d042a073..d37f15bc70 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -847,7 +847,7 @@ [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] [% IF hold_cancellation %] - [% FOREACH reason IN hold_cancellation %] @@ -998,6 +998,12 @@ $("#picture-upload, #show-picture-upload").toggle(); }); + + $("#cancellation-reason").on("change", function(e){ + $("#cancellation-notify-patron").prop("disabled", $(this).val() == ""); + }); + $("#cancellation-reason").change(); + }); function uncheck_sibling(me){ nodename=me.getAttribute("name"); 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 4d12fcc433..f05acbe96b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1310,7 +1310,7 @@ if ( reason ) { link += "&cancellation-reason=" + reason } - if ( notify ) { + if ( notify && reason != "" ) { link += "&cancellation-notify-patron=1"; } window.location.href = link; @@ -1357,6 +1357,11 @@ stickTo: "#existing_holds", stickyClass: "floating" }); + + $("#modal-cancellation-reason").on("change", function(e){ + $("#modal-cancellation-notify-patron").prop("disabled", $(this).val() == ""); + }); + $("#modal-cancellation-reason").change(); }); [% END %] -- 2.20.1