Bug 36527: Patron category or item type not changing when editing another circulation rule

Plan test :
1. Go to Administration > Circulation and fine rules
2. Add a couple of rules with various patron category/item type
   combinations
3. Click on "Edit" next to one of the rules
   --> The line should become highlighted in yellow and the values
       should be copied in the very last row
4. Click on "Edit" next to another rule
5. Click OK in the browser dialog box to confirm you want to edit
   another rule
   --> Depending on the rules, the values for the patron category
       and/or item type might not change in the editing row
6. Repeat steps 4 and 5
   --> The patron category and item type do not always change
7. Apply the batch
8. Redo step from 3 to 6
9. Observe that category and item type change accordingly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7e8502e087)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Phan Tung Bui 2024-04-11 16:02:27 -04:00 committed by Lucas Gass
parent 5d059209f7
commit fe29c2551f
1 changed files with 12 additions and 3 deletions

View File

@ -1499,6 +1499,7 @@
}
$('#default-circulation-rules td').removeClass('highlighted-row');
$(this).parent().parent().find("td").each(function (i) {
$(this).addClass('highlighted-row');
itm_code = $(this).data('code');
itm_text = $(this).text();
@ -1538,11 +1539,19 @@
});
// select the corresponding option
$(current_column).find("select option").each(function(){
opt = $(this).attr('value');
if ( opt == itm_code ) {
$(this).attr('selected', 'selected');
// Reset selection status for all options
$(this).prop('selected', false);
// Declare opt here to ensure it is scoped correctly within the loop
let opt = $(this).val();
// Select the matching option
if (opt == itm_code) {
$(this).prop('selected', true);
}
});
// After setting the correct option, update the select to reflect the change
$(current_column).find('select').trigger('change');
var current_input_id = $(current_column).children('input').first().attr('id');
if ( i == 0 || i == 1 ) {
// Disable the 2 first columns, we cannot update them.