Koha-clms/reports
Jonathan Druart f28b4f73ef
Bug 38414: Fix permission controller-side
This bug refactors the preview sql buttons to pass the permissions granted for each report to
the javascript that clones and updates the modal.

That allows us to check for the appropriate permissions when preparing the buttons for the modal
and to remove any that are not allowed.

This allows for different permissions per report for future devs
(see bugs 42406, 16631)

To test:
1. Create some reports
2. Create a user with only execute_reports permissions
3. Login as that user and go to Reports > use saved
4. In the actions column click the ^ and select 'Preview sql'
5. Notice delete button renders and works to delete
6. Apply patch and restart_all
7. Repeat step 4, now only the Run report button renders and works
8. Add permissions for create_reports
9. Repeat step for, now Edit, Duplicate, Schedule and run buttons render and work
10. Add permissions for delete_reports
11. Repeat step 4, confirm the delete button renders and works
12. Confirm the preview sql button works to preview different reports

We also fix some error in the script, several wrong things there:
* delete was not replaced with cud-delete
* missing op for the creation of new reports
* update and run requires two permssions

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Scott Barter <sbarter@aacpl.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e472a7607f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:24 +01:00
..
acquisitions_stats.pl Bug 41599: Fix output_error in acquisitions_stats.pl 2026-04-13 08:49:41 +01:00
bor_issues_top.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
borrowers_out.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
borrowers_stats.pl Bug 40287: Fix untranslatable strings in more statistics wizards 2026-01-16 15:54:33 +00:00
cash_register_stats.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
cat_issues_top.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
catalog_by_itemtype.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
catalogue_out.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
catalogue_stats.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
dictionary.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
guided_reports.pl Bug 38414: Fix permission controller-side 2026-05-24 13:42:24 +01:00
issues_avg_stats.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
issues_stats.pl Bug 41715: Argument "YYYY-MM-DD" isn't numeric in numeric lt (<)... warnings in issues_stats.pl 2026-04-13 10:41:37 +01:00
itemslost.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
orders_by_fund.pl Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
reports-home.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
reserves_stats.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
serials_stats.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00