Bug 10862: (follow-up) fix a couple of issues
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcels.tt
index 616139c..8a4096f 100644 (file)
@@ -1,17 +1,33 @@
+[% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Receive shipment from vendor [% name %]</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
  $(document).ready(function() {
     var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+          { "sType": "title-string", "aTargets" : [ "title-string" ] }
+        ],
         "sPaginationType": "four_button"
     } ) );
+
+    //keep a copy of all budgets before removing the inactives
+    var budgetId = $("#shipmentcost_budgetid");
+    var disabledBudgetsCopy = budgetId.html();
+    $('.b_inactive').remove();
+
+    $('#showallfunds').click(function() {
+        if ($(this).is(":checked")) {
+            budgetId.html(disabledBudgetsCopy); //Puts back all the funds
+        }
+        else {
+            $('.b_inactive').remove();
+        }
+    });
  });
  //]]>
 </script>
 
 [% IF ( error_failed_to_create_invoice ) %]
     <div id="error" class="dialog error">
-        <p>An error has occured. Invoice cannot be created.</p>
+        <p>An error has occurred. Invoice cannot be created.</p>
     </div>
 [% END %]
 <h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1>
 
+    [% IF duplicate_invoices %]
+    <div id="parcels_duplicate_invoice" class="dialog alert">
+        <p>This invoice number has already been used. Would you like to receive on an existing invoice?</p>
+        <table>
+            <thead><tr><th>Invoice no.</th><th>Shipment date</th><th></th></tr></thead>
+            <tbody>
+                [% FOREACH invoice IN duplicate_invoices %]
+                    <tr>
+                        <td>[% invoice.invoicenumber %]</td>
+                        <td>[% invoice.shipmentdate | $KohaDates %]</td>
+                        <td><a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoice.invoiceid %]">Receive</a></td>
+                    </tr>
+                [% END %]
+            </tbody>
+        </table>
+        <form method="get" action="parcels.pl">
+            <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
+            <input type="hidden" name="op" value="confirm" />
+            <input type="hidden" name="invoice" value="[% invoicenumber %]" />
+            <input type="hidden" name="shipmentdate" value="[% shipmentdate %]" />
+            <input type="hidden" name="shipmentcost" value="[% shipmentcost %]" />
+            <input type="hidden" name="shipmentcost_budgetid" value="[% shipmentcost_budgetid %]" />
+            <input type="submit" class="button" value="Create new invoice anyway" />
+        </form>
+    </div>
+    [% END %]
+
+
 [% IF ( count ) %]
 <p> [% count %] shipments</p>
 <div id="resultlist">
@@ -44,7 +88,7 @@
     <thead>
         <tr>
             <th>Line</th>
-            <th>Date received</th>
+            <th class="title-string">Date received</th>
             <th>Invoice number</th>
             <th>Item count</th>
             <th>Biblio count</th>
                 [% searchresult.number %]
             </td>
             <td>
-                [% searchresult.datereceived %]
+                <span title="[% searchresult.datereceived %]">[% searchresult.datereceived | $KohaDates %]</span>
             </td>
             <td>
                 [% IF ( searchresult.code ) %]
             <label for="invoice">Vendor invoice </label>
             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
             <input type="hidden" name="op" value="new" />
-                       <input type="text" size="20" id="invoice" name="invoice" />
+                       <input type="text" size="20" id="invoice" name="invoice" class="focus" />
         </li>
                [% IF ( gst ) %]
         <li>
             <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
         </li>
         <li>
-            <label for="shipmentcost">Shipment cost: </label>
+            <label for="shipmentcost">Shipping cost: </label>
             <input type="text" id="shipmentcost" name="shipmentcost" size="10" />
         </li>
         <li>
-            <label for="shipmentcost_budgetid">Budget: </label>
+            <label for="shipmentcost_budgetid">Fund: </label>
             <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
-                <option value="">No budget</option>
+                <option value="">No fund</option>
                 [% FOREACH budget IN budgets %]
-                    <option value="[% budget.budget_id %]">[% budget.budget_name %]</option>
+                    [% IF ( budget.b_active ) %]
+                        <option value="[% budget.b_id %]">[% budget.b_txt %]</option>
+                    [% ELSE %]
+                        <option value="[% budget.b_id %]" class="b_inactive">[% budget.b_txt %] (inactive)</option>
+                    [% END %]
                 [% END %]
             </select>
+            <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show all:</label>
+            <input type="checkbox" id="showallfunds" />
+
         </li>
                </ol>
     </fieldset>