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 (-3 / +20 lines)
Lines 72-78 $(document).ready(function(){ Link Here
72
        'iDisplayLength': 20,
72
        'iDisplayLength': 20,
73
        'aaSorting': [[ 1, "asc" ]],
73
        'aaSorting': [[ 1, "asc" ]],
74
        'aoColumnDefs': [
74
        'aoColumnDefs': [
75
            { 'bSortable': false, 'bSearchable':false, 'aTargets': [-1, -2, -3, -4] },
75
            { 'bSortable': false, 'bSearchable':false, 'aTargets': [0,-1, -2, -3, -4] },
76
            { 'bSearchable': false, 'aTargets': [3, 4] }
76
            { 'bSearchable': false, 'aTargets': [3, 4] }
77
        ],
77
        ],
78
        'oLanguage': {
78
        'oLanguage': {
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-281 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>
290
                    <th>&nbsp;</th>
279
                    <th>ID</th>
291
                    <th>ID</th>
280
                    <th>Report name</th>
292
                    <th>Report name</th>
281
                    <th>Type</th>
293
                    <th>Type</th>
Lines 297-302 canned reports and writing custom SQL reports.</p> Link Here
297
            <tbody>
309
            <tbody>
298
                [% FOREACH savedreport IN savedreports %]
310
                [% FOREACH savedreport IN savedreports %]
299
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
311
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
312
                        <td><input type="checkbox" name="ids" value="[% savedreport.id %]" /></td>
300
                        <td>[% savedreport.id %]</td>
313
                        <td>[% savedreport.id %]</td>
301
                        <td>[% savedreport.report_name %]</td>
314
                        <td>[% savedreport.report_name %]</td>
302
                        <td>[% savedreport.type %]</td>
315
                        <td>[% savedreport.type %]</td>
Lines 317-323 canned reports and writing custom SQL reports.</p> Link Here
317
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Show%20SQL">Show</a>
330
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Show%20SQL">Show</a>
318
                            [% IF ( CAN_user_reports_create_reports ) %]
331
                            [% IF ( CAN_user_reports_create_reports ) %]
319
                                <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Edit%20SQL">Edit</a>
332
                                <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Edit%20SQL">Edit</a>
320
                                <a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]">Duplicate</a>
333
                                <a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]">Duplicate</a>
321
                            [% END %]
334
                            [% END %]
322
                        </td>
335
                        </td>
323
                        <td>
336
                        <td>
Lines 331-336 canned reports and writing custom SQL reports.</p> Link Here
331
                [% END %]
344
                [% END %]
332
            </tbody>
345
            </tbody>
333
        </table>
346
        </table>
347
        <fieldset class="action">
348
            <input type="submit" value="Delete selected" />
349
        </fieldset>
350
    </form>
334
    </div>
351
    </div>
335
</div>
352
</div>
336
[% ELSE %]<div class="dialog message">
353
[% 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