Bug 10862: (follow-up) fix a couple of issues
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / invoices.tt
index b7d9399..7bfef8c 100644 (file)
@@ -9,19 +9,29 @@
 <script type="text/javascript">
 //<![CDATA[
 $(document).ready(function() {
-    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
+    var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
         sDom: "t",
         bPaginate: false,
-        bFilter: false,
         bInfo: false,
         "aoColumns": [
             null,null,null,{ "sType": "title-string" },null,null,null,null
         ],
         aoColumnDefs: [
-            { "bSortable": false, "aTargets": [0, 7] }
+            { "bSortable": false, "aTargets": [1, 8] },
+            { "bVisible": false, "aTargets": [0] }
         ]
     }));
 
+    $("#show_only_subscription").attr("checked", false);
+
+    $("#show_only_subscription").click(function(){
+        if ( $(this).attr("checked") ) {
+            resultst.fnFilter( "1", 0, true );
+        } else {
+            resultst.fnFilter( '', 0 );
+        }
+    });
+
     $('#merge').click(function (ev) {
         var booksellerid;
         var mismatch;
@@ -60,7 +70,7 @@ $(document).ready(function() {
                         $('#merge_' + prop).val(invoice[prop]);
                     });
                     if (invoice.closedate) {
-                        $('#merge_status').text(_("Closed on " + invoice.closedate + ""));
+                        $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
                     } else {
                         $('#merge_status').text(_("Open"));
                     }
@@ -89,10 +99,15 @@ $(document).ready(function() {
       <h1>Invoices</h1>
       [% IF ( do_search ) %]
         [% IF invoices %]
+          <label for="show_only_subscription">
+            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
+            Show only subscriptions
+          </label>
           <table id="resultst">
             <thead>
               <tr>
                 <th>&nbsp;</th>
+                <th>&nbsp;</th>
                 <th>Invoice no.</th>
                 <th>Vendor</th>
                 <th>Billing date</th>
@@ -105,6 +120,7 @@ $(document).ready(function() {
             <tbody>
               [% FOREACH invoice IN invoices %]
                 <tr data-invoiceid="[% invoice.invoiceid %]" data-booksellerid="[% invoice.booksellerid %]" data-shipmentdate="[% invoice.shipmentdate | $KohaDates %]" data-billingdate="[% invoice.billingdate | $KohaDates %]" data-shipmentcost="[% invoice.shipmentcost %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid %]" data-closedate="[% invoice.closedate | $KohaDates %]">
+                  <td>[% invoice.is_linked_to_subscriptions %]</td>
                   <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]"></input></td>
                   <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">[% invoice.invoicenumber %]</a></td>
                   <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid %]">[% invoice.suppliername %]</a></td>