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: Bugs List <koha-bugs>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: lisette
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37188    
Bug Blocks:    
Attachments: 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
Created attachment 187268 [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