From 08401b41728cfad2c4e18fbd7073e707f7ff93fd Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 17 Mar 2023 09:55:39 +0200 Subject: [PATCH] Bug 16223: Require fee limit only if "Lift after payment" is set as "Yes" Content-Type: text/plain; charset=utf-8 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 Signed-off-by: Marcel de Rooy --- .../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 0acd70ca68..93cf49f5e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt @@ -115,16 +115,19 @@
  • - + [% IF restriction.lift_after_payment %] + + [% ELSE %] + + + [% END %] - Required
  • - - - Required + +
  • [% ELSE %]
  • @@ -138,17 +141,15 @@ Required
  • - - + + - Required
  • - - - Required + +
  • [% END %] @@ -257,6 +258,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.30.2