From 2bb1dfab700fafd42c85e21ef92342059d21ca36 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 17 Mar 2023 09:55:39 +0200 Subject: [PATCH 6/6] Bug 16223: Require fee limit only if "Lift after payment" is set as "Yes" Fee limit should only be required if restriction is meant to be lifted after payment. This patch makes "Fee limit" input field required based on value of "Lift after payment" select field. To test: 1. Create a new restriction. 2. "Lift after payment" should be set as "No". 3. Change value as "Yes". => "Fee limit" should now have "Required" text after input field. 4. Try to save restriction. => Text "This field is required" should be displayed after "Fee limit". 5. Change "Lift after payment" back to "No". => Both texts should now be lifted. Also test with existing restriction and make sure restrictions are still saved without problems. Sponsored-by: Koha-Suomi Oy Signed-off-by: Martin Renvoize --- .../prog/en/modules/admin/restrictions.tt | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt index 8946325908..2a8dfe6740 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt @@ -103,16 +103,19 @@
  • - + [% IF restriction.lift_after_payment %] + + [% ELSE %] + + + [% END %] - Required
  • - - - Required + +
  • [% ELSE %]
  • @@ -126,17 +129,15 @@ Required
  • - - + + - Required
  • - - - Required + +
  • [% END %] @@ -249,6 +250,15 @@ [% ex.code | $raw %]: '[% ex.display_text | $raw %]', [% END %] }; + + //Require fee limit if "Lift after payment" is set true + $("#lift_after_payment").on("change", function(){ + if($(this).val() == 1){ + $("#fee_limit").prop("required",true).after('Required'); + } else { + $("#fee_limit").prop("required",false).nextAll().remove(); + } + }); [% Asset.js("js/restrictiontypes.js") | $raw %] [% END %] -- 2.34.1