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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-1 / +3 lines)
Lines 1617-1623 Link Here
1617
                        <div class="alert alert-warning">
1617
                        <div class="alert alert-warning">
1618
                            <strong>The following error was encountered:</strong><br />
1618
                            <strong>The following error was encountered:</strong><br />
1619
                            [% FOREACH error IN errors %]
1619
                            [% FOREACH error IN errors %]
1620
                                [% IF ( error.sqlerr ) %]
1620
                                [% IF ( error.duplicate_running_report_ids ) %]
1621
                                    This report is already running. Please wait for it to finish before running it again.
1622
                                [% ELSIF ( error.sqlerr ) %]
1621
                                    This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1623
                                    This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1622
                                    Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1624
                                    Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1623
                                    Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
1625
                                    Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
(-)a/reports/guided_reports.pl (-1 / +18 lines)
Lines 789-794 if ( $op eq 'run' ) { Link Here
789
    my $template_id     = $input->param('template');
789
    my $template_id     = $input->param('template');
790
    my $want_full_chart = $input->param('want_full_chart') || 0;
790
    my $want_full_chart = $input->param('want_full_chart') || 0;
791
791
792
    my @duplicate_running_report_ids;
793
    if ( C4::Context->userenv ) {
794
        my $user_id = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
795
        @duplicate_running_report_ids = Koha::Reports->running( { report_id => $report_id, user_id => $user_id } );
796
    }
797
792
    # offset algorithm
798
    # offset algorithm
793
    if ( $input->param('page') ) {
799
    if ( $input->param('page') ) {
794
        $offset = ( $input->param('page') - 1 ) * $limit;
800
        $offset = ( $input->param('page') - 1 ) * $limit;
Lines 973-978 if ( $op eq 'run' ) { Link Here
973
                'id'              => $report_id,
979
                'id'              => $report_id,
974
                'template_id'     => $template_id,
980
                'template_id'     => $template_id,
975
            );
981
            );
982
        } elsif (@duplicate_running_report_ids) {
983
            $template->param(
984
                'sql'          => $sql,
985
                'original_sql' => $original_sql,
986
                'id'           => $report_id,
987
                'execute'      => 1,
988
                'name'         => $name,
989
                'notes'        => $notes,
990
                'errors'       => [ { duplicate_running_report_ids => \@duplicate_running_report_ids } ],
991
                'sql_params'   => \@sql_params,
992
                'param_names'  => \@param_names,
993
            );
976
        } else {
994
        } else {
977
            my ( $sql, $header_types ) = $report->prep_report( \@param_names, \@sql_params );
995
            my ( $sql, $header_types ) = $report->prep_report( \@param_names, \@sql_params );
978
            $template->param( header_types => $header_types );
996
            $template->param( header_types => $header_types );
979
- 

Return to bug 41918