Bugzilla – Attachment 193920 Details for
Bug 41918
Prevent users from running the same report multiple times concurrently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41918: Add ability to disable or change limit via config xml
e64531e.patch (text/plain), 3.45 KB, created by
Kyle M Hall (khall)
on 2026-02-25 16:42:34 UTC
(
hide
)
Description:
Bug 41918: Add ability to disable or change limit via config xml
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2026-02-25 16:42:34 UTC
Size:
3.45 KB
patch
obsolete
>From e64531ea93286535b6a5b49b1b98dd74e1aac372 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 25 Feb 2026 11:33:11 -0500 >Subject: [PATCH] Bug 41918: Add ability to disable or change limit via config > xml > >This commit add the option duplicate_running_reports_per_user_limit to >koha-conf.xml. If this option is empty or 0, the feature is disabled. If >this option is enabled, Koha will limit the number of times a given >report can be run of a single Koha user. > >Test Plan: >1) Apply this patch >2) Set duplicate_running_reports_per_user_limit to 1, verify previous > behavior is maintained >2) Set duplicate_running_reports_per_user_limit to 0, verify the feature > is disabled >3) Set duplicate_running_reports_per_user_limit to 2, verify Koha limits > the number of duplicates of the report to the number specified in duplicate_running_reports_per_user_limit >--- > debian/templates/koha-conf-site.xml.in | 3 +++ > etc/koha-conf.xml | 3 +++ > reports/guided_reports.pl | 7 +++++-- > 3 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 5edefab8b25..b51ff2bdb2f 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -340,6 +340,9 @@ __END_SRU_PUBLICSERVER__ > <plack_max_requests>50</plack_max_requests> > <plack_workers>2</plack_workers> > >+ <!-- SQL report limits, 0 means the feature is disabled --> >+ <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit> >+ > <!-- Configuration for X-Forwarded-For --> > <!-- > <koha_trusted_proxies>1.2.3.4 2.3.4.5 3.4.5.6</koha_trusted_proxies> >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index 6ec2d126e8d..21ad4f5c380 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -157,6 +157,9 @@ > <plack_max_requests>50</plack_max_requests> > <plack_workers>2</plack_workers> > >+ <!-- SQL report limits, 0 means the feature is disabled --> >+ <duplicate_running_reports_per_user_limit>0</duplicate_running_reports_per_user_limit> >+ > <!-- Configuration for X-Forwarded-For --> > <!-- > <koha_trusted_proxies>1.2.3.4 2.3.4.5 3.4.5.6</koha_trusted_proxies> >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 3fc6bdb0110..0da977eaa3f 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -790,7 +790,8 @@ if ( $op eq 'run' ) { > my $want_full_chart = $input->param('want_full_chart') || 0; > > my @duplicate_running_report_ids; >- if ( C4::Context->userenv ) { >+ my $duplicate_running_reports_per_user_limit = C4::Context->config('duplicate_running_reports_per_user_limit'); >+ if ( $duplicate_running_reports_per_user_limit && C4::Context->userenv ) { > my $user_id = C4::Context->userenv ? C4::Context->userenv->{number} : undef; > @duplicate_running_report_ids = Koha::Reports->running( { report_id => $report_id, user_id => $user_id } ); > } >@@ -979,7 +980,9 @@ if ( $op eq 'run' ) { > 'id' => $report_id, > 'template_id' => $template_id, > ); >- } elsif (@duplicate_running_report_ids) { >+ } elsif ( $duplicate_running_reports_per_user_limit >+ && ( scalar @duplicate_running_report_ids >= $duplicate_running_reports_per_user_limit ) ) >+ { > $template->param( > 'sql' => $sql, > 'original_sql' => $original_sql, >-- >2.50.1 (Apple Git-155) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41918
:
193918
|
193919
| 193920