From 264daab31c95d74364d133eafb8eaa8b09ee69f3 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 26 Aug 2022 15:42:29 +0300 Subject: [PATCH] Bug 31470: Use class "relationship" instead of id "relationship" in members.js In members.js line 112 variable guarantor_relationship is selected with id "relationship". Correct selector should however be class "relationship" since id "relationship" is used in auth-finder-search.inc, not in memberentry.pl. One way to see what kind of effect incorrect selector has (and how I originally stumbled into this), is to add into "IntranetUserJS" a line which changes non-patron guarantors relationship default selected value as other than empty. We use script to change "relationship" instead of "new_guarantor_relationship" because selector input for patron guarantors relationship actually uses default selected value from non-patron guarantors relationship. To test: 1. Make sure you have some value(s) in syspref "borrowerRelationship" e.g. "guarantor". 2. Add following line to "IntranetUseJS": $('.relationship option:eq(1)').attr('selected', 'selected'); 3. Add guarantee patron and note that non-patron guarantors relationship is now "guarantor". 4. Add patron guarantor and note that relationship value is empty. 5. Apply this patch and refresh page. 6. Repeat step 4. => Note that now relationship value is "guarantor". Sponsored-by: Koha-Suomi Oy --- koha-tmpl/intranet-tmpl/prog/js/members.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index 597bb5d141..7b4095cbc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -109,9 +109,9 @@ function select_user(borrowernumber, borrower, relationship) { fieldset.find('.new_guarantor_firstname_text').first().text( guarantor_firstname ); $('#guarantor_firstname').val(""); - var guarantor_relationship = $('#relationship').val(); + var guarantor_relationship = $('.relationship').val(); fieldset.find('.new_guarantor_relationship').first().val( guarantor_relationship ); - $('#relationship').find('option:eq(0)').prop('selected', true); + $('.relationship').find('option:eq(0)').prop('selected', true); fieldset.find('.guarantor-details').first().attr( 'data-borrowernumber', borrowernumber ); -- 2.34.1