Bug 36129

Summary: Check in "Hide all columns" doesn't persist on item batch modification/deletion
Product: Koha Reporter: Emmi Takkinen <emmi.takkinen>
Component: Staff interfaceAssignee: Emmi Takkinen <emmi.takkinen>
Status: Pushed to oldstable --- QA Contact: Kyle M Hall (khall) <kyle>
Severity: normal    
Priority: P5 - low CC: anni.rajala, david, fridolin.somers, gmcharlt, kyle, lucas, martin.renvoize, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32477
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the item batch modification/deletion tool, so that if the "Hide all columns" checkbox is selected and then the page is reloaded, the checkbox is still shown as selected. Before this, the columns remained hidden as expected, but the checkbox wasn't selected.
Version(s) released in:
24.11.00.24.05.04,23.11.09
Circulation function:
Attachments: Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion
Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion
Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion

Description Emmi Takkinen 2024-02-19 06:02:19 UTC
On item patch modification/deletion tool, if one checks "Hide all columns" checkbox and then reloads the page, checkbox is no longer selected. Columns are hidden as they should.

To reproduce:
1. Find items to modify/delete and modify/delete them with corresponding tool.
2. Check checkbox "Hide all columns".
3. Refresh the page.
=> Note that columns are still hidden, but checkbox is now unselected.
Comment 1 Emmi Takkinen 2024-02-19 11:14:14 UTC
Created attachment 162268 [details] [review]
Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion

On item patch modification/deletion tool, if one checks
"Hide all columns" checkbox and then reloads the page,
checkbox is no longer selected. Columns are hidden as
they should. This patch adds line to batchMod.js which
sets "checked" attribute and class "selected" to checkbox.

To test:
1. Find items to modify/delete and modify/delete them with
corresponding tool.
2. Check checkbox "Hide all columns".
3. Refresh the page.
=> Note that columns are still hidden, but checkbox is now
unselected.
4. Apply this patch.
5. Check checkbox again and refresh page.
=> Checkbox should be still checked.

Sponsored-by: Koha-Suomi Oy
Comment 2 Anni Rajala 2024-02-27 13:03:43 UTC
When testing this I noticed that after refreshing page the selected checkbox didn't always remain. Both batch modification and deletion tool use the same code (+ browser's cache) when hiding columns so apparently what happened in my case was that my previous selection from batch modification tool was retrieved when I refreshed the batch deletion tool -page.

Not sure if this can or needs to be fixed, but just to let everyone know what I bumped into. The patch does however fix the original issue where selection and columns hidden didn't match after reloading the page.
Comment 3 David Nind 2024-03-23 09:51:33 UTC
I experienced some odd behavour with this as well when testing, and have changed to Failed QA:

1. Apply the patch

2. Clear browser cache

3. With batch item modification:
   . Select 'Hide all columns' - works as expected
   . Hard refresh the page (Shift + Refresh button) - no change
   . Select 'Show all columns' - works as expected
   . Repeat a couple of times
   . On one of the hard refreshes, it takes a while to load the page (and browser tab icon is spinning)
   . Don't do anything for a while (say one or two minutes)
   . Get this console error message:
     Unchecked runtime.lastError: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received   batchMod.pl:1 
  . Hard refresh the page again
  . Takes a while to load, tab icon is spinning, 'Show all columns' + Others are selected (except for 'Hide all columns', then after a wait changes to 'Hide all columns'

4. Use the breadcrumbs/menu options to navigate to the staff interface home page, then go to Cataloging > Batch item deletion:
   . Note the spinning tab icon, and pages load slowly
   . Paste in some barcodes and submit
   . Note that the page load reasonably quickly, however the tab icon is spinning
   . Leave it for a bit (say one or two minutes), changes from what is expected (All columns selected, with only 'Hide all columns' not selected) to just 'Hide all columns'
  . Hard refresh, same as previous step

5. Clear the browser cache and then go to the batch item deletion tool
   . Select 'Hide all columns'
   . This message appears in the web developer tools console:
    Uncaught ReferenceError: allColumns is not defined  batchMod_23.1200012.js:116
    at hideAllColumns (batchMod_23.1200012.js:116:24)
    at HTMLInputElement.<anonymous> (batchMod_23.1200012.js:159:13)
    at HTMLInputElement.dispatch (jquery-3.6.0.min_23.1200012.js:2:43064)
    at v.handle (jquery-3.6.0.min_23.1200012.js:2:41048)
  . Don't do anything for a bit, then this console messages appears:
    Unchecked runtime.lastError: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received   batchMod.pl:1 
  . Hard refresh - All columns are now selected, with only 'Hide all columns' not selected
  . Wait a bit - changes to 'Hide all columns' and the "Uncaught ReferenceError: allColumns" error from above is shown in the console again.

Items I used to test:
39999000006094
39999000006117
39999000011418
39999000005134

Have added bug 32477 as a reference, while not the same it was fixing similar issues.
Comment 4 Emmi Takkinen 2024-05-10 06:59:25 UTC
(In reply to David Nind from comment #3)
> I experienced some odd behavour with this as well when testing, and have
> changed to Failed QA:
> 
> 1. Apply the patch
> 
> 2. Clear browser cache
> 
> 3. With batch item modification:
>    . Select 'Hide all columns' - works as expected
>    . Hard refresh the page (Shift + Refresh button) - no change
>    . Select 'Show all columns' - works as expected
>    . Repeat a couple of times
>    . On one of the hard refreshes, it takes a while to load the page (and
> browser tab icon is spinning)
>    . Don't do anything for a while (say one or two minutes)
>    . Get this console error message:
>      Unchecked runtime.lastError: A listener indicated an asynchronous
> response by returning true, but the message channel closed before a response
> was received   batchMod.pl:1 
>   . Hard refresh the page again
>   . Takes a while to load, tab icon is spinning, 'Show all columns' + Others
> are selected (except for 'Hide all columns', then after a wait changes to
> 'Hide all columns'
> 
> 4. Use the breadcrumbs/menu options to navigate to the staff interface home
> page, then go to Cataloging > Batch item deletion:
>    . Note the spinning tab icon, and pages load slowly
>    . Paste in some barcodes and submit
>    . Note that the page load reasonably quickly, however the tab icon is
> spinning
>    . Leave it for a bit (say one or two minutes), changes from what is
> expected (All columns selected, with only 'Hide all columns' not selected)
> to just 'Hide all columns'
>   . Hard refresh, same as previous step
> 
> 5. Clear the browser cache and then go to the batch item deletion tool
>    . Select 'Hide all columns'
>    . This message appears in the web developer tools console:
>     Uncaught ReferenceError: allColumns is not defined 
> batchMod_23.1200012.js:116
>     at hideAllColumns (batchMod_23.1200012.js:116:24)
>     at HTMLInputElement.<anonymous> (batchMod_23.1200012.js:159:13)
>     at HTMLInputElement.dispatch (jquery-3.6.0.min_23.1200012.js:2:43064)
>     at v.handle (jquery-3.6.0.min_23.1200012.js:2:41048)
>   . Don't do anything for a bit, then this console messages appears:
>     Unchecked runtime.lastError: A listener indicated an asynchronous
> response by returning true, but the message channel closed before a response
> was received   batchMod.pl:1 
>   . Hard refresh - All columns are now selected, with only 'Hide all
> columns' not selected
>   . Wait a bit - changes to 'Hide all columns' and the "Uncaught
> ReferenceError: allColumns" error from above is shown in the console again.
> 
> Items I used to test:
> 39999000006094
> 39999000006117
> 39999000011418
> 39999000005134
> 
> Have added bug 32477 as a reference, while not the same it was fixing
> similar issues.

I've been trying to reproduce this scenario with no luck. Could it be that this happens with specific browser? I'm using Firefox (version 125.0.3).
Comment 5 Emmi Takkinen 2024-05-10 08:21:39 UTC
Couldn't reproduce Davids problem with Chromium either.
Comment 6 David Nind 2024-05-10 09:55:04 UTC
I can't see it now either (Firefox and Chromium). 8-(
Comment 7 David Nind 2024-05-10 09:55:46 UTC
Created attachment 166526 [details] [review]
Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion

On item patch modification/deletion tool, if one checks
"Hide all columns" checkbox and then reloads the page,
checkbox is no longer selected. Columns are hidden as
they should. This patch adds line to batchMod.js which
sets "checked" attribute and class "selected" to checkbox.

To test:
1. Find items to modify/delete and modify/delete them with
corresponding tool.
2. Check checkbox "Hide all columns".
3. Refresh the page.
=> Note that columns are still hidden, but checkbox is now
unselected.
4. Apply this patch.
5. Check checkbox again and refresh page.
=> Checkbox should be still checked.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Kyle M Hall (khall) 2024-07-19 16:57:07 UTC
Created attachment 169251 [details] [review]
Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion

On item patch modification/deletion tool, if one checks
"Hide all columns" checkbox and then reloads the page,
checkbox is no longer selected. Columns are hidden as
they should. This patch adds line to batchMod.js which
sets "checked" attribute and class "selected" to checkbox.

To test:
1. Find items to modify/delete and modify/delete them with
corresponding tool.
2. Check checkbox "Hide all columns".
3. Refresh the page.
=> Note that columns are still hidden, but checkbox is now
unselected.
4. Apply this patch.
5. Check checkbox again and refresh page.
=> Checkbox should be still checked.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Martin Renvoize (ashimema) 2024-07-25 10:19:22 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 10 Lucas Gass (lukeg) 2024-08-28 21:05:27 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 11 Fridolin Somers 2024-09-10 14:19:57 UTC
Pushed to 23.11.x for 23.11.09
Comment 12 Wainui Witika-Park 2024-09-18 04:03:32 UTC
Not backporting to 23.05.x unless requested