Bug 36862

Summary: Cart window becomes unresponsive if checkboxes are manipulated in a certain order
Product: Koha Reporter: Jason Robb <jrobb>
Component: SearchingAssignee: Lucas Gass (lukeg) <lucas>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: anneli.osterman, david, lucas, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 36862: Remove jQuery change() event
Bug 36862: Remove call to selRecord() on the OPAC

Description Jason Robb 2024-05-14 15:32:29 UTC
The cart window in both the Staff Client and the OPAC becomes unresponsive as does the originating window if you check and uncheck boxes in the cart in a certain sequence.

To replicate:
 - Search the catalog in the staff client and/or OPAC
 - Add 3 or more titles to the cart
 - Open the cart via the button in the top menu
 - Click "Select all"
 - Uncheck the first checkbox
 - Click "Clear all"
Comment 1 Lucas Gass (lukeg) 2024-05-15 16:38:39 UTC
I believe this is happening when the change event is triggered in cart.js. 

I don't understand why change() is being used here and I don't think it is necessary.
Comment 2 Lucas Gass (lukeg) 2024-05-15 16:40:41 UTC
Created attachment 166788 [details] [review]
Bug 36862: Remove jQuery change() event

To test:
1 - Search the catalog in the staff client and/or OPAC
2 - Add 3 or more titles to the cart
3 - Open the cart via the button in the top menu
4 - Click "Select all"
5 - Uncheck the first checkbox
6 - Click "Clear all"
7 - APPLY PATCH, clear browser cache
8 - Try again, the browser should not crash.
Comment 3 David Nind 2024-05-16 00:45:01 UTC
For me, the change works fine in the staff interface, but not in the OPAC. That is, still experience the described issue.

Tested in Firefox Developer Edition and Chromium.
Comment 4 Lucas Gass (lukeg) 2024-05-16 20:08:38 UTC
(In reply to David Nind from comment #3)
> For me, the change works fine in the staff interface, but not in the OPAC.
> That is, still experience the described issue.
> 
> Tested in Firefox Developer Edition and Chromium.

Thanks David, I didn't do the OPAC. But I have a patch incoming.

On the OPAC, when using #CheckAll or #CheckNone there is also a call to selRecord(). I don't see why we need to do so if all we are doing is checking/unchecking the checkboxes!
Comment 5 Lucas Gass (lukeg) 2024-05-16 20:09:58 UTC
Created attachment 166840 [details] [review]
Bug 36862: Remove call to selRecord() on the OPAC
Comment 6 David Nind 2024-05-16 21:21:47 UTC
Thanks Lucas!

Just to confirm that it now works as expected for the staff interface and OPAC.

David
Comment 7 Marcel de Rooy 2024-05-17 09:48:26 UTC
Seems that we need the selRecord calls to update the list of items to be sent. I can now deselect items and still receive them with Send.
Comment 8 Lucas Gass (lukeg) 2024-06-13 17:11:59 UTC
(In reply to Marcel de Rooy from comment #7)
> Seems that we need the selRecord calls to update the list of items to be
> sent. I can now deselect items and still receive them with Send.

Ah yes, I think this problem is actually coming from delRecord() which is called from within selRecord()
Comment 9 Anneli Österman 2024-10-24 06:37:47 UTC
I can replicate this problem in version 23.11 but not in 24.05.