Bug 36326 - Batch deletion of selected items from detail page is broken
Summary: Batch deletion of selected items from detail page is broken
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on: 34478
Blocks: 36192
  Show dependency treegraph
 
Reported: 2024-03-15 10:00 UTC by Pedro Amorim
Modified: 2024-07-10 15:13 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 36326: Fix batch item mod/del access from biblio detail page (1.12 KB, patch)
2024-03-15 12:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36326: PoC (3.57 KB, patch)
2024-03-15 14:06 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36326: PoC followup (3.73 KB, patch)
2024-03-15 14:49 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36326: Fix batch item mod/del access from biblio detail page (1.17 KB, patch)
2024-03-15 19:27 UTC, David Nind
Details | Diff | Splinter Review
Bug 36326: Fix batch item mod/del access from biblio detail page (1.26 KB, patch)
2024-03-22 08:23 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 36326: PoC followup (3.82 KB, patch)
2024-03-22 08:24 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 36326: Fix batch item mod/del access from biblio detail page (1.26 KB, patch)
2024-03-22 08:24 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2024-03-15 10:00:27 UTC
k-t-d
1) visit a biblio:
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=230
2) Tick 2 checkboxes on the left most column of the items table
3) Click the " Delete selected items" action.
4) Notice you are taken to
http://localhost:8081/cgi-bin/koha/tools/batchMod.pl?op=show&del=1&itemnumber=507&itemnumber=508&biblionumber=230&src=CATALOGUING
5) Notice the page is blank
Comment 1 Jonathan Druart 2024-03-15 12:53:30 UTC
Created attachment 163227 [details] [review]
Bug 36326: Fix batch item mod/del access from biblio detail page

Allow both $op eq "show" and "cud-show".
We need to keep the POST when we upload a file, but we can simply allow
GET with "show".

Test plan:
Go to the biblio detail page, select an item and test both tools via the links
"Delete selected items" and "Modify selected items"
Comment 2 Jonathan Druart 2024-03-15 12:57:03 UTC
Not the nicest fix, but the easiest.

Other places have been fixed using a POST:

  commit 74d7ae7672a4b82568e57eaddefbded4bf5b05e6
  Bug 34478: (follow-up) batchMod

  commit 925eb73a279e18194f05b92069d78fd93c88a58e
  Bug 34478: (follow-up) batch_record_modification
Comment 3 Pedro Amorim 2024-03-15 14:06:12 UTC
Created attachment 163238 [details] [review]
Bug 36326: PoC

Joubu, whats your opinion on this approach?
Comment 4 Pedro Amorim 2024-03-15 14:06:53 UTC
Replacing "build link" logic with "build invisible form" logic.
Comment 5 Jonathan Druart 2024-03-15 14:24:26 UTC
With bug 33568 in the queue, I really would prefer to limit the changes we add to this template.
Comment 6 Jonathan Druart 2024-03-15 14:26:53 UTC
Otherwise the way to do would be to have a form with empty hidden inputs that we populate when the form is submitted.


like what we do on

  commit 1415fee322a497a3dc7e511a61854a4099ea40a6
  Bug 36193: cud- treatment for cash_registers.pl

or

  commit c706fc9e41583f593bda7a555764f61116e11fbb
  Bug 34478: Replace delete links with form - smart-rules
Comment 7 Pedro Amorim 2024-03-15 14:49:55 UTC
Created attachment 163250 [details] [review]
Bug 36326: PoC followup

I've moved the static elements to the form instead of appending them.
This does not overlap 100% with bug 36193 or 34478 as in those cases we're not adding inputs to the form dynamically, so we should/have to keep that in here.
Let me know what you think.
Comment 8 Jonathan Druart 2024-03-15 15:38:56 UTC
This second patch is causing a major conflict with bug 33568 while my single line patch is fixing the original problem without any conflicts.
I would prefer to prevent change to this template until 33568 is pushed. 

I will be happy to provide a better fix on top of it once in master.
Comment 9 David Nind 2024-03-15 19:27:09 UTC
Created attachment 163276 [details] [review]
Bug 36326: Fix batch item mod/del access from biblio detail page

Allow both $op eq "show" and "cud-show".
We need to keep the POST when we upload a file, but we can simply allow
GET with "show".

Test plan:
Go to the biblio detail page, select an item and test both tools via the links
"Delete selected items" and "Modify selected items"

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2024-03-15 19:28:19 UTC
I've signed off Jonathan's patch.

Feel free to add me to the bug once bug 33568 is pushed.
Comment 11 Marcel de Rooy 2024-03-22 08:04:15 UTC
Looking here
Comment 12 Marcel de Rooy 2024-03-22 08:23:44 UTC Comment hidden (obsolete)
Comment 13 Marcel de Rooy 2024-03-22 08:24:07 UTC
Created attachment 163662 [details] [review]
Bug 36326: PoC followup

I've moved the static elements to the form instead of appending them.
This does not overlap 100% with bug 36193 or 34478 as in those cases we're not adding inputs to the form dynamically, so we should/have to keep that in here.
Let me know what you think.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Marcel de Rooy 2024-03-22 08:24:09 UTC
Created attachment 163663 [details] [review]
Bug 36326: Fix batch item mod/del access from biblio detail page

Allow both $op eq "show" and "cud-show".
We need to keep the POST when we upload a file, but we can simply allow
GET with "show".

Test plan:
Go to the biblio detail page, select an item and test both tools via the links
"Delete selected items" and "Modify selected items"

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Jonathan Druart 2024-03-22 08:55:44 UTC
Only the second patch should be needed here.
Comment 16 Katrin Fischer 2024-03-22 09:00:21 UTC
Waiting to push this one until discussion is resolved - please tidy commit message if this is the one to be pushed.
Comment 17 Marcel de Rooy 2024-03-22 09:56:23 UTC
Comment on attachment 163662 [details] [review]
Bug 36326: PoC followup

Yes, we can also push the other one on itself.
Comment 18 Marcel de Rooy 2024-03-22 09:57:06 UTC
(In reply to Jonathan Druart from comment #15)
> Only the second patch should be needed here.

Confirmed
Comment 19 Katrin Fischer 2024-03-22 11:28:38 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 20 Fridolin Somers 2024-04-17 12:00:04 UTC
Depends on Bug 34478 not in 23.11.x
Comment 21 Martin Renvoize (ashimema) 2024-07-01 11:03:03 UTC
(In reply to Jonathan Druart from comment #8)
> This second patch is causing a major conflict with bug 33568 while my single
> line patch is fixing the original problem without any conflicts.
> I would prefer to prevent change to this template until 33568 is pushed. 
> 
> I will be happy to provide a better fix on top of it once in master.

Did we get the 'better fix' submitted anywhere?
Comment 22 Jonathan Druart 2024-07-10 15:13:09 UTC
(In reply to Martin Renvoize from comment #21)
> (In reply to Jonathan Druart from comment #8)
> > This second patch is causing a major conflict with bug 33568 while my single
> > line patch is fixing the original problem without any conflicts.
> > I would prefer to prevent change to this template until 33568 is pushed. 
> > 
> > I will be happy to provide a better fix on top of it once in master.
> 
> Did we get the 'better fix' submitted anywhere?

I totally forgot about it, thanks for the reminder. I will work on it tomorrow, see bug 37309.