From 7a45e3591303783968bb71e72764c0c8e820f10d Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Wed, 17 May 2023 22:26:14 +0000
Subject: [PATCH] Bug 33639: Fix selectors for adding to item group

To test:
Apply patch
1 - Browse to details page for a record
2 - Create or ensure the record has item group(s)
3 - Click New->New item
4 - Note the bottom of the page has a form to attach to existing group
5 - Note when a group is selected the enumchron field is populated if it is blank
6 - Note that the enumchron field is NOT update is there is a an existing value
7 - Confirm item is saved to group when saved

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
---
 koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js
index 65a86a2175..4996dc6cac 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js
@@ -135,10 +135,10 @@ $(document).ready(function(){
     }
 
     $('#item-group-add-or-create-form-select').on('change', function() {
-        if ( ! $('input.items-enumchron').val() ) {
+        if ( ! $('input[name="items.enumchron"]').val() ) {
             let item_group_selector = '#item-group-' + $(this).val();
             let enumchron = $(item_group_selector).val();
-            $('input.items-enumchron').val( enumchron );
+            $('input[name="items.enumchron"]').val( enumchron );
         }
     });
 });
-- 
2.30.2