Bugzilla – Attachment 174102 Details for
Bug 38373
Mandatory non-patron guarantor relationship required where no guarantor surname or first name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38373: check if mandatory relationship is needed for non-patron guarantor
0001-Bug-38373-check-if-mandatory-relationship-is-needed-.patch (text/plain), 2.29 KB, created by
Johanna Räisä
on 2024-11-07 07:14:54 UTC
(
hide
)
Description:
Bug 38373: check if mandatory relationship is needed for non-patron guarantor
Filename:
MIME Type:
Creator:
Johanna Räisä
Created:
2024-11-07 07:14:54 UTC
Size:
2.29 KB
patch
obsolete
>From 35523666df3d3a4a54ada70eedffeadbefd4e05f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Johanna=20R=C3=A4is=C3=A4?= <johanna.raisa@gmail.com> >Date: Thu, 7 Nov 2024 08:37:59 +0200 >Subject: [PATCH] Bug 38373: check if mandatory relationship is needed for > non-patron guarantor > >This patch checks if non-patron guarantor is added to the patron and changes the relationship to mandatory if needed. > >Test plan: >1) Add relationship as mandatory field >2) Add a child patron >3) See that the non-patron guarantor relationship is mandatory >4) Apply the patch >5) Add a child patron >6) See that the non-patron guarantor relationship is not mandatory >7) Fill a surname for the non-patron guarantor >8) See that the non-patron guarantor relationship turns mandatory > >Sponsored-by: Koha-Suomi Oy >--- > koha-tmpl/intranet-tmpl/prog/js/members.js | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index 2f58cb888c..8e6911a0cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -191,6 +191,22 @@ function write_age() { > hint.html(age_string); > } > >+function toggleRelationshipRequired() { >+ const relationshipField = $('.relationship'); >+ const label = relationshipField.parent().find('label'); >+ const requiredIndicator = relationshipField.parent().find('span.required'); >+ >+ if ($('#contactname').val().length === 0) { >+ label.removeClass('required'); >+ requiredIndicator.hide(); >+ relationshipField.removeAttr('required'); >+ } else { >+ label.addClass('required'); >+ requiredIndicator.show(); >+ relationshipField.attr('required', 'required'); >+ } >+} >+ > $(document).ready(function(){ > if($("#yesdebarred").is(":checked")){ > $("#debarreduntil").show(); >@@ -221,6 +237,11 @@ $(document).ready(function(){ > $(this).parents('fieldset').first().remove(); > }); > >+ if (mandatory_fields.includes('relationship')) { >+ toggleRelationshipRequired(); >+ $('#contactname').on('change', toggleRelationshipRequired); >+ } >+ > $(document.body).on('change','.select_city',function(){ > var selected_city = $(this).val(); > var addressfield = $(this).data("addressfield"); >-- >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 38373
:
174102
|
174118
|
181000
|
182779