Bugzilla – Attachment 19843 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), 6.26 KB, created by
Liz Rea
on 2013-07-22 00:07:34 UTC
(
hide
)
Description:
Bug 3134 - Ability to selelct multiple reports to delete at once
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2013-07-22 00:07:34 UTC
Size:
6.26 KB
patch
obsolete
>From 9f815f2287a5b7cacb495fac28b16d665c660be0 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 3 Jul 2013 10:05:55 -0400 >Subject: [PATCH] Bug 3134 - Ability to selelct multiple reports to delete at > once > >This patch adds the option to select multiple saved reports for >deletion. > >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. > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >Functional tests pass, template tests pass. >--- > C4/Reports/Guided.pm | 14 +++++++------- > .../prog/en/modules/reports/guided_reports_start.tt | 21 ++++++++++++++++++--- > reports/guided_reports.pl | 11 +++++++++-- > 3 files changed, 34 insertions(+), 12 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index f0db7a3..9447c71 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -609,13 +609,13 @@ 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) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = 'DELETE FROM saved_sql WHERE id IN (' . join( ',', ('?') x @ids ) . ')'; >+ my $sth = $dbh->prepare($query); >+ $sth->execute(@ids); >+ $sth->finish; >+} > > 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 8c34135..9cc1894 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 >@@ -122,6 +122,15 @@ $(document).ready(function(){ > rtable.fnSetColumnVis(4, true); > } > }); >+ >+ $("#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?")); >+ }); > [% END %] > > [% IF ( showsql ) %] >@@ -132,7 +141,7 @@ $(document).ready(function(){ > [% IF ( saved1 ) %] > $(".confirmdelete").click(function(){ > $(this).parents('tr').attr("class","warn"); >- if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){ >+ if(confirm(_("Are you sure you want to delete this saved report?"))){ > return true; > } else { > $(this).parents('tr').attr("class",""); >@@ -273,6 +282,8 @@ canned reports and writing custom SQL reports.</p> > <option value="">All</option> > </select> > </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"> > <thead> > <tr> >@@ -297,7 +308,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><label>[% savedreport.id %] <input type="checkbox" name="ids" value="[% savedreport.id %]" /></label></td> > <td>[% savedreport.report_name %]</td> > <td>[% savedreport.type %]</td> > <td>[% savedreport.groupname %]</td> >@@ -317,7 +328,7 @@ canned reports and writing custom SQL reports.</p> > <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Show%20SQL">Show</a> > [% IF ( CAN_user_reports_create_reports ) %] > <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Edit%20SQL">Edit</a> >- <a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]">Duplicate</a> >+ <a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]">Duplicate</a> > [% END %] > </td> > <td> >@@ -331,6 +342,10 @@ canned reports and writing custom SQL reports.</p> > [% END %] > </tbody> > </table> >+ <fieldset class="action"> >+ <input type="submit" value="Delete selected" /> >+ </fieldset> >+ </form> > </div> > </div> > [% ELSE %]<div class="dialog message"> >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 929feea..b9c49ad 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -108,11 +108,18 @@ elsif ( $phase eq 'Build new' ) { > ); > } > >+elsif ( $phase eq 'Delete Multiple') { >+ my @ids = $input->param('ids'); >+ delete_report( @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.8.1.2
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