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 3342c85..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 ) %]
@@ -350,8 +372,8 @@ $(document).ready(function()
                         <th>&nbsp;</th>
                         <th>&nbsp;</th>
                         <th>Barcode</th>
-                        <th>Home branch</th>
-                        <th>Holding branch</th>
+                        <th>Home library</th>
+                        <th>Holding library</th>
                         <th>Not for loan</th>
                         <th>Restricted</th>
                         <th>Location</th>
@@ -451,23 +473,27 @@ $(document).ready(function()
                 [% END %]
             </li>
             [% END %]
-            <li>
-                [% IF ( close ) %]
-                    <span class="label">gstrate: </span>
-                    <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
-                [% ELSE %]
-                    <label for="gst">gstrate: </label>
-                    <select name="gstrate" id="gstrate" onchange="updateCosts();">
-                    [% FOREACH gst IN gst_values %]
-                      [% IF ( gst.option == gstrate ) %]
-                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
-                      [% ELSE %]
-                        <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
-                      [% END %]
+            [% IF ( gst_values ) %]
+                <li>
+                    [% IF ( close ) %]
+                        <span class="label">Tax rate: </span>
+                        <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
+                    [% ELSE %]
+                        <label for="gst">Tax rate: </label>
+                        <select name="gstrate" id="gstrate" onchange="updateCosts();">
+                        [% FOREACH gst IN gst_values %]
+                          [% IF ( gst.option == gstrate ) %]
+                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
+                          [% ELSE %]
+                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
+                          [% END %]
+                        [% END %]
+                        </select>
                     [% END %]
-                    </select>
-                [% END %]
-            </li>
+                [% ELSE %]
+                    <input type="hidden" name="gstrate" value="0" />
+                </li>
+            [% END %]
             <li>
                 <label for="discount">Discount: </label>
                 [% IF ( close ) %]