Bug 15299

Summary: Add delete confirmation for deleting saved reports
Product: Koha Reporter: HB-NEKLS <gwilliams>
Component: ReportsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: brendan, f.demians, jonathan.druart, julian.maurice, liz
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15299: Ask for confirmation when deleting a report from second page
Bug 15299: Ask for confirmation when deleting a report from second page
Bug 15299: Ask for confirmation when deleting a report from second page

Description HB-NEKLS 2015-12-03 18:01:20 UTC
In pretty much all areas of Koha, if you delete something (item, patron, setting, authorised values, etc.) you must confirm the deletion. When you delete a saved report, the report just deletes. Could a confirmation message be added, before the deletion happens? 

1. Go to Saved Reports. 
2. Create a new report and save it. 
3. Go back to Saved Reports and find the report you just created .
4. Click on the Actions menu for that report, and choose Delete. 
5. Note that the report deletes without a confirmation message.
Comment 1 HB-NEKLS 2015-12-06 02:36:04 UTC
FYI: when you select multiple reports to delete from the saved SQL reports page, and click the "Delete selected" button, you do get a "Are you sure you want to delete the selected reports?" confirmation message. 

The issue is with individual report deletion -- no delete confirmation message is triggered there.
Comment 2 Owen Leonard 2015-12-07 18:02:58 UTC
Heather can you please check this again? In my tests 3.18.x and master there is already a delete confirmation warning. It is possible that a JavaScript error elsewhere on the page is short-circuiting the confirmation. Do you have custom JS in your staff client system preferences which might be causing problems?
Comment 3 Jonathan Druart 2016-01-07 12:44:36 UTC
Same here, I cannot recreate on master.
Heather, please provide more details if it still happens.
Comment 4 Jonathan Druart 2016-01-07 12:46:59 UTC
Ok got it!
It happens when you want to delete a report which is not displayed initially (pagination).
Comment 5 Jonathan Druart 2016-01-07 12:53:54 UTC Comment hidden (obsolete)
Comment 6 Liz Rea 2016-01-08 00:29:25 UTC
Just noting that clicking the delete button from the Run, Edit, or Show views also doesn't prompt for confirmation. But this patch adds a confirm for deleting from the list, and that's good!

Liz
Comment 7 Liz Rea 2016-01-08 00:30:38 UTC Comment hidden (obsolete)
Comment 8 Liz Rea 2016-01-08 00:32:49 UTC
adds back the confirm for ones that are not initially displayed, I mean
Comment 9 Liz Rea 2016-01-08 02:14:15 UTC
Actually sorry I was wrong, it works fine on the show page.
Comment 10 Jonathan Druart 2016-01-08 09:37:15 UTC
(In reply to Liz Rea from comment #9)
> Actually sorry I was wrong, it works fine on the show page.

I have tested all others and they worked, please confirm you don't get the warn somewhere.
Comment 11 Kyle M Hall (khall) 2016-01-08 12:58:07 UTC
Created attachment 46428 [details] [review]
Bug 15299: Ask for confirmation when deleting a report from second page

Some link are hidden when loading the page, by DataTables, we need to
use the delegate jQuery method to attach a handler to the click event
for all delete links (the ones existing when loading the page, and the
ones displayed in the future).

Test plan:
Have more than 20 reports defined
Go on the report list view, then change the number of elements
displayed, click "action>delete". You should get a warn.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Confirm that there is now a confirmation on delete from the list -> action menu

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 12 Brendan Gallagher 2016-01-27 02:04:46 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks!
Comment 13 Julian Maurice 2016-01-29 14:12:22 UTC
Patch pushed to 3.22.x, will be in 3.22.3
Comment 14 Frédéric Demians 2016-02-12 06:40:27 UTC
This patch has been pushed to 3.20.x, will be in 3.20.9.