Bugzilla – Attachment 14604 Details for
Bug 3134
Ability to select multiple reports to delete at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3134 - Ability to selelct multiple reports to delete at once
Bug-3134---Ability-to-selelct-multiple-reports-to-.patch (text/plain), 5.09 KB, created by
Owen Leonard
on 2013-01-15 15:48:32 UTC
(
hide
)
Description:
Bug 3134 - Ability to selelct multiple reports to delete at once
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2013-01-15 15:48:32 UTC
Size:
5.09 KB
patch
obsolete
>From 4f9ce7f52a8ddda8858e5a6e1b72ef7c89408508 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 15 Jan 2013 10:39:09 -0500 >Subject: [PATCH] Bug 3134 - Ability to selelct multiple reports to delete at > once >Content-Type: text/plain; charset="utf-8" > >This patch adds the option to select multiple saved reports for >deletion. Text output of the report id (of little information value to >the user) is replaced with a checkbox, and sorting has been removed from >that table column. > >To test you must have two or more saved reports to delete. Deletion >should work properly when: > >- Selecting one report for deletion by checking the box. >- Selecting more than one report for deletion by checking boxes. >- Clicking the old "Delete" link > >Clicking the delete button should prompt you to confirm. Clicking cancel >should cancel. > >Clicking the delete button when no boxes are checked should trigger an >alert asking you to select reports for deletion. >--- > C4/Reports/Guided.pm | 18 +++++++++++------- > .../en/modules/reports/guided_reports_start.tt | 19 +++++++++++++++++-- > reports/guided_reports.pl | 12 ++++++++++-- > 3 files changed, 38 insertions(+), 11 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index 279ac57..6d4665b 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -607,13 +607,17 @@ sub format_results { > } > > sub delete_report { >- my ($id) = @_; >- my $dbh = C4::Context->dbh(); >- my $query = "DELETE FROM saved_sql WHERE id = ?"; >- my $sth = $dbh->prepare($query); >- $sth->execute($id); >-} >- >+ my ($ids) = @_; >+ if ($ids) { >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("DELETE FROM saved_sql WHERE id IN ($ids)"); >+ $sth->execute(); >+ $sth->finish; >+ return 1; >+ } else { >+ return 0; >+ } >+} > > my $SAVED_REPORTS_BASE_QRY = <<EOQ; > SELECT s.*, r.report, r.date_run, $AREA_NAME_SQL_SNIPPET, av_g.lib AS groupname, av_sg.lib AS subgroupname, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index c055b2b..e2d9faf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -65,6 +65,7 @@ $(document).ready(function(){ > widgets : ['zebra'], > sortList: [[1,0]], > headers: { >+ 0: { sorter: false}, > 10: { sorter: false}, > 11: { sorter: false}, > 12: { sorter: false}, >@@ -78,6 +79,14 @@ $(document).ready(function(){ > // redefine the datepicker's default because reports require ISO > // http://jqueryui.com/demos/datepicker/#option-dateFormat > $( ".datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" ); >+ $("#reports_form").submit(function(){ >+ var checkedItems = $("input[name=ids]:checked"); >+ if ($(checkedItems).size() == 0) { >+ alert(_("You must select one or more reports to delete")); >+ return false; >+ } >+ return confirm(_('Are you sure you want to delete the selected reports?')); >+ }); > }); > //]]> > </script> >@@ -151,10 +160,12 @@ canned reports and writing custom SQL reports.</p> > [% INCLUDE 'table-pager.inc' perpage='20' %] > </div> > >+<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post"> >+<input type="hidden" name="phase" value="Delete Multiple" /> > <table id="table_reports" class="tablesorter"> > <thead> > <tr> >- <th>ID</th> >+ <th> </th> > <th>Report name</th> > <th>Type</th> > <th>Area</th> >@@ -174,7 +185,7 @@ canned reports and writing custom SQL reports.</p> > <tbody> > [% FOREACH savedreport IN savedreports %] > [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %] >-<td>[% savedreport.id %]</td> >+<td><input type="checkbox" name="ids" value="[% savedreport.id %]" /></td> > <td>[% savedreport.report_name %]</td> > <td>[% savedreport.type %]</td> > <td>[% savedreport.areaname %]</td> >@@ -206,6 +217,10 @@ canned reports and writing custom SQL reports.</p> > [% END %] > </tbody> > </table> >+<fieldset class="action"> >+ <input type="submit" value="Delete selected" /> >+</fieldset> >+</form> > [% ELSE %]<div class="dialog message"> > [% IF (filter_set) %] > <h4>No saved reports match your criteria. </h4> >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index de18072..5f57c5b 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -109,11 +109,19 @@ elsif ( $phase eq 'Build new' ) { > ); > } > >+elsif ( $phase eq 'Delete Multiple') { >+ >+ my @ids = $input->param('ids'); >+ delete_report( join ",", @ids ); >+ print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved"); >+ exit; >+} >+ > elsif ( $phase eq 'Delete Saved') { > > # delete a report from the saved reports list >- my $id = $input->param('reports'); >- delete_report($id); >+ my $ids = $input->param('reports'); >+ delete_report($ids); > print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved"); > exit; > } >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3134
:
14604
|
19376
|
19806
|
19843
|
20461
|
20465
|
20516
|
20517
|
20524
|
20525
|
20526
|
20527
|
20528