Bugzilla – Attachment 187193 Details for
Bug 40896
Run report button should be disabled after click
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40896: Disable run report buttons upon click
Bug-40896-Disable-run-report-buttons-upon-click.patch (text/plain), 4.78 KB, created by
Andrew Fuerste-Henry
on 2025-10-01 13:50:51 UTC
(
hide
)
Description:
Bug 40896: Disable run report buttons upon click
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-10-01 13:50:51 UTC
Size:
4.78 KB
patch
obsolete
>From 7934be16d165df0a3eb8d20492ce1d54237dfbf0 Mon Sep 17 00:00:00 2001 >From: Jake Deery <jake.deery@openfifth.co.uk> >Date: Mon, 29 Sep 2025 12:51:35 +0000 >Subject: [PATCH] Bug 40896: Disable run report buttons upon click > >This patch will disable the run report button found on both the list page, and the individual operation pages (e.g. run, edit, saved successfully). This will stop librarians from unintentionally crashing their Koha system, by pressing the run report button repeatedly when there is no need to re-request it. > >TO TEST: >a) go to /cgi-bin/koha/reports/guided_reports.pl?op=list >b) create three new sql test reports: > *) Name: Test report #1, SQL: SELECT count(*) FROM biblio > *) Name: Test report #2, SQL: SELECT count(*) FROM items > *) Name: Test report #3, SQL: SELECT * FROM items WHERE items.dateaccessioned = <<Date accessioned|date>> >c) run all of the above test reports, noticing how the run report button can be activated repeatedly >APPLY PATCH >d) redo step a >e) run test report #1 from the table, notice how now the button can only be activated once before it is greyed out and the play button is replaced with a spinner >f) return to the list, edit test report #2 from the table, click run report from the edit page, and notice how this run report button exhibits the same behaviour as the button in step e >g) return to the list, run test report #3, select a date, click run report from this page, and notice again how the run report button exhibits the same behaviour as the buttons in steps e and f >SIGN OFF > >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >--- > .../modules/reports/guided_reports_start.tt | 49 ++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index d8be142676a..7872a7652c5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -930,7 +930,7 @@ > [% IF ( template_id ) %] > <input type="hidden" name="template" value="[% template_id | html %]" /> > [% END %] >- <button type="submit" class="btn btn-primary">Run the report</button> >+ <button type="submit" class="btn btn-primary"><i class="fa fa-play"></i> Run the report</button> > </fieldset> > </form> > [% END # / IF ( auth_val_error ) %] >@@ -2005,6 +2005,18 @@ > } > } > >+ const toggleReportRunButton = (element => { >+ if ($(element).attr('disabled') === undefined) { >+ $(element).attr('disabled', 'disabled'); >+ $(element).addClass('disabled'); >+ $(element).find('i.fa-play').first().replaceWith('<i class=\"fa fa-spinner fa-spin\" style=\"--fa-animation-duration: 2s;\"></i>'); >+ } else { >+ $(element).removeAttr('disabled'); >+ $(element).removeClass('disabled'); >+ $(element).find('i.fa-spinner').first().replaceWith('<i class=\"fa fa-play\"></i>'); >+ } >+ }); >+ > $(document).ready(function(){ > > var activeTab = localStorage.getItem("sql_reports_activetab"); >@@ -2480,6 +2492,41 @@ > selectField.style.minWidth = '320px'; > $(selectField).select2(); > }); >+ >+ $('a[href*="/cgi-bin/koha/reports/guided_reports.pl"]').each((idx, element) => { >+ const params = new URLSearchParams($(element).attr('href')); >+ const op = params.get('op'); >+ >+ if (op !== 'run') { >+ return; >+ } >+ >+ $(element).on('click', event => { >+ event.preventDefault(); >+ const href = $(element).attr('href'); >+ >+ toggleReportRunButton(element); >+ setTimeout(() => { >+ toggleReportRunButton(element); >+ }, 120000); >+ >+ window.location.href = href; >+ return false; >+ }); >+ }); >+ >+ $('#report_param_form').on('submit', event => { >+ const button = $('button[type="submit"]'); >+ >+ if (button.length < 1) { >+ return; >+ } >+ >+ toggleReportRunButton(button); >+ setTimeout(() => { >+ toggleReportRunButton(button); >+ }, 120000); >+ }); > }); > > $("#toggle_auto_links").on("click", function(e){ >-- >2.39.5
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 40896
:
187044
| 187193 |
187512