Merge branch 'bug_8557' into 3.12-master
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / orderreceive.tt
index 821dcd3..e88f9ce 100644 (file)
@@ -4,9 +4,52 @@
 [% 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[
     function Check(form) {
         [% IF (AcqCreateItemReceiving) %]
+            var total_errors=0;
+            $("input[name='mandatory'],select[name='mandatory']").each(function(i){
+                if($(this).val() == 1){
+                    var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i);
+                    if(mandatory_field.val() == ''){
+                        mandatory_field.addClass("missing");
+                        total_errors++;
+                    }
+                }
+            });
+
+            if (total_errors != 0) {
+                var alertString = _("Form not submitted because of the following problem(s)");
+                alertString += "\n------------------------------------------------------------------------------------\n";
+                alertString += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)");
+                alert(alertString);
+                return false;
+            }
+
+            if(check_additem('[% UniqueItemFields %]') == false){
+                alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
+                return false;
+            };
+
             // Remove last itemblock if it is not in items_list
             var lastitemblock = $("#outeritemblock > div:last");
             var tobedeleted = true;
             if(tobedeleted){
                 $(lastitemblock).remove();
             }
-
-            if(check_additem('[% UniqueItemFields %]') == false){
-                alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
-                if(tobedeleted) {
-                    $(lastitemblock).appendTo("#outeritemblock");
-                }
-                return false;
-            };
         [% END %]
 
         return true;
                             <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>
         [% END %]
     [% END %]
     <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
+    <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
     <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
     <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
     <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
     <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
-    <input type="hidden" name="freight" value="[% freight %]" />
-    <input type="hidden" name="gst" value="[% gst %]" />
+    <input type="hidden" name="gstrate" value="[% gstrate %]" />
        </div>
        <div class="yui-u">
     <fieldset class="rows">
             <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" />
         [% END %]</li></ol>
         <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea>
-        <input type="hidden" name="invoice" value="[% invoice %]" />
     </fieldset>
 
 </div>
 </div><div class="yui-g"><fieldset class="action">
-        <input type="submit"  value="Save" />
-        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
+        <input type="submit"  value="Save" class="button" accesskey="w" />
+        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Cancel</a>
 </fieldset></div>    </form>
 [% ELSE %]
-<div id="acqui_acquire_orderlist">
-    <table>
-    <tr>
-        <th>Basket</th>
-        <th>ISBN</th>
-        <th>Title</th>
-        <th>Author</th>
-        <th>Qty</th>
-        <th>Received</th>
-    </tr>
-    [% FOREACH loo IN loop %]
-        <tr>
-            <td>[% loo.basketno %]</td>
-            <td>[% loo.isbn %]</td>
-         <td><a href="orderreceive.pl?datereceived=[% loo.datereceived %]&amp;receive=[% loo.ordernumber %]&amp;biblio=[% loo.biblionumber %]&amp;invoice=[% loo.invoice %]&amp;freight=[% loo.freight %]&amp;gst=[% loo.gst %]&amp;id=[% loo.id %]">[% loo.title |html %]</a></td>
-            <td>[% loo.author %]</td>
-            <td>[% loo.quantity %]</td>
-            <td>[% loo.quantityreceived %]</td>
-        </tr>
-    [% END %]
-    </table>
-</div>
+    This ordernumber does not exist.
 [% END %]
 
 </div>