From 86c1f2c7c7577ab6ac5b88b2768fa1acd5687d6c 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! --- .../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 f0afef90e0c..b1d75745d0d 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 2f58cb888c0..502ed2aa799 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -226,10 +226,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