Bug 18707

Summary: Background jobs post disabled inputs
Product: Koha Reporter: Fridolin SOMERS <fridolin.somers>
Component: ToolsAssignee: Fridolin SOMERS <fridolin.somers>
Status: In Discussion --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: dcook
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18706
Whiteboard:
Change sponsored?: --- Patch complexity: Trivial patch
Bot Control: --- When did the bot last check this:
Who signed the patch off: Text to go in the release notes:
Bug Depends on:    
Bug Blocks: 18710    
Attachments: Bug 18707 - Background jobs post disabled inputs

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.