Bug 15321 - Add delete report link to Show, Edit and Run screens

Currently, if you are editing or viewing the results of running a
report and you decide you want to delete it, you have to go back
to the list of saved reports to do so. This patch adds a "Delete"
link in some convenient places.

To test:
- Apply the patch
- Make sure you have at least one saved report
- Make sure you have the create_reports permission
- Go to the Show, Edit and Run screens and verify the Delete link
  is present and functional, including the JavaScript confirmation
  dialogue
- Change to a user without the create_reports permission and check
  that the Delete link is not displayed on the Show, Edit and Run
  screens
- Sign ye off merrily!

Version 2: This version makes sure the JavaScript confirmation is
shown before an actual delete is carried out.

Signed-off-by: Heather Braum <hbraum@nekls.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Magnus Enger 2015-12-08 20:45:39 +01:00 committed by Kyle M Hall
parent 22db2a85f9
commit 404a11a9a5
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,14 @@
[% END %]
[% END %]
[% IF ( CAN_user_reports_create_reports ) %]
<div class="btn-group">
<a class="confirmdelete btn btn-small" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Delete%20Saved">
<i class="fa fa-remove"></i> Delete
</a>
</div>
[% END %]
[% UNLESS ( errors ) # Unless there are errors saving a report %]
<div class="btn-group">
<a id="runreport" class="btn btn-small" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report">

View File

@ -156,7 +156,7 @@ $(document).ready(function(){
$(this).select();
});
[% END %]
[% IF ( saved1 ) %]
[% IF ( saved1 || showsql || execute || editsql || save_successful ) %]
$(".confirmdelete").click(function(){
$(this).parents('tr').attr("class","warn");
if(confirm(_("Are you sure you want to delete this saved report?"))){