Bugzilla – Attachment 181000 Details for
Bug 38373
Mandatory patron relationship has to be selected twice
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.73 KB, created by
Johanna Räisä
on 2025-04-16 07:59:41 UTC
(
hide
)
Description:
Bug 38373: check if mandatory relationship is needed for non-patron guarantor
Filename:
MIME Type:
Creator:
Johanna Räisä
Created:
2025-04-16 07:59:41 UTC
Size:
2.73 KB
patch
obsolete
>From 22b5950af974869303ba0ecba10b449bac498a35 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 surname or first name 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 | 32 ++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index a20561cfe0..94ec2777e4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -235,8 +235,24 @@ function write_age() { > hint.html(age_string); > } > >-$(document).ready(function () { >- if ($("#yesdebarred").is(":checked")) { >+function toggleRelationshipRequired() { >+ const relationshipField = $('.relationship'); >+ const label = relationshipField.parent().find('label'); >+ const requiredIndicator = relationshipField.parent().find('span.required'); >+ >+ if (!$('#contactname').val() && !$('#contactfirstname').val()) { >+ 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(); > } else { > $("#debarreduntil").hide(); >@@ -274,7 +290,17 @@ $(document).ready(function () { > } > ); > >- $(document.body).on("change", ".select_city", function () { >+ if (mandatory_fields.includes('relationship')) { >+ toggleRelationshipRequired(); >+ if ($('#contactname').length) { >+ $('#contactname').on('change', toggleRelationshipRequired); >+ } >+ if ($('#contactfirstname').length) { >+ $('#contactfirstname').on('change', toggleRelationshipRequired); >+ } >+ } >+ >+ $(document.body).on('change','.select_city',function(){ > var selected_city = $(this).val(); > var addressfield = $(this).data("addressfield"); > var myRegEx = new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); >-- >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