Bug 9268 - Scanning in barcode or ISBN in Acquisitions -> new order submits the form...
authorLiz Rea <liz@catalyst.net.nz>
Wed, 12 Dec 2012 01:55:14 +0000 (14:55 +1300)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 31 Jan 2013 16:40:03 +0000 (11:40 -0500)
To Test:

* Go to Acquisitions - Manage Orders
* Search for a vendor
* Click New Basket.
* Fill required fields
* Press Save.
* Click on "From a new (empty) record"
* Type in title Private Oz, Author Patterson, James.
* Scan (or type) ISBN - 9781864711875.
* (If not scanning, PRESS ENTER HERE)
* Nothing should happen. Form should not be submitted, no error message
  should appear.

Sponsored by: Hauraki District Libraries, New Zealand

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan in Firefox and Chromium on Ubuntu.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt

index 5cb6357..536d439 100644 (file)
@@ -7,6 +7,24 @@
 [% INCLUDE 'additem.js.inc' %]
 <script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
 <script type="text/javascript">
+var nav = window.Event ? true : false;
+if (nav) {
+    window.captureEvents(Event.KEYDOWN);
+    window.onkeydown = NetscapeEventHandler_KeyDown;
+} else {
+    document.onkeydown = IEEventHandler_KeyDown;
+}
+
+function NetscapeEventHandler_KeyDown(e) {
+    if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; }
+    return true;
+}
+
+function IEEventHandler_KeyDown() {
+    if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
+        return false;
+    return true;
+}
 //<![CDATA[
 actTotal = "";