From c57b596eb38dc0f6eeb19527eb983eb5b3255b27 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 15 Nov 2024 14:53:40 +0000 Subject: [PATCH] Bug 38459: Ensure cities field works in patron quick add This patch adjust the selector for quick add and updates the change event for the city dropdown to affect quickadd fields as well To test: 1 - Administration->Cities and towns 2 - Define several cities 3 - http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronQuickAddFields 4 - Select city,state, zipcode and some other fields 5 - Patrons->Quick add new patron 6 - Note city field/dropdown does not show 7 - Apply patch 8 - Reload 9 - City dropdown shows! 10 - State and zip are updated when city is selected! 11 - Celebrate! Signed-off-by: David Nind Signed-off-by: Matt Blenkinsop --- .../prog/en/modules/members/memberentrygen.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/members.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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 2c1a1b7993f..65251c5b0f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -2043,7 +2043,7 @@ legend.collapsed i.fa.fa-caret-down::before { }); new_field.appendTo("#quick_add_list"); } else { - let orig_input_id = orig_li.children("input,textarea,select").attr("id"); + let orig_input_id = orig_li.children("input,textarea,select").last().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"); diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index c1042825ce2..a4b8b91bc64 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -225,10 +225,10 @@ $(document).ready(function(){ var addressfield = $(this).data("addressfield"); var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); var matches = selected_city.match( myRegEx ); - $("#" + addressfield + "zipcode").val( matches[1] ); - $("#" + addressfield + "city").val( matches[2] ); - $("#" + addressfield + "state").val( matches[3] ); - $("#" + addressfield + "country").val( matches[4] ); + $("#" + addressfield + "zipcode,#" + addressfield + "zipcode_quick_add").val( matches[1] ); + $("#" + addressfield + "city,#" + addressfield + "city_quick_add").val( matches[2] ); + $("#" + addressfield + "state,#" + addressfield + "state_quick_add").val( matches[3] ); + $("#" + addressfield + "country,#" + addressfield + "country_quick_add").val( matches[4] ); }); dateformat = $("#dateofbirth").siblings(".hint").first().html(); -- 2.39.5 (Apple Git-154)