From 92806d3381edfdbb42df002a4ec08423a485cc14 Mon Sep 17 00:00:00 2001 From: Slava Shishkin Date: Fri, 2 May 2025 19:51:30 +0300 Subject: [PATCH] Bug 39828: Fix QuickAdd skipping fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, fields like userid are skipped if the last input in the main form is hidden or has no ID. This patch fixes the selection logic to avoid skipping. Steps to reproduce: 1. Add userid (or any other field that matches above structure) to PatronQuickAddFields. 2. Open the Add Patron form and use Quick Add. 3. Observe → the field is missing. 4. Apply the patch. 5. Use Quick Add again and observe that 'Username' field is there. --- .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 4 +++- 1 file changed, 3 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 361a178107c..49b3405006b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1914,7 +1914,9 @@ }); new_field.appendTo("#quick_add_list"); } else { - let orig_input_id = orig_li.children("input,textarea,select").last().attr("id"); + let orig_input_id = orig_li.children("input,textarea,select").filter(function() { + return $(this).attr("id") && !$(this).is(':disabled') && $(this).css('display') !== 'none'; + }).first().attr("id"); if ( orig_input_id ) { let new_field = orig_li.clone(); new_field.children("#"+orig_input_id).attr("id",orig_input_id + "_quick_add"); -- 2.49.0