Bug 41082

Summary: Renaming columns in reports doesn't work with batch tools
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ReportsAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Brendan Lawlor <blawlor>
Severity: minor    
Priority: P5 - low CC: blawlor, hebah, jonathan.druart, lisette
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Attachments: Bug 41082: Fix batch tools from reports when itemnumber col has been renamed
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed

Description Katrin Fischer 2025-10-23 09:13:56 UTC
This is a bit of a curious case:

When creating an SQL report and it contains the column itemnumber, we activate batch operations above the table. The itemnumber column can be renamed, using the syntax [[itemnumber|Exemplarnummer]], which gives us the option to translate the column name into something nicer for display.

But: if you then send to batch item edit, the items are not transmitted.

To test:

1) Create a report:
select itemnumber, itemcallnumber from items;

2) Send some items to batch item edit, verify the items are shown above the item form

3) Update the report:
select [[itemnumber|Exemplarnummer]], itemcallnumber from items;

4) Verify the report still shows as before with the batch options available and only the column being renamed.

5) Send some items to the batch item edit again, verify the items are NOT shown abvoe the item form => nothing would be batch edited.
Comment 1 Jonathan Druart 2025-10-23 10:41:18 UTC
Created attachment 188321 [details] [review]
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed

Description from comment 0

When creating an SQL report and it contains the column itemnumber, we
activate batch operations above the table. The itemnumber column can be
renamed, using the syntax [[itemnumber|Exemplarnummer]], which gives us
the option to translate the column name into something nicer for
display.

But: if you then send to batch item edit, the items are not transmitted.

Test plan:

1) Create a report:
select itemnumber, itemcallnumber from items;

2) Send some items to batch item edit, verify the items are shown above the item form

3) Update the report:
select [[itemnumber|Exemplarnummer]], itemcallnumber from items;

4) Verify the report still shows as before with the batch options available and only the column being renamed.

5) Send some items to the batch item edit again

=> verify the items are shown above the item form
Comment 2 hebah 2025-10-23 13:25:14 UTC
Heh, I suspect this is a case of a bug that will break some folks' workflows - there are some libraries that use this 'trick' to nix the data links and batch options.
Comment 3 Katrin Fischer 2025-10-23 14:23:50 UTC
But then they are exploiting a bug, I don't feel like we should account for that. 

The batch options are still showing, they are just broken. So it's not really nixed. You can just use itemnumber as XXXX if you want to nix.
Comment 4 Owen Leonard 2025-10-24 16:29:44 UTC
Created attachment 188419 [details] [review]
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed

Description from comment 0

When creating an SQL report and it contains the column itemnumber, we
activate batch operations above the table. The itemnumber column can be
renamed, using the syntax [[itemnumber|Exemplarnummer]], which gives us
the option to translate the column name into something nicer for
display.

But: if you then send to batch item edit, the items are not
transmitted.

Test plan:

1) Create a report:
   select itemnumber, itemcallnumber from items;

2) Send some items to batch item edit, verify the items are shown above
   the item form

3) Update the report:
   select [[itemnumber|Exemplarnummer]], itemcallnumber from items;

4) Verify the report still shows as before with the batch options
   available and only the column being renamed.

5) Send some items to the batch item edit again

   => verify the items are shown above the item form

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Owen Leonard 2025-10-24 16:31:31 UTC
Edit the patch to remove the change to yarn.lock which I assumed to be accidental.
Comment 6 Jonathan Druart 2025-10-24 17:45:39 UTC
(In reply to Owen Leonard from comment #5)
> Edit the patch to remove the change to yarn.lock which I assumed to be
> accidental.

Yes, thank you!
Comment 7 Brendan Lawlor 2025-10-28 18:05:10 UTC
Created attachment 188523 [details] [review]
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed

Description from comment 0

When creating an SQL report and it contains the column itemnumber, we
activate batch operations above the table. The itemnumber column can be
renamed, using the syntax [[itemnumber|Exemplarnummer]], which gives us
the option to translate the column name into something nicer for
display.

But: if you then send to batch item edit, the items are not
transmitted.

Test plan:

1) Create a report:
   select itemnumber, itemcallnumber from items;

2) Send some items to batch item edit, verify the items are shown above
   the item form

3) Update the report:
   select [[itemnumber|Exemplarnummer]], itemcallnumber from items;

4) Verify the report still shows as before with the batch options
   available and only the column being renamed.

5) Send some items to the batch item edit again

   => verify the items are shown above the item form

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 8 Brendan Lawlor 2025-10-28 18:11:01 UTC
This change makes sense because batchMod.pl expects a multi param named itemnumber.

Before this patch the batch_item_modification and batch_item_deletion forms' inputs for itemnumbers were being rendered with the renamed column as name attribute instead of just 'itemnumber'.

Nice! Passing QA.
Comment 9 Lucas Gass (lukeg) 2025-10-31 21:32:00 UTC
Nice work everyone!

Pushed to main for 25.11