Bug 9268 - Scanning in barcode or ISBN in Acquisitions -> new order submits the form...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
index 2631e3c..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 = "";
 
@@ -90,7 +108,7 @@ function Check(ff) {
 
     [% IF (AcqCreateItemOrdering) %]
         if(check_additem('[% UniqueItemFields %]') == false) {
-            alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
+            alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
             if(tobedeleted) {
                 $(lastitemblock).appendTo('#outeritemblock');
             }
@@ -125,6 +143,7 @@ $(document).ready(function()
                 alert(_("You can't add a new item, please create a new order line"));
                 // and we replace the original value
                 $(this).val([% quantityrec %])
+                updateCosts(); // blur is invoked after change which updated values
                 return false;
             }
         });
@@ -146,7 +165,7 @@ $(document).ready(function()
 //]]>
 </script>
 </head>
-<body id="acq_neworderempty" class="acq" onload="updateCosts()">
+<body id="acq_neworderempty" class="acq">
 
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
@@ -230,7 +249,10 @@ $(document).ready(function()
         <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
         <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
         <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
-        <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
+
+        [% FOREACH loop_currencie IN loop_currencies %]
+            <input type="hidden" id="currency_rate_[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
+        [% END %]
 
         <ol><li>
             [% IF ( biblionumber ) %]