Bug 18707 - Background jobs post disabled inputs
Summary: Background jobs post disabled inputs
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 18710
  Show dependency treegraph
 
Reported: 2017-05-31 14:23 UTC by Fridolin Somers
Modified: 2020-06-04 20:34 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03,18.11.09


Attachments
Bug 18707 - Background jobs post disabled inputs (1.47 KB, patch)
2017-05-31 14:30 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 18707: Background jobs post disabled inputs (1.55 KB, patch)
2019-06-28 11:57 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 18707: Background jobs post disabled inputs (1.59 KB, patch)
2019-07-06 15:52 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2017-05-31 14:23:54 UTC
For example, in Tools > Batch item modification input of deleted subfields are disabled.
This form is posted using background job via JS code.
Looks like this JS code converts a POST form into a GET URL, including inputs that are disabled :

koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js
function submitBackgroundJob(f) {
...
$(':input', f).each(function() {
...
Comment 1 Fridolin Somers 2017-05-31 14:30:01 UTC
Created attachment 63866 [details] [review]
Bug 18707 - Background jobs post disabled inputs

For example, in Tools > Batch item modification input of deleted subfields are disabled.
This form is posted using background job via JS code.
Looks like this JS code converts a POST form into a GET URL, including inputs that are disabled :

koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js
function submitBackgroundJob(f) {
...
$(':input', f).each(function() {
...

This patch add a :enabled to selector

Test plan :
<to define>
Comment 2 Fridolin Somers 2017-05-31 14:33:55 UTC
submitBackgroundJob is used by :
offline_circ/
process_koc.tt

tools/
batch_record_modification.tt
batchMod-del.tt
batchMod-edit.tt
manage-marc-import.tt
stage-marc-import.tt

Disabled input can exist in batchMod, what about the others ?
Comment 3 David Cook 2017-07-27 01:50:36 UTC
Can you further explain the bug? I'm not sure what you're describing here. 

1. I go to /cgi-bin/koha/tools/batchMod.pl
2. I enter a barcode and submit the form
3. I see all the item fields that I can use for doing the batch edit

What's "input of deleted subfields are disabled" mean?
Comment 4 Fridolin Somers 2017-07-28 10:06:50 UTC
(In reply to David Cook from comment #3)
> Can you further explain the bug? I'm not sure what you're describing here. 
> 
> 1. I go to /cgi-bin/koha/tools/batchMod.pl
> 2. I enter a barcode and submit the form
> 3. I see all the item fields that I can use for doing the batch edit
> 
> What's "input of deleted subfields are disabled" mean?

Hie, thanks for testing this.

>For example, in Tools > Batch item modification input of deleted subfields are disabled.
I mean, in this form there is for each subfield :
- a text input or select to change the value of this subfield
- a checkbox to delete the subfield
When checking the checkbox, the text input or select is set to disable (HTML attribute). So that it can't be edited and, but more important, it is not sent when form is submitted. This is important because the code looks to subfields to modify with those inputs.

The bug is that with backgound job, inputs are sent event when they have de HTML attribut "disabled".
Comment 5 David Cook 2017-08-03 06:06:46 UTC
(In reply to Fridolin SOMERS from comment #4)
> > What's "input of deleted subfields are disabled" mean?
> 
> Hie, thanks for testing this.
> 
> >For example, in Tools > Batch item modification input of deleted subfields are disabled.
> I mean, in this form there is for each subfield :
> - a text input or select to change the value of this subfield
> - a checkbox to delete the subfield
> When checking the checkbox, the text input or select is set to disable (HTML
> attribute). So that it can't be edited and, but more important, it is not
> sent when form is submitted. This is important because the code looks to
> subfields to modify with those inputs.
> 
> The bug is that with backgound job, inputs are sent event when they have de
> HTML attribut "disabled".

Ahhh, thanks for the clarification. I think I understand now.

I'm swamped at the moment, but I'll try to test this when I can.
Comment 6 Kyle M Hall 2019-06-28 11:57:57 UTC
Created attachment 91065 [details] [review]
Bug 18707: Background jobs post disabled inputs

For example, in Tools > Batch item modification input of deleted subfields are disabled.
This form is posted using background job via JS code.
Looks like this JS code converts a POST form into a GET URL, including inputs that are disabled :

koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js
function submitBackgroundJob(f) {
...
$(':input', f).each(function() {
...

This patch add a :enabled to selector

Test plan :
<to define>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Katrin Fischer 2019-07-06 15:51:31 UTC
Missing test plan... but I tested multiple batch operations and the change makes sense.
Comment 8 Katrin Fischer 2019-07-06 15:52:17 UTC
Created attachment 91396 [details] [review]
Bug 18707: Background jobs post disabled inputs

For example, in Tools > Batch item modification input of deleted subfields are disabled.
This form is posted using background job via JS code.
Looks like this JS code converts a POST form into a GET URL, including inputs that are disabled :

koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js
function submitBackgroundJob(f) {
...
$(':input', f).each(function() {
...

This patch add a :enabled to selector

Test plan :
<to define>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Martin Renvoize 2019-07-15 11:21:16 UTC
Nice work!

Pushed to master for 19.11.00
Comment 10 Fridolin Somers 2019-07-30 07:35:41 UTC
Pushed to 19.05.x for 19.05.03
Comment 11 Lucas Gass 2019-08-06 19:34:06 UTC
backported to 18.11.x for 18.11.09