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

(-)a/debian/templates/koha-conf-site.xml.in (+1 lines)
Lines 343-348 __END_SRU_PUBLICSERVER__ Link Here
343
 <!-- SQL report limits, 0 means the feature is disabled -->
343
 <!-- SQL report limits, 0 means the feature is disabled -->
344
 <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit>
344
 <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit>
345
 <total_running_reports_per_user_limit>0</total_running_reports_per_user_limit>
345
 <total_running_reports_per_user_limit>0</total_running_reports_per_user_limit>
346
 <total_running_reports_per_instance_limit>0</total_running_reports_per_instance_limit>
346
347
347
 <!-- Configuration for X-Forwarded-For -->
348
 <!-- Configuration for X-Forwarded-For -->
348
 <!--
349
 <!--
(-)a/etc/koha-conf.xml (+1 lines)
Lines 160-165 Link Here
160
 <!-- SQL report limits, 0 means the feature is disabled -->
160
 <!-- SQL report limits, 0 means the feature is disabled -->
161
 <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit>
161
 <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit>
162
 <total_running_reports_per_user_limit>0</total_running_reports_per_user_limit>
162
 <total_running_reports_per_user_limit>0</total_running_reports_per_user_limit>
163
 <total_running_reports_per_instance_limit>0</total_running_reports_per_instance_limit>
163
164
164
 <!-- Configuration for X-Forwarded-For -->
165
 <!-- Configuration for X-Forwarded-For -->
165
 <!--
166
 <!--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (+2 lines)
Lines 1621-1626 Link Here
1621
                                    This report is already running. Please wait for it to finish before running it again.
1621
                                    This report is already running. Please wait for it to finish before running it again.
1622
                                [% ELSIF ( error.total_running_reports_per_user_limit_exceeded ) %]
1622
                                [% ELSIF ( error.total_running_reports_per_user_limit_exceeded ) %]
1623
                                    You have too many reports running at the moment. Please wait for some of them to finish before running this report again.
1623
                                    You have too many reports running at the moment. Please wait for some of them to finish before running this report again.
1624
                                [% ELSIF ( total_running_reports_per_instance_limit_exceeded ) %]
1625
                                    There are too many total reports running at the moment. Please wait for some of them to finish before running this report again.
1624
                                [% ELSIF ( error.sqlerr ) %]
1626
                                [% ELSIF ( error.sqlerr ) %]
1625
                                    This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1627
                                    This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1626
                                    Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1628
                                    Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
(-)a/reports/guided_reports.pl (-6 / +22 lines)
Lines 802-816 if ( $op eq 'run' ) { Link Here
802
        : 0;
802
        : 0;
803
803
804
    # Determine if the user is running too many reports in total
804
    # Determine if the user is running too many reports in total
805
    my @total_running_report_ids;
805
    my @total_running_for_user_report_ids;
806
    my $total_running_reports_per_user_limit = C4::Context->config('total_running_reports_per_user_limit');
806
    my $total_running_reports_per_user_limit = C4::Context->config('total_running_reports_per_user_limit');
807
    if ( $total_running_reports_per_user_limit && C4::Context->userenv ) {
807
    if ( $total_running_reports_per_user_limit && C4::Context->userenv ) {
808
        my $user_id = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
808
        my $user_id = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
809
        @total_running_report_ids = Koha::Reports->running( { user_id => $user_id } );
809
        @total_running_for_user_report_ids = Koha::Reports->running( { user_id => $user_id } );
810
    }
810
    }
811
    my $total_running_reports_per_user_limit_exceeded =
811
    my $total_running_reports_per_user_limit_exceeded =
812
        $total_running_reports_per_user_limit
812
        $total_running_reports_per_user_limit
813
        ? scalar(@total_running_report_ids) >= $total_running_reports_per_user_limit
813
        ? scalar(@total_running_for_user_report_ids) >= $total_running_reports_per_user_limit
814
        : 0;
815
816
    # Determine if the Koha instance is running too many reports in total
817
    my @total_running_for_instance_report_ids;
818
    my $total_running_reports_per_instance_limit = C4::Context->config('total_running_reports_per_instance_limit');
819
    if ( $total_running_reports_per_instance_limit && C4::Context->instanceenv ) {
820
        my $instance_id = C4::Context->instanceenv ? C4::Context->instanceenv->{number} : undef;
821
        @total_running_for_instance_report_ids = Koha::Reports->running();
822
    }
823
    my $total_running_reports_per_instance_limit_exceeded =
824
        $total_running_reports_per_instance_limit
825
        ? scalar(@total_running_for_instance_report_ids) >= $total_running_reports_per_instance_limit
814
        : 0;
826
        : 0;
815
827
816
    # offset algorithm
828
    # offset algorithm
Lines 1011-1018 if ( $op eq 'run' ) { Link Here
1011
                    ? { duplicate_running_report_ids => \@duplicate_running_report_ids }
1023
                    ? { duplicate_running_report_ids => \@duplicate_running_report_ids }
1012
                    : (),
1024
                    : (),
1013
                    $total_running_reports_per_user_limit_exceeded
1025
                    $total_running_reports_per_user_limit_exceeded
1014
                    ? { total_running_reports_per_user_limit_exceeded => \@total_running_report_ids }
1026
                    ? { total_running_reports_per_user_limit_exceeded => \@total_running_for_user_report_ids }
1015
                    : ()
1027
                    : (),
1028
                    $total_running_reports_per_instance_limit_exceeded
1029
                    ? {
1030
                        total_running_reports_per_instance_limit_exceeded => \@total_running_for_instance_report_ids
1031
                        }
1032
                    : (),
1016
                ],
1033
                ],
1017
                'sql_params'  => \@sql_params,
1034
                'sql_params'  => \@sql_params,
1018
                'param_names' => \@param_names,
1035
                'param_names' => \@param_names,
1019
- 

Return to bug 41920