View | Details | Raw Unified | Return to bug 3134
Collapse All | Expand All

(-)a/C4/Reports/Guided.pm (-7 / +7 lines)
Lines 609-621 sub format_results { Link Here
609
}	
609
}	
610
610
611
sub delete_report {
611
sub delete_report {
612
    my ($id)  = @_;
612
    my (@ids) = @_;
613
    my $dbh   = C4::Context->dbh();
613
        my $dbh = C4::Context->dbh;
614
    my $query = "DELETE FROM saved_sql WHERE id = ?";
614
        my $query = 'DELETE FROM saved_sql WHERE id IN (' . join( ',', ('?') x @ids ) . ')';
615
    my $sth   = $dbh->prepare($query);
615
        my $sth = $dbh->prepare($query);
616
    $sth->execute($id);
616
        $sth->execute(@ids);
617
}	
617
        $sth->finish;
618
618
}
619
619
620
my $SAVED_REPORTS_BASE_QRY = <<EOQ;
620
my $SAVED_REPORTS_BASE_QRY = <<EOQ;
621
SELECT s.*, r.report, r.date_run, $AREA_NAME_SQL_SNIPPET, av_g.lib AS groupname, av_sg.lib AS subgroupname,
621
SELECT s.*, r.report, r.date_run, $AREA_NAME_SQL_SNIPPET, av_g.lib AS groupname, av_sg.lib AS subgroupname,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-2 / +17 lines)
Lines 122-127 $(document).ready(function(){ Link Here
122
            rtable.fnSetColumnVis(4, true);
122
            rtable.fnSetColumnVis(4, true);
123
        }
123
        }
124
    });
124
    });
125
126
    $("#reports_form").submit(function(){
127
        var checkedItems = $("input[name=ids]:checked");
128
        if ($(checkedItems).size() == 0) {
129
            alert(_("You must select one or more reports to delete"));
130
            return false;
131
        }
132
        return confirm(_("Are you sure you want to delete the selected reports?"));
133
    });
125
[% END %]
134
[% END %]
126
135
127
[% IF ( showsql ) %]
136
[% IF ( showsql ) %]
Lines 132-138 $(document).ready(function(){ Link Here
132
[% IF ( saved1 ) %]
141
[% IF ( saved1 ) %]
133
    $(".confirmdelete").click(function(){
142
    $(".confirmdelete").click(function(){
134
        $(this).parents('tr').attr("class","warn");
143
        $(this).parents('tr').attr("class","warn");
135
        if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){
144
        if(confirm(_("Are you sure you want to delete this saved report?"))){
136
            return true;
145
            return true;
137
        } else {
146
        } else {
138
            $(this).parents('tr').attr("class","");
147
            $(this).parents('tr').attr("class","");
Lines 273-278 canned reports and writing custom SQL reports.</p> Link Here
273
                <option value="">All</option>
282
                <option value="">All</option>
274
            </select>
283
            </select>
275
        </div>
284
        </div>
285
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
286
<input type="hidden" name="phase" value="Delete Multiple" />
276
        <table id="table_reports">
287
        <table id="table_reports">
277
            <thead>
288
            <thead>
278
                <tr>
289
                <tr>
Lines 293-299 canned reports and writing custom SQL reports.</p> Link Here
293
            <tbody>
304
            <tbody>
294
                [% FOREACH savedreport IN savedreports %]
305
                [% FOREACH savedreport IN savedreports %]
295
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
306
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
296
                        <td>[% savedreport.id %]</td>
307
                        <td><label>[% savedreport.id %] <input type="checkbox" name="ids" value="[% savedreport.id %]" /></label></td>
297
                        <td>
308
                        <td>
298
                            [% IF ( savedreport.report_name ) %]
309
                            [% IF ( savedreport.report_name ) %]
299
                                [% savedreport.report_name %]
310
                                [% savedreport.report_name %]
Lines 338-343 canned reports and writing custom SQL reports.</p> Link Here
338
                [% END %]
349
                [% END %]
339
            </tbody>
350
            </tbody>
340
        </table>
351
        </table>
352
        <fieldset class="action">
353
            <input type="submit" value="Delete selected" />
354
        </fieldset>
355
    </form>
341
    </div>
356
    </div>
342
</div>
357
</div>
343
[% ELSE %]<div class="dialog message">
358
[% ELSE %]<div class="dialog message">
(-)a/reports/guided_reports.pl (-3 / +9 lines)
Lines 108-118 elsif ( $phase eq 'Build new' ) { Link Here
108
    );
108
    );
109
}
109
}
110
110
111
elsif ( $phase eq 'Delete Multiple') {
112
    my @ids = $input->param('ids');
113
    delete_report( @ids );
114
    print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved");
115
    exit;
116
}
117
111
elsif ( $phase eq 'Delete Saved') {
118
elsif ( $phase eq 'Delete Saved') {
112
	
119
	
113
	# delete a report from the saved reports list
120
	# delete a report from the saved reports list
114
	my $id = $input->param('reports');
121
    my $ids = $input->param('reports');
115
	delete_report($id);
122
    delete_report($ids);
116
    print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved");
123
    print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved");
117
	exit;
124
	exit;
118
}		
125
}		
119
- 

Return to bug 3134