Bug 37755

Summary: Change in Bootstrap5 has broken batch patron modification
Product: Koha Reporter: Jake Deery <jake.deery>
Component: Staff interfaceAssignee: Jake Deery <jake.deery>
Status: Pushed to main --- QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: gmcharlt, jake.deery, jonathan.druart, paul.derscheid
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35402
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 35402    
Bug Blocks: 37360    
Attachments: Bug 37755: Fixed JavaScript for modification tabs
Bug 37755: Fixed JavaScript for modification tabs
Bug 37755: Fixed JavaScript for modification tabs
Bug 37755: Fixed JavaScript for modification tabs
Bug 37755: Fix batch del record (adding the missing _panel suffix)

Description Jake Deery 2024-08-28 10:42:02 UTC
Hi all,

We've identified a bug introduced since the move to Bootstrap5 which caused the modborrowers.pl to break. It looks like the problem has happened because a class has been changed in the markup.

I will submit a one-liner shortly to fix this issue.

Jake.
Comment 1 Jake Deery 2024-08-28 11:08:42 UTC
Created attachment 170802 [details] [review]
Bug 37755: Fixed JavaScript for modification tabs

This patch addresses a new bug which prevents correct submission on mod
borrowers and mod records (mod + delete). The bug appears to have been
introduced since the recent Bootstrap5 switch, and shouldn't be surfacing
anywhere else in the system

Note that the test plan focuses on tools/modborrowers.pl. The error also
appears to exist on tools/batch_record_modification.pl and
tools/batch_delete_records.pl, but is a lot harder to reproduce.

Please see https://chat.koha-community.org/koha-community/pl/fmnzzgy5cpghtpdc9a9ow75scr
and follow-up comments for details on reproducing this.

To test:
a)  go to tools/modborrowers.pl and try to enter valid cardnumbers or
    borrowernumbers
    1)  notice how you cannot proceed
b)  APPLY PATCH
c)  repeat steps a
    1)  notice how you can now proceed
d)  SIGN OFF
Comment 2 Paul Derscheid 2024-08-28 11:15:30 UTC
Bug 35402 has already been pushed but let's keep track of follow-ups this way.
Comment 3 Jake Deery 2024-08-28 11:17:00 UTC
re: testing tools/batch_record_modification.pl and tools/batch_delete_records.pl

These appear to work on the surface, but I don't think they are correct. If you run this on tools/batch_record_modification.pl (when you're on the entry page, via the browser console):

$("#record_ids_selection").each(function() {
    var tab = $(this).find('#batch_mod_form li.active:first a').attr('href');
    console.log(tab);
});

You get 'undefined'. I don't think that's good, obviously. :-) If you try again with  the new JavaScript:

$("#record_ids_selection").each(function() {
    var tab = $(this).find('#batch_mod_form li a.active:first').attr('href');
    console.log(tab);
});

You should get the HREF of the active tab. Much more expected!

 * * * 

The same can be applied to tools/batch_delete_records.pl...

$("#record_ids_selection").each(function() {
    var tab = $(this).find('#batch_del_form:active:first a').attr('href');
    console.log(tab);
});

We actually hit an error. Meanwhile...

$("#record_ids_selection").each(function() {
    var tab = $(this).find('#batch_del_form li a.active:first').attr('href');
    console.log(tab);
});

Should give us that HREF again. Happy times!

 * * * 

Jake.
Comment 4 Owen Leonard 2024-08-28 11:27:20 UTC
Created attachment 170803 [details] [review]
Bug 37755: Fixed JavaScript for modification tabs

This patch addresses a new bug which prevents correct submission on mod
borrowers and mod records (mod + delete). The bug appears to have been
introduced since the recent Bootstrap5 switch, and shouldn't be surfacing
anywhere else in the system

Note that the test plan focuses on tools/modborrowers.pl. The error also
appears to exist on tools/batch_record_modification.pl and
tools/batch_delete_records.pl, but is a lot harder to reproduce.

Please see https://chat.koha-community.org/koha-community/pl/fmnzzgy5cpghtpdc9a9ow75scr
and follow-up comments for details on reproducing this.

To test:
a)  go to tools/modborrowers.pl and try to enter valid cardnumbers or
    borrowernumbers
    1)  notice how you cannot proceed
b)  APPLY PATCH
c)  repeat steps a
    1)  notice how you can now proceed
d)  SIGN OFF

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Jake Deery 2024-08-28 11:32:40 UTC
Created attachment 170806 [details] [review]
Bug 37755: Fixed JavaScript for modification tabs

This patch addresses a new bug which prevents correct submission on mod
borrowers and mod records (mod + delete). The bug appears to have been
introduced since the recent Bootstrap5 switch, and shouldn't be surfacing
anywhere else in the system

Note that the test plan focuses on tools/modborrowers.pl. The error also
appears to exist on tools/batch_record_modification.pl and
tools/batch_delete_records.pl, but is a lot harder to reproduce.

Please see https://chat.koha-community.org/koha-community/pl/fmnzzgy5cpghtpdc9a9ow75scr
and follow-up comments for details on reproducing this.

To test:
a)  go to tools/modborrowers.pl and try to enter valid cardnumbers or
    borrowernumbers
    1)  notice how you cannot proceed
b)  APPLY PATCH
c)  repeat steps a
    1)  notice how you can now proceed
d)  SIGN OFF

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Jonathan Druart 2024-08-28 11:36:38 UTC
Found something:
Go to /tools/modborrowers.pl
Tab "By card number", enter cardnumber '23529000224510'
Tab "By borrowernumber", enter 1
Continue

=> Both patrons are picked, I think we expect only the one from the tab we were before pressing "Continue" (which is the point of this code)
Comment 7 Jake Deery 2024-08-28 12:37:08 UTC
Hi Jonathan,

Sorry, but I'm now able to reproduce your behaviour. Can I ask if you cleared your browser cache, or ran restart_all?

Jake.
Comment 8 Jonathan Druart 2024-08-28 12:55:46 UTC
Oops sorry, it seems to work correctly for the batch patron mod.

However it seems broken on "Batch record deletion"
=> "Upload a file" is cleared when you "Continue", even if you are on this tab.
Comment 9 Jonathan Druart 2024-08-28 13:01:53 UTC
Created attachment 170813 [details] [review]
Bug 37755: Fixed JavaScript for modification tabs

This patch addresses a new bug which prevents correct submission on mod
borrowers and mod records (mod + delete). The bug appears to have been
introduced since the recent Bootstrap5 switch, and shouldn't be surfacing
anywhere else in the system

Note that the test plan focuses on tools/modborrowers.pl. The error also
appears to exist on tools/batch_record_modification.pl and
tools/batch_delete_records.pl, but is a lot harder to reproduce.

Please see https://chat.koha-community.org/koha-community/pl/fmnzzgy5cpghtpdc9a9ow75scr
and follow-up comments for details on reproducing this.

To test:
a)  go to tools/modborrowers.pl and try to enter valid cardnumbers or
    borrowernumbers
    1)  notice how you cannot proceed
b)  APPLY PATCH
c)  repeat steps a
    1)  notice how you can now proceed
d)  SIGN OFF

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2024-08-28 13:01:56 UTC
Created attachment 170814 [details] [review]
Bug 37755: Fix batch del record (adding the missing _panel suffix)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2024-08-28 13:02:18 UTC
(In reply to Jonathan Druart from comment #8)
> However it seems broken on "Batch record deletion"
> => "Upload a file" is cleared when you "Continue", even if you are on this
> tab.

Fixed in the last patch. I think we are good now.
Comment 12 Jake Deery 2024-08-28 13:03:53 UTC
Thanks, Jonathan. I was looking in tools/modborrowers.pl for the problem – duh!
Good to get this one moved quickly, it could have been a show-stopper!

Jake.
Comment 13 Katrin Fischer 2024-08-29 15:25:37 UTC
Pushed for 24.11!

Well done everyone, thank you!