From ef5ec1731a971cfcf562f0744ef3a78ac0e75058 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Mon, 18 Jan 2021 11:20:06 +0200 Subject: [PATCH] Bug 27430: Change password minimum value hint when patron category is changed If patrons category is changed during add or edit password minimum value doesn't change. This patch adds ajax call to fix this. To test: 1. Add password minimum length for patron categories A and B. 2. Create a new patron with category A. 3. Change patrons category to B. 4. Note that password minimum value doesn't change on hint text. 5. Apply patch. 6. Repeat patron creation, password minimum value should now change correctly. Signed-off-by: Sally Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 1 + koha-tmpl/intranet-tmpl/prog/js/members.js | 6 ++++++ 2 files changed, 7 insertions(+) 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 ed87d1643d..e63e97e347 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1705,6 +1705,7 @@ legend:hover { var LABEL_SET_TO_PATRON = _("Set to patron"); var LABEL_AGE = _("Age"); var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?"); + var MSG_PASSWORD_LENGTH = _("Minimum password length: %s"); [% IF quickadd && opadd && !check_member %] $(document).ready(function () { diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index df9b82d962..73c15021cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -68,6 +68,12 @@ function update_category_code(category_code) { $(mytables).find("li").hide(); $(mytables).find(" li[data-category_code='"+category_code+"']").show(); $(mytables).find(" li[data-category_code='']").show(); + + //Change password length hint + var hint = $("#password").siblings(".hint").first(); + var min_length = $('select'+category_selector+' option:selected').data('pwdLength'); + var hint_string = MSG_PASSWORD_LENGTH.format(min_length); + hint.html(hint_string); } function select_user(borrowernumber, borrower, relationship) { -- 2.39.5