Bug 10862: (follow-up) fix a couple of issues
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcels.tt
index fb937f0..8a4096f 100644 (file)
@@ -1,9 +1,38 @@
+[% 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' %]
+[% 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>
 </head>
-<body>
+<body id="acq_parcels" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
    <div id="bd">
        <div id="yui-main">
        <div class="yui-b">
-       
+
+[% IF ( error_failed_to_create_invoice ) %]
+    <div id="error" class="dialog error">
+        <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">
 <!-- Search Results Table -->
 
-<table class="small">
+<table class="small" id="parcelst">
+    <thead>
         <tr>
             <th>Line</th>
-            <th>Date Received</th>
-            <th>Invoice Number</th>
-            <th>Item Count</th>
+            <th class="title-string">Date received</th>
+            <th>Invoice number</th>
+            <th>Item count</th>
             <th>Biblio count</th>
             <th>Items expected</th>
         </tr>
-<!-- Actual Search Results -->
-[% FOREACH searchresult IN searchresults %]
-    [% UNLESS ( loop.odd ) %]
-    <tr class="highlight">
-    [% ELSE %]
-    <tr>
+    </thead>
+    <tbody>
+    <!-- Actual Search Results -->
+    [% FOREACH searchresult IN searchresults %]
+        [% UNLESS ( loop.odd ) %]
+        <tr class="highlight">
+        [% ELSE %]
+        <tr>
+        [% END %]
+            <td>
+                [% searchresult.number %]
+            </td>
+            <td>
+                <span title="[% searchresult.datereceived %]">[% searchresult.datereceived | $KohaDates %]</span>
+            </td>
+            <td>
+                [% IF ( searchresult.code ) %]
+                    <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% searchresult.invoiceid %]">[% searchresult.code %]</a>
+                [% ELSE %]
+                    <acronym title="not available">n/a</acronym>
+                [% END %]
+            </td>
+            <td>
+                [% searchresult.reccount %]
+            </td>
+            <td>
+                [% searchresult.bibcount %]
+            </td>
+            <td>
+                [% searchresult.itemcount %]
+            </td>
+        </tr>
     [% END %]
-        <td>
-            [% searchresult.number %]
-        </td>
-        <td>
-            <a href="/cgi-bin/koha/acqui/parcel.pl?type=intra&amp;booksellerid=[% booksellerid |url %]&amp;datereceived=[% searchresult.raw_datereceived |url %][% IF ( searchresult.code ) %]&amp;invoice=[% searchresult.code |url %][% END %]">
-                [% searchresult.datereceived %]</a>
-        </td>
-        <td>
-            [% IF ( searchresult.code ) %][% searchresult.code %][% ELSE %]<acronym title="not available">n/a</acronym>[% END %]
-        </td>
-        <td>
-            [% searchresult.reccount %] 
-        </td>
-        <td>
-            [% searchresult.bibcount %]
-        </td>
-        <td>
-            [% searchresult.itemcount %]
-        </td>
-    </tr>
-[% END %]
+    </tbody>
 </table>
 
 <div id="resultnumber">
 [% END %]
 
     <div id="parcels_new_parcel">
-        <form method="get" action="parcel.pl">
+        <form method="get" action="parcels.pl">
     <fieldset class="rows">
     <legend>Receive a new shipment</legend>
        <ol> <li>
-            <label for="invoice">Vendor Invoice </label>
+            <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>
             <label for="freight">Shipping:</label>
             <input type="text" size="20" id="freight" name="freight" />
         </li> -->
-         <li><label for="datereceived">Shipment date: </label>
-            <input type="text" id="datereceived" name="datereceived"  maxlength="10" size="10"  value="[% datereceived_today %]" />
-            <img src="[% themelang %]/lib/calendar/cal.gif" id="datereceived_button" alt="Show Calendar" />
-      <script language="JavaScript" type="text/javascript">
-        Calendar.setup(
-          {
-            inputField : "datereceived",
-            ifFormat : "[% DHTMLcalendar_dateformat %]",
-            button : "datereceived_button"          }
-        );
-      </script>
-                               <div class="hint">[% INCLUDE 'date-format.inc' %]</div> </li>
+         <li>
+            <label for="shipmentdate">Shipment date: </label>
+            <input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today %]" class="datepicker" />
+            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+        </li>
+        <li>
+            <label for="shipmentcost">Shipping cost: </label>
+            <input type="text" id="shipmentcost" name="shipmentcost" size="10" />
+        </li>
+        <li>
+            <label for="shipmentcost_budgetid">Fund: </label>
+            <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
+                <option value="">No fund</option>
+                [% FOREACH budget IN budgets %]
+                    [% 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>
             <fieldset class="action"><input type="submit" class="button" value="Next" /> <a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">Cancel</a></fieldset>
             <li><label for="datefrom">From:</label><input type="text" size="9" id="datefrom" name="datefrom" value="[% datefrom %]" /><br /> 
                 <label for="dateto">To:</label><input type="text" size="9" id="dateto" name="dateto" value="[% dateto %]" /></li>
             <li><label for="orderby">Sort by :</label><select name="orderby" id="orderby">
-                <option value="aqorders.booksellerinvoicenumber">Invoice number</option>
-                <option value="datereceived"> Date Received</option>
-                <option value="datereceived desc"> Date Received reverse</option>
-                <option value="aqorders.booksellerinvoicenumber desc"> Invoice number reverse</option>
+                <option value="invoicenumber">Invoice number</option>
+                <option value="shipmentdate">Shipment date</option>
+                <option value="shipmentdate desc">Shipment date reverse</option>
+                <option value="invoicenumber desc">Invoice number reverse</option>
                 </select><br />
                 <label for="resultsperpage">Results per page :</label><select name="resultsperpage" id="resultsperpage">
                 <option value="20">20</option>