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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (+5 lines)
Lines 1547-1552 Link Here
1547
1547
1548
        [% IF ( create || editsql || save ) %]
1548
        [% IF ( create || editsql || save ) %]
1549
1549
1550
            let tables = JSON.parse('[% To.json(tables) | $raw %]');
1551
1550
            var editor = CodeMirror.fromTextArea(sql, {
1552
            var editor = CodeMirror.fromTextArea(sql, {
1551
                lineNumbers: true,
1553
                lineNumbers: true,
1552
                mode: "text/x-sql",
1554
                mode: "text/x-sql",
Lines 1558-1563 Link Here
1558
                },
1560
                },
1559
                extraKeys: {"Tab": "autocomplete"}, //enable tab to accept auto-complete
1561
                extraKeys: {"Tab": "autocomplete"}, //enable tab to accept auto-complete
1560
                hint: CodeMirror.hint.sql,
1562
                hint: CodeMirror.hint.sql,
1563
                hintOptions: {
1564
                    tables: tables
1565
                }
1561
            });
1566
            });
1562
            var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script
1567
            var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script
1563
                "8": "backspace",
1568
                "8": "backspace",
(-)a/reports/guided_reports.pl (-4 / +20 lines)
Lines 163-178 elsif ( $phase eq 'Delete Multiple') { Link Here
163
}
163
}
164
164
165
elsif ( $phase eq 'Delete Saved') {
165
elsif ( $phase eq 'Delete Saved') {
166
	
166
167
	# delete a report from the saved reports list
167
	# delete a report from the saved reports list
168
    my $ids = $input->param('reports');
168
    my $ids = $input->param('reports');
169
    delete_report($ids);
169
    delete_report($ids);
170
    print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved");
170
    print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved");
171
	exit;
171
	exit;
172
}		
172
}
173
173
174
elsif ( $phase eq 'Show SQL'){
174
elsif ( $phase eq 'Show SQL'){
175
	
175
176
    my $id = $input->param('reports');
176
    my $id = $input->param('reports');
177
    my $report = Koha::Reports->find($id);
177
    my $report = Koha::Reports->find($id);
178
    $template->param(
178
    $template->param(
Lines 998-1003 elsif ( $phase eq 'Create report from SQL' || $phase eq 'Create report from exis Link Here
998
        $notes      = $report->notes // '';
998
        $notes      = $report->notes // '';
999
    }
999
    }
1000
1000
1001
    my $tables = get_tables();
1002
1001
    $template->param(
1003
    $template->param(
1002
        sql        => $sql,
1004
        sql        => $sql,
1003
        reportname => $reportname,
1005
        reportname => $reportname,
Lines 1007-1012 elsif ( $phase eq 'Create report from SQL' || $phase eq 'Create report from exis Link Here
1007
        'public' => '0',
1009
        'public' => '0',
1008
        'cache_expiry' => 300,
1010
        'cache_expiry' => 300,
1009
        'usecache' => $usecache,
1011
        'usecache' => $usecache,
1012
        'tables' => $tables,
1010
1013
1011
    );
1014
    );
1012
}
1015
}
Lines 1024-1029 sub header_cell_loop { Link Here
1024
    return \@headers;
1027
    return \@headers;
1025
}
1028
}
1026
1029
1030
#get a list of available tables for auto-complete
1031
sub get_tables {
1032
    my $result = {};
1033
    my $tables = C4::Reports::Guided->get_all_tables();
1034
    for my $table (@{$tables}) {
1035
        my $sql = "SHOW COLUMNS FROM $table";
1036
        my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
1037
        for my $row (@{$rows}) {
1038
            push @{$result->{$table}}, $row->{Field};
1039
        }
1040
    }
1041
    return $result;
1042
}
1043
1027
foreach (1..6) {
1044
foreach (1..6) {
1028
     $template->{VARS}->{'build' . $_} and last;
1045
     $template->{VARS}->{'build' . $_} and last;
1029
}
1046
}
1030
- 

Return to bug 32613