Merge remote branch 'kc/new/bug_5949' into kcmaster
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tmpl
index 1534e75..0eacf19 100644 (file)
@@ -1,5 +1,5 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Acquisitions &rsaquo; Shopping Basket <!-- TMPL_VAR NAME="basketno" --> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></title>
+<title>Koha &rsaquo; Acquisitions &rsaquo; Basket <!-- TMPL_VAR NAME="basketno" --> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
@@ -18,10 +18,15 @@ function Check(ff) {
         ok=1;
                     _alertString += "\n- " + _("Title cannot be empty");
     }
+    
+    if(isNull(ff.budget_id,1)){
+               ok=1;
+                                       _alertString += "\n- "+ _("You must select a budget");
+    }
 
     if (!(isNum(ff.quantity,0))){
         ok=1;
-                    _alertString += "\n- " + _("Quanity must be greater than '0'");
+                    _alertString += "\n- " + _("Quantity must be greater than '0'");
     }
 
     if (!(isNum(ff.listprice,0))){
@@ -36,7 +41,23 @@ function Check(ff) {
 
     if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
         ok=1;
-        _alertString += "\n- " + "Order total (" + ff.total.value + ") exceeds budget available ("+actTotal+")";
+        _alertString += "\n- " + _("Order total (") + ff.total.value +
+            _(") exceeds budget available (") + actTotal+")";
+    }
+
+    if ( ff.field_value ) {
+        var empty_item_mandatory = 0;
+        for (i = 0; i < ff.field_value.length; i++) {
+            //alert("i = " + i + " => " + ff.kohafield[i] );
+            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
+                empty_item_mandatory++;
+            }
+        }
+        if (empty_item_mandatory > 0) {
+            ok = 1;
+            _alertString +=
+                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
+        }
     }
 
 if (ok) {
@@ -48,16 +69,48 @@ ff.submit();
 
 }
 
-
+$(document).ready(function() 
+    {
+        //We apply the fonction only for modify option
+        <!--TMPL_IF NAME="quantityrec"-->
+        $('#quantity').blur(function() 
+        {
+            // if user decreases the quantity
+            if($(this).val() < <!-- TMPL_VAR name="quantityrec" -->) 
+            {
+                alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
+                return true;
+            } 
+            else 
+            {
+                // if user increases the quantity
+                alert(_("You can't add a new item, please create a new order line"));
+                // and we replace the original value
+                $(this).val(<!-- TMPL_VAR name="quantityrec" -->)
+                return false;
+            }
+        });
+        <!-- /TMPL_IF -->
+        
+        $('#showallbudgets').click(function() {
+            if ( $('#budget_id .b_inactive').is(":visible") )
+            {
+            $('#budget_id .b_inactive').hide();
+            }
+            else {
+            $('#budget_id .b_inactive').show();
+            }
+        });
+    });
 //]]>
 </script>
 </head>
-<body onload="calcNeworderTotal()">
+<body>
 
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Shopping Basket <!-- TMPL_VAR NAME="basketno" --></a> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Basket <!-- TMPL_VAR NAME="basketno" --></a> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></div>
 
 <div id="doc3" class="yui-t2">
 
@@ -67,7 +120,7 @@ ff.submit();
 
 <h2>
     <!-- TMPL_IF name="ordernumber" -->
-        Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)
+        Modify order line
     <!-- TMPL_ELSE -->
         New order
     <!-- /TMPL_IF -->
@@ -116,7 +169,12 @@ ff.submit();
 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
 
 <fieldset class="rows">
-        <legend>Catalog details</legend>
+        <legend>
+            Catalog details
+            <!-- TMPL_IF name="biblionumber" -->
+                <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!--TMPL_VAR NAME= "biblionumber"-->"> Edit record</a></span>
+            <!-- /TMPL_IF -->
+        </legend>
         <!-- TMPL_UNLESS name="existing" -->
         <input type="hidden" name="existing" value="no" />
         <!-- /TMPL_UNLESS -->
@@ -127,7 +185,7 @@ ff.submit();
         <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
         <input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
         <input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
-        <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
+<!--        <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />-->
         <input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
         <input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
         <input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
@@ -135,60 +193,60 @@ ff.submit();
         <input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
 
         <!-- TMPL_LOOP NAME="loop_currencies" -->
-            <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
+            <input type="hidden" id="<!-- TMPL_VAR NAME="currcode" -->"  name="<!-- TMPL_VAR NAME="currcode" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
         <!-- /TMPL_LOOP -->
         <ol><li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">Title</span>
-                <input type="hidden" size="20" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="HTML" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" ESCAPE="html" --></span>
+                <input type="hidden" size="50" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="HTML" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" ESCAPE="html" --></span>
             <!-- TMPL_ELSE -->
             <label for="entertitle" class="required">Title: </label>
-                <input type="text" id="entertitle" size="20" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="html" -->" />
+                <input type="text" id="entertitle" size="50" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="html" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">Author: </span>
-                <input type="hidden" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
+                <input type="hidden" size="50" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
             <!-- TMPL_ELSE -->
             <label for="author">Author: </label>
-                <input type="text" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" />
+                <input type="text" size="50" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">Publisher: </span>
-                <input type="hidden" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
+                <input type="hidden" size="50" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
             <!-- TMPL_ELSE -->
             <label for="publishercode"> Publisher: </label>
-                <input type="text" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
+                <input type="text" size="50" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">Publication year: </span>
-                <input type="hidden" size="20" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" /><!-- TMPL_VAR NAME="publicationyear" -->
+                <input type="hidden" size="10" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" /><!-- TMPL_VAR NAME="publicationyear" -->
             <!-- TMPL_ELSE -->
             <label for="publicationyear">Publication year: </label>
-                <input type="text" size="20" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" />
+                <input type="text" size="10" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">ISBN: </span>
-                <input type="hidden" size="20" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
+                <input type="hidden" size="50" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
             <!-- TMPL_ELSE -->
             <label for="ISBN">ISBN: </label>
-                <input type="text" size="20" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
+                <input type="text" size="50" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
             <span class="label">Series: </span>
-                <input type="hidden" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><!-- TMPL_VAR NAME="seriestitle" -->
+                <input type="hidden" size="50" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><!-- TMPL_VAR NAME="seriestitle" -->
             <!-- TMPL_ELSE -->
             <label for="series">Series: </label>
-                <input type="text" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
+                <input type="text" size="50" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
             <!-- /TMPL_IF -->
         </li>
         </ol>
@@ -248,29 +306,44 @@ ff.submit();
             </li>
             <li>
                 <!-- TMPL_IF name="close" -->
-            <span class="label">Budget: </span>
+            <span class="label">Fund: </span>
                     <input type="hidden" size="20" name="budget_id" id="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" /><!-- TMPL_VAR NAME="Budget_name" -->
                 <!-- TMPL_ELSE -->
-                <label for="budget_id">Budget: </label>
+                <label for="budget_id">Fund: </label>
                 <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
                 <!-- TMPL_LOOP NAME="budget_loop" -->
                     <!-- TMPL_IF NAME="b_sel" -->
                         <option value="<!-- TMPL_VAR NAME='b_id' -->" selected="selected"><!-- TMPL_VAR NAME="b_txt" --></option>
                     <!-- TMPL_ELSE -->
-                        <option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
+                        <!-- TMPL_IF NAME="b_active" --><option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
+                        <!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME='b_id' -->" class="b_inactive" style="display : none;"><!-- TMPL_VAR NAME="b_txt" --></option>    
+                        <!-- /TMPL_IF -->
                     <!-- /TMPL_IF -->
                 <!-- /TMPL_LOOP -->
                 </select>
+                <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
+                <input type="checkbox" id="showallbudgets" />
                 <!--/TMPL_IF-->
             </li>
+               <li>
+                <!-- TMPL_IF name="close" -->
+                       <span class="label">Currency: </span>
+                       <input type="hidden" size="10" name="currency" id="currency" value="<!-- TMPL_VAR NAME="currency" -->" /><!-- TMPL_VAR NAME="currency" -->
+                <!-- TMPL_ELSE -->
+                       <label for="currency">Currency:</label>
+                       <select name="currency" id="currency" onchange="calcNeworderTotal();">
+                       <!-- TMPL_LOOP name="loop_currencies" -->
+                       <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="currcode" -->" selected="selected"><!-- TMPL_VAR name="currcode" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="currcode" -->"><!-- TMPL_VAR name="currcode" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
+                       </select>
+               <!-- /TMPL_IF-->
+                </li>
             <li>
                 <!-- TMPL_IF name="close" -->
             <span class="label">Vendor price: </span>
                     <input type="hidden" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
                 <!-- TMPL_ELSE -->
                 <label for="listprice">Vendor price: </label>
-                    <input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" /> (entered as <!-- TMPL_VAR NAME="currency" -->)
-
+                    <input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" />
                 <!--/TMPL_IF-->
             </li>
             <!-- TMPL_UNLESS NAME="close" -->
@@ -334,10 +407,10 @@ ff.submit();
             </li>
             <li>
                 <label for="notes">Notes: </label>
-                <textarea id="notes" cols="30" rows="3" name="notes"><!-- TMPL_VAR NAME="notes" --></textarea>
+                <textarea id="notes" cols="30" rows="3" name="notes" ><!-- TMPL_VAR name="notes"--></textarea>
             </li>
             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
-                <label for="sort1">Planning value1: </label>
+                <label for="sort1">Statistic 1: </label>
 
                 <!-- TMPL_IF Name="CGIsort1" -->
                     <!-- TMPL_VAR Name="CGIsort1" -->
@@ -347,7 +420,7 @@ ff.submit();
                 <!--/TMPL_IF -->
             </li>
             <li>
-                <label for="sort2">Planning value2: </label>
+                <label for="sort2">Statistic 2: </label>
 
                 <!-- TMPL_IF Name="CGIsort2" -->
                     <!-- TMPL_VAR Name="CGIsort2" -->