Bug 40937

Summary: No option to show/hide data menu in report results when including borrowernumber
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: ReportsAssignee: Andrew Fuerste-Henry <andrew>
Status: Pushed to oldstable --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, lisette, lucas
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
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,25.05.05,24.11.11
Circulation function:
Bug Depends on: 37188    
Bug Blocks:    
Attachments: Bug 40937: Include show data menu button for batch_borrowernumbers
Bug 40937: Include show data menu button for batch_borrowernumbers
Bug 40937: Include show data menu button for batch_borrowernumbers

Description Andrew Fuerste-Henry 2025-10-02 12:29:39 UTC
When borrowernumber was added as an option for batch patron action from reports, it didn't get added to the IF statement that makes the Show/Hide Data Menus button appear. It only knows to show up for cardnumber, biblionumber, itemnumber, or reserve_id.
(https://github.com/Koha-Community/Koha/blob/99283025fc4ca0fa1c096344a47b380f75d8fe76/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt#L1265)

In a fun little twist, we told Koha to not set batch_cardnumbers if batch_borrowernumbers was already set, to stop the batch operations from showing up twice.
(https://github.com/Koha-Community/Koha/blob/99283025fc4ca0fa1c096344a47b380f75d8fe76/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt#L1054)

To recreate:
1 - save and run "SELECT borrowernumber FROM borrowers" - no Show/Hide button
2 - save and run "SELECT cardnumber FROM borrowers" - yes Show/Hide button!
3 - save and run "SELECT cardnumber, borrowernumber FROM borrowers" - no Show/Hide button
4 - save and run "SELECT cardnumber, borrowernumber, itemnumber FROM issues LEFT JOIN borrowers USING (borrowernumber)" - yes Show/Hide button!
Comment 1 Andrew Fuerste-Henry 2025-10-02 12:43:53 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2025-10-16 06:46:00 UTC
Created attachment 187947 [details] [review]
Bug 40937: Include show data menu button for batch_borrowernumbers

To test:
1 - save and run a report of "SELECT borrowernumber FROM borrowers"
2 - observe your results page does not include the Show Data Menu button
3 - save and run a report of "SELECT cardnumber FROM borrowers"
4 - observe your results page does include the button
5 - save and run a report of "SELECT borrowernumber, cardnumber FROM borrowers"
6 - observe you are once again buttonless on the results page
7 - apply patch
8 - run your report from step 1, observe you now have the button
9 - run your report from step 3, observe you still have the button
10 - run your report from step 5, observe you now have the button
11 - confirm that the batch actions dropdown only includes the patron actions once

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Comment 3 Nick Clemens (kidclamp) 2025-10-16 19:12:21 UTC
Created attachment 188029 [details] [review]
Bug 40937: Include show data menu button for batch_borrowernumbers

To test:
1 - save and run a report of "SELECT borrowernumber FROM borrowers"
2 - observe your results page does not include the Show Data Menu button
3 - save and run a report of "SELECT cardnumber FROM borrowers"
4 - observe your results page does include the button
5 - save and run a report of "SELECT borrowernumber, cardnumber FROM borrowers"
6 - observe you are once again buttonless on the results page
7 - apply patch
8 - run your report from step 1, observe you now have the button
9 - run your report from step 3, observe you still have the button
10 - run your report from step 5, observe you now have the button
11 - confirm that the batch actions dropdown only includes the patron actions once

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2025-10-20 16:14:31 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 5 Paul Derscheid 2025-10-29 09:10:11 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 6 Fridolin Somers 2025-11-10 15:06:39 UTC
Pushed to 24.11.x for 24.11.11