Bug 23252 - Pressing enter should not submit form in item editor
Summary: Pressing enter should not submit form in item editor
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Fridolin Somers
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-02 13:42 UTC by Fridolin Somers
Modified: 2021-06-14 21:29 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.05


Attachments
Bug 23252: Add missing input_marceditor class in item editor (2.31 KB, patch)
2019-07-02 14:20 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 23252: Adds noEnterSubmit class in ajax context (1.68 KB, patch)
2019-08-29 14:08 UTC, Christophe Croullebois
Details | Diff | Splinter Review
Bug 23252: Add missing input_marceditor class in item editor (2.38 KB, patch)
2019-09-06 10:51 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 23252: Adds noEnterSubmit class in ajax context (1.75 KB, patch)
2019-09-06 10:51 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 23252: Add missing input_marceditor class in item editor (2.41 KB, patch)
2019-09-20 20:14 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 23252: Adds noEnterSubmit class in ajax context (1.79 KB, patch)
2019-09-20 20:15 UTC, Bouzid Fergani
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2019-07-02 13:42:39 UTC
In serials receive and acquisition order creation from iso2709, the item edition form shows inputs that are missing "input_marceditor" class.
They are also missing tabindex and id.
Comment 1 Fridolin Somers 2019-07-02 14:20:23 UTC
Created attachment 91187 [details] [review]
Bug 23252: Add missing input_marceditor class in item editor

In serials receive and acquisition order creation from iso2709, the item edition form shows inputs that are missing "input_marceditor" class.
They are also missing tabindex and id.

The side effect is that those inputs dont get the "noEnterSubmit" class so form is posted if a barcode scanner is used or if enter is used on keyboard.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify system preference "AcqCreateItem" is on "placing an order"
2)
2.2) Go to cataloguing module and edit an item
2.3) Verify that $z has an id, tabindex and "input_marceditor" class.
2.4) Verify that typing enter in $z does not submit the form
3)
3.1) Go to a serial with items creation, click on receive
3.2) Change status to "Arrived"
3.3) Verify that $z has an id, tabindex and "input_marceditor" class.
3.4) Verify that typing enter in $z does not submit the form
4)
4.1) Go to an acquisition basket
4.2) Click "Add to basket" and "From a staged file"
4.3) Click "Add orders" on a staged file
4.4) Go in tab "Item information"
4.5) Verify that $z has an id, tabindex and "input_marceditor" class.
Comment 2 Marcel de Rooy 2019-07-02 14:46:53 UTC
(In reply to Fridolin SOMERS from comment #1)
> The side effect is that those inputs dont get the "noEnterSubmit" class so
> form is posted if a barcode scanner is used or if enter is used on keyboard.

But will everyone appreciate that change ?
Comment 3 Fridolin Somers 2019-07-19 12:08:38 UTC
(In reply to Marcel de Rooy from comment #2)
> (In reply to Fridolin SOMERS from comment #1)
> > The side effect is that those inputs dont get the "noEnterSubmit" class so
> > form is posted if a barcode scanner is used or if enter is used on keyboard.
> 
> But will everyone appreciate that change ?

This is the behavior for item edition in cataloging module.
Having the same behavior in serials module is wanted I think.
Comment 4 Fridolin Somers 2019-07-30 09:40:36 UTC
I set major because it is difficult to correct serials once form is posted too early
Comment 5 Christophe Croullebois 2019-08-29 14:08:17 UTC
Created attachment 92497 [details] [review]
Bug 23252: Adds noEnterSubmit class in ajax context

In cataloging.js $(document).ready adds noEnterSubmit class.
This does not work in ajax context, it works with $(document).ajaxSuccess.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify 952$z exists in ACQ framework
2)
2.1) Verify system preference "AcqCreateItem" is on "placing an order"
2.2) Go to an acquisition basket
2.3) Click "Add to basket" and "From a new (empty) record"
2.4) Go to "Item" block
2.5) Verify that $z has "noEnterSubmit" class
2.6) Verify that typing enter in $z does not submit the form
3)
3.1) Change system preference "AcqCreateItem" to "receiving an order"
3.2) Go to "Receive shipment"
3.3) Receive an order
3.4) Go to "Item" block
3.5) Verify that $z has "noEnterSubmit" class
3.6) Verify that typing enter in $z does not submit the form
Comment 6 Kyle M Hall 2019-09-06 10:51:04 UTC
Created attachment 92630 [details] [review]
Bug 23252: Add missing input_marceditor class in item editor

In serials receive and acquisition order creation from iso2709, the item edition form shows inputs that are missing "input_marceditor" class.
They are also missing tabindex and id.

The side effect is that those inputs dont get the "noEnterSubmit" class so form is posted if a barcode scanner is used or if enter is used on keyboard.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify system preference "AcqCreateItem" is on "placing an order"
2)
2.2) Go to cataloguing module and edit an item
2.3) Verify that $z has an id, tabindex and "input_marceditor" class.
2.4) Verify that typing enter in $z does not submit the form
3)
3.1) Go to a serial with items creation, click on receive
3.2) Change status to "Arrived"
3.3) Verify that $z has an id, tabindex and "input_marceditor" class.
3.4) Verify that typing enter in $z does not submit the form
4)
4.1) Go to an acquisition basket
4.2) Click "Add to basket" and "From a staged file"
4.3) Click "Add orders" on a staged file
4.4) Go in tab "Item information"
4.5) Verify that $z has an id, tabindex and "input_marceditor" class.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Kyle M Hall 2019-09-06 10:51:15 UTC
Created attachment 92631 [details] [review]
Bug 23252: Adds noEnterSubmit class in ajax context

In cataloging.js $(document).ready adds noEnterSubmit class.
This does not work in ajax context, it works with $(document).ajaxSuccess.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify 952$z exists in ACQ framework
2)
2.1) Verify system preference "AcqCreateItem" is on "placing an order"
2.2) Go to an acquisition basket
2.3) Click "Add to basket" and "From a new (empty) record"
2.4) Go to "Item" block
2.5) Verify that $z has "noEnterSubmit" class
2.6) Verify that typing enter in $z does not submit the form
3)
3.1) Change system preference "AcqCreateItem" to "receiving an order"
3.2) Go to "Receive shipment"
3.3) Receive an order
3.4) Go to "Item" block
3.5) Verify that $z has "noEnterSubmit" class
3.6) Verify that typing enter in $z does not submit the form

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Bouzid Fergani 2019-09-20 20:14:51 UTC
Created attachment 93050 [details] [review]
Bug 23252: Add missing input_marceditor class in item editor

In serials receive and acquisition order creation from iso2709, the item edition form shows inputs that are missing "input_marceditor" class.
They are also missing tabindex and id.

The side effect is that those inputs dont get the "noEnterSubmit" class so form is posted if a barcode scanner is used or if enter is used on keyboard.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify system preference "AcqCreateItem" is on "placing an order"
2)
2.2) Go to cataloguing module and edit an item
2.3) Verify that $z has an id, tabindex and "input_marceditor" class.
2.4) Verify that typing enter in $z does not submit the form
3)
3.1) Go to a serial with items creation, click on receive
3.2) Change status to "Arrived"
3.3) Verify that $z has an id, tabindex and "input_marceditor" class.
3.4) Verify that typing enter in $z does not submit the form
4)
4.1) Go to an acquisition basket
4.2) Click "Add to basket" and "From a staged file"
4.3) Click "Add orders" on a staged file
4.4) Go in tab "Item information"
4.5) Verify that $z has an id, tabindex and "input_marceditor" class.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Comment 9 Bouzid Fergani 2019-09-20 20:15:05 UTC
Created attachment 93051 [details] [review]
Bug 23252: Adds noEnterSubmit class in ajax context

In cataloging.js $(document).ready adds noEnterSubmit class.
This does not work in ajax context, it works with $(document).ajaxSuccess.

Test plan :
1)
1.1) Verify you have an item subfield linked to items.itemnotes, ie 952$z
1.2) Verify 952$z exists in ACQ framework
2)
2.1) Verify system preference "AcqCreateItem" is on "placing an order"
2.2) Go to an acquisition basket
2.3) Click "Add to basket" and "From a new (empty) record"
2.4) Go to "Item" block
2.5) Verify that $z has "noEnterSubmit" class
2.6) Verify that typing enter in $z does not submit the form
3)
3.1) Change system preference "AcqCreateItem" to "receiving an order"
3.2) Go to "Receive shipment"
3.3) Receive an order
3.4) Go to "Item" block
3.5) Verify that $z has "noEnterSubmit" class
3.6) Verify that typing enter in $z does not submit the form

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Comment 10 Marcel de Rooy 2019-09-27 09:54:16 UTC
$(document).ready(function() {
     $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
+    $(document).ajaxSuccess(function() {
+        $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
+    });
 });

Christophe: I am having the impression that only orderreceive needs this. In the context of cataloging.js and its broader use, it seems to me that adding it closer to the needed location would be better? Please confirm.
Comment 11 Fridolin Somers 2019-09-27 13:25:31 UTC
(In reply to Marcel de Rooy from comment #10)
> $(document).ready(function() {
>      $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
> +    $(document).ajaxSuccess(function() {
> +        $("input.input_marceditor,
> input.indicator").addClass('noEnterSubmit');
> +    });
>  });
> 
> Christophe: I am having the impression that only orderreceive needs this. In
> the context of cataloging.js and its broader use, it seems to me that adding
> it closer to the needed location would be better? Please confirm.

Actually indeed, but for me having all in cataloging.js is better.
Imagine we change the name of the class "input_marceditor".
Or if we change serials receive to use Ajax.

Thanks a lot for your time :)
Comment 12 Katrin Fischer 2019-10-01 10:22:48 UTC
It looks like this is actually a regressen - we fixed it before in bug 8557.
Comment 13 Martin Renvoize 2019-10-02 22:57:41 UTC
This looks solid to me, I've noted Marcelr's comment but believe we're safe here given the responses and a look at the code myself..

Passing QA
Comment 14 Martin Renvoize 2019-10-03 09:32:00 UTC
Nice work!

Pushed to master for 19.11.00
Comment 15 Fridolin Somers 2019-11-08 14:00:50 UTC
Pushed to 19.05.x for 19.05.05