Bugzilla – Attachment 158168 Details for
Bug 34671
Collapsing fields in patron form allows saving without mandatory fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34671: Ignore validation if patron attribute field is hidden
0001-Bug-34671-Ignore-validation-if-patron-attribute.patch (text/plain), 2.17 KB, created by
Emmi Takkinen
on 2023-11-01 11:39:11 UTC
(
hide
)
Description:
Bug 34671: Ignore validation if patron attribute field is hidden
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2023-11-01 11:39:11 UTC
Size:
2.17 KB
patch
obsolete
>From e0e776b86c81092e6ad5f17df34a7a9d9b1ff0a2 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >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 >--- > koha-tmpl/intranet-tmpl/prog/js/members.js | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index f49f11243f..6bdc15e3b5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -74,6 +74,15 @@ function update_category_code(category_code) { > var min_length = $('select'+category_selector+' option:selected').data('pwdLength'); > var hint_string = __("Minimum password length: %s").format(min_length); > hint.html(hint_string); >+ >+ // Add class ignore_validation from attribute field to ignore validation >+ if($(mytables).find("li").is(":hidden")){ >+ $(mytables).find("li").children('[id*="patron_attr"]').addClass("ignore_validation"); >+ } >+ // Remove class ignore_validation from attribute field so it's validated >+ if($(mytables).find("li").is(":visible")){ >+ $(mytables).find("li").children('[id*="patron_attr"]').removeClass("ignore_validation"); >+ } > } > > function select_user(borrowernumber, borrower, relationship) { >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34671
:
155643
|
156145
|
156263
|
156264
|
156453
|
156454
|
158168
|
158299
|
158524
|
158525
|
158526