Bugzilla – Attachment 158525 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 new_guarantor_relationship input if it's hidden
Bug-34671-Ignore-newguarantorrelationship-input-if.patch (text/plain), 3.74 KB, created by
ByWater Sandboxes
on 2023-11-06 14:15:49 UTC
(
hide
)
Description:
Bug 34671: Ignore new_guarantor_relationship input if it's hidden
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-11-06 14:15:49 UTC
Size:
3.74 KB
patch
obsolete
>From 73af178c6f147839152ac70b7c467cd24ed86158 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Mon, 25 Sep 2023 08:56:18 +0300 >Subject: [PATCH] Bug 34671: Ignore new_guarantor_relationship input if it's > hidden > >Validating patron forms hidden fields causes problems when >adding/modifying guarantee patrons since class >new_guarantor_relationship is always hidden and mandatory >if syspref "borrowerRelationship" is set. This patch adds class >ignore_validation to relationship input if it's hidden to ignore >validatation and removes it when input is displayed, so it is >validated. > >To test: >1. Apply previous patch. >2. Add or modify guarantee patron. >3. Do not add or modify guarantor. >4. Attempt to save patron. >=> Pressing save button does nothing and no error is >displayed. >5. Apply this patch. >6. Again add or modify guarantee patron and don't add or >modify guarantor. >7. Attempt to save. >=> Saving should now be successfull. >8. Again, add or modify guarantee patron, but this time also >add or modify guarantor. >9. Leave relationship input empty. >10. Attempt to save. >=> Saving should fail and error "There are some required >fields missing..." should be displayed on top of "Patron >guarantor" field set. >11. Add relationship for guarantor and save. >=> Saving should now be successfull. > >Sponsored-by: Koha-Suomi Oy >Signed-off-by: Kelly <kelly@bywatersolutions.com> >--- > .../prog/en/modules/members/memberentrygen.tt | 10 ++++++++++ > koha-tmpl/intranet-tmpl/prog/js/members.js | 7 ++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > >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 007e101206..7837d99efe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1954,6 +1954,16 @@ legend:hover { > [% END %] > $("#guarantor_template").hide(); > >+ //Add class ignore_validation to hidden new_guarantor_relationship to ignore it when form is validated >+ if($(".new_guarantor_relationship").is(":hidden")){ >+ $(".new_guarantor_relationship").addClass("ignore_validation"); >+ } >+ >+ // Remove class ignore_validation from new_guarantor_relationship to validate missing relationship value >+ if($(".new_guarantor_relationship").is(":visible")){ >+ $(".new_guarantor_relationship").removeClass("ignore_validation"); >+ } >+ > var TalkingTechItivaPhoneNotification = [% Koha.Preference('TalkingTechItivaPhoneNotification') || 0 | html %]; > var PhoneNotification = [% Koha.Preference('PhoneNotification') || 0 | html %]; > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index dbdf7c1790..f49f11243f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -118,6 +118,11 @@ function select_user(borrowernumber, borrower, relationship) { > $('#guarantor_relationships').append( fieldset ); > fieldset.show(); > >+ // Remove class ignore_validation from new_guarantor_relationship to validate missing relationship value >+ if($(".new_guarantor_relationship").is(":visible")){ >+ $(".new_guarantor_relationship").removeClass("ignore_validation"); >+ } >+ > if ( relationship ) { > fieldset.find('.new_guarantor_relationship').val(relationship); > } >@@ -240,7 +245,7 @@ $(document).ready(function(){ > jQuery.validator.messages.phone); > > $("#entryform").validate({ >- ignore: "", >+ ignore: ".ignore_validation", > rules: { > email: { > email: true >-- >2.30.2
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