From b35786f5db258446b4ae311abc99b2cdce23cc90 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Wed, 1 Nov 2023 13:38:08 +0200 Subject: [PATCH] Bug 34671: Ignore validation if patron attribute field is hidden Patron attributes not used by patron category are still present in form as hidden and marked as required if they are set as mandatory. This prevents saving patron when validation is required also for hidden fields. This patch adds and removes class "ignore_validation" for these fields based on their visibility. To test: 1. Add patron attribute for patron category A and set it as mandatory. 2. Add patron with category B and fill in required fields. 3. Attempt to save. => Error is displayed above "Additional attributes and identifiers" field set. 4. Apply this patch. 5. Repeat steps 2 and 3. => Save successfully. 6. Add new patron with category B, but this time change patrons category as A from patron form. => Confirm that madatory patron attribute is displayed correctly and without it patron cannot be saved. Sponsored-by: Koha-Suomi Oy --- .../prog/en/modules/members/memberentrygen.tt | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/js/members.js | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 7837d99efe..b728142e08 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1559,14 +1559,18 @@ legend:hover { [% END %] [% FOREACH patron_attribute IN pa_loo.items %]
  • - [% IF patron_attribute.mandatory %] + [% IF patron_attribute.mandatory && patron_attribute.category_code == patron_category.categorycode%] + [% ELSIF patron_attribute.mandatory && patron_attribute.category_code != patron_category.categorycode %] + [% ELSE %] [% END %] [% IF ( patron_attribute.use_dropdown ) %] - [% IF patron_attribute.mandatory %] + [% IF patron_attribute.mandatory && patron_attribute.category_code == patron_category.categorycode %] [% ELSE %]