Bugzilla – Attachment 174842 Details for
Bug 38495
Cannot cancel background job (CSRF)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38495: Use JS to submit form to cancel background jobs
Bug-38495-Use-JS-to-submit-form-to-cancel-backgrou.patch (text/plain), 2.50 KB, created by
Jonathan Druart
on 2024-11-20 13:43:44 UTC
(
hide
)
Description:
Bug 38495: Use JS to submit form to cancel background jobs
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-11-20 13:43:44 UTC
Size:
2.50 KB
patch
obsolete
>From e21617dcd3bd5b35b88065257d90f7652eb07017 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 20 Nov 2024 13:24:12 +0000 >Subject: [PATCH] Bug 38495: Use JS to submit form to cancel background jobs > >This patch adjusts the link to cancel jobs to be submitted as a POST with cud-cancel operation > >To test: >1 - Stop your long tasks bacground jobs worker > sudo koha-worker --stop --queue long_tasks kohadev >2 - Stage a file for import >3 - Administration -> Manage jobs >4 - See your new job >5 - Click 'cancel' >6 - It didn't work >7 - Apply patch >8 - Browse to jobs again >9 - Click 'Cancel' >10 - Job is successfully cancelled > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../intranet-tmpl/prog/en/modules/admin/background_jobs.tt | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >index e6b5fbf38c0..9377dc367d4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >@@ -153,6 +153,7 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] >+ [% Asset.js("js/form-submit.js") | $raw %] > [% INCLUDE 'js-date-format.inc' %] > [% INCLUDE 'datatables.inc' %] > <script> >@@ -325,7 +326,7 @@ > "data": function( row, type, val, meta ) { > var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id='+ encodeURIComponent(row.job_id) +'"><i class="fa-solid fa-eye aria-hidden="true"></i> '+_("View")+'</a>'+"\n"; > if ( row.status == 'new' || row.status == 'started' ) { >- result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&id='+ encodeURIComponent(row.job_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Cancel")+'</a>'; >+ result += '<a class="btn btn-default btn-xs submit-form-link" role="button" href="#" data-action="/cgi-bin/koha/admin/background_jobs.pl" data-method="post" data-op="cud-cancel" data-id="'+ encodeURIComponent(row.job_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Cancel")+'</a>'; > } > return result; > }, >-- >2.34.1
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 38495
:
174841
|
174842
|
174843
|
174910
|
174911