Bug 19429: Rename .delete to .delete_invoice
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / invoices.tt
index b7d9399..20d5edb 100644 (file)
@@ -1,27 +1,38 @@
 [% USE KohaDates %]
+[% USE Branches %]
 
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'datatables.inc' %]
 [% INCLUDE 'calendar.inc' %]
 <script type="text/javascript">
 //<![CDATA[
 $(document).ready(function() {
-    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
-        sDom: "t",
+    $(".delete_invoice").click(function(){
+        return confirmDelete(_("Are you sure you want to delete this invoice?"));
+    });
+
+    var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
         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, -1] },
+            { "bVisible": false, "aTargets": [0] },
+            { "sType": "title-string", "aTargets" : [ "title-string" ] }
         ]
     }));
 
+    $("#show_only_subscription").prop("checked", false);
+
+    $("#show_only_subscription").click(function(){
+        if ( $(this).prop("checked") ) {
+            resultst.fnFilter( "1", 0, true );
+        } else {
+            resultst.fnFilter( '', 0 );
+        }
+    });
+
     $('#merge').click(function (ev) {
         var booksellerid;
         var mismatch;
@@ -60,7 +71,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"));
                     }
@@ -75,7 +86,7 @@ $(document).ready(function() {
 </script>
 </head>
 
-<body>
+<body id="acq_invoices" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
@@ -89,13 +100,19 @@ $(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>
+                <th class="title-string">Shipment date</th>
+                <th class="title-string">Billing date</th>
                 <th>Received biblios</th>
                 <th>Received items</th>
                 <th>Status</th>
@@ -105,10 +122,18 @@ $(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><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]"></input></td>
+                  <td>[% invoice.is_linked_to_subscriptions %]</td>
+                  <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]" /></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>
                   <td>
+                    [% IF invoice.shipmentdate %]
+                      <span title="[% invoice.shipmentdate %]">[% invoice.shipmentdate | $KohaDates %]</span>
+                    [% ELSE %]
+                      <span title="0000-00-00"></span>
+                    [% END %]
+                  </td>
+                  <td>
                     [% IF invoice.billingdate %]
                       <span title="[% invoice.billingdate %]">[% invoice.billingdate | $KohaDates %]</span>
                     [% ELSE %]
@@ -125,15 +150,23 @@ $(document).ready(function() {
                     [% END %]
                   </td>
                   <td>
-                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">Details</a> /
-                    [% IF invoice.closedate %]
-                      <a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
-                    [% ELSE %]
-                      <a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
-                    [% END %]
-                    [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
-                      / <a href="invoice.pl?op=delete&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Delete</a>
-                    [% END %]
+
+                      <div class="dropdown dropup">
+                          <a class="btn btn-default btn-xs dropdown-toggle" id="invoiceactions[% invoice.invoiceid %]" role="button" data-toggle="dropdown" href="#">
+                             Actions <b class="caret"></b>
+                          </a>
+                          <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid %]">
+                              <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]"><i class="fa fa-search"></i> Details</a></li>
+                            [% IF invoice.closedate %]
+                                <li><a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-refresh"></i> Reopen</a></li>
+                            [% ELSE %]
+                                <li><a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-times-circle"></i> Close</a></li>
+                            [% END %]
+                            [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
+                                <li><a href="invoice.pl?op=delete&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]" class="delete_invoice"><i class="fa fa-trash"></i> Delete</a></li>
+                            [% END %]
+                          </ul>
+                      </div>
                   </td>
                 </tr>
               [% END %]
@@ -152,10 +185,10 @@ $(document).ready(function() {
                     </table></li>
                     <li><label for="merge_invoicenumber">Invoice number:</label><span id="merge_invoicenumber"></span></li>
                     <li><label for="merge_shipmentdate">Shipment date:</label>
-                            <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" readonly="readonly" class="datepicker" /></li>
+                            <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
 
                     <li><label for="merge_billingdate">Billing date:</label>
-                            <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" readonly="readonly" class="datepicker" /></li>
+                            <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
 
                     <li><label for="merge_shipmentcost">Shipment cost:</label>
                             <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
@@ -163,8 +196,7 @@ $(document).ready(function() {
                             <select id="merge_shipment_budgetid" name="shipment_budget_id">
                                 <option value="">No fund</option>
                               [% FOREACH budget IN budgets_loop %]
-                                  <option value="[% budget.budget_id %]">
-                                  [% budget.budget_name %]
+                                  <option value="[% budget.budget_id %]">[% budget.budget_name %]
                                   </option>
                               [% END %]
                             </select></li>
@@ -178,48 +210,64 @@ $(document).ready(function() {
                 </form>
             </div>
         [% ELSE %]
-          <p>Sorry, but there is no results for your search.</p>
+          <p>Sorry, but there are no results for your search.</p>
           <p>Search was:
             <ul>
               [% IF ( invoicenumber ) %]
-                <li>Invoice no.: [% invoicenumber %]</li>
+                <li>Invoice no.: [% invoicenumber |html %]</li>
               [% END %]
               [% IF booksellerid %]
                 <li>Vendor: [% suppliername %]</li>
               [% END %]
-              [% IF ( billingdatefrom ) %]
+              [% IF shipmentdatefrom %]
+                <li>Shipment date:
+                [% IF shipmentdateto %]
+                  From [% shipmentdatefrom | $KohaDates %]
+                  To [% shipmentdateto | $KohaDates %]
+                [% ELSE %]
+                  All since [% shipmentdatefrom | $KohaDates %]
+                [% END %]
+                </li>
+              [% ELSE %]
+                [% IF shipmentdateto %]
+                  <li>Shipment date:
+                    All until [% shipmentdateto | $KohaDates %]
+                  </li>
+                [% END %]
+              [% END %]
+              [% IF billingdatefrom %]
                 <li>Billing date:
-                [% IF ( billingdateto ) %]
-                  From [% billingdatefrom %]
-                  To [% billingdateto %]
+                [% IF billingdateto %]
+                  From [% billingdatefrom | $KohaDates %]
+                  To [% billingdateto | $KohaDates %]
                 [% ELSE %]
-                  All since [% billingdatefrom %]
+                  All since [% billingdatefrom | $KohaDates %]
                 [% END %]
                 </li>
               [% ELSE %]
-                [% IF ( billingdateto ) %]
+                [% IF billingdateto %]
                   <li>Billing date:
-                    All until [% billingdateto %]
+                    All until [% billingdateto | $KohaDates %]
                   </li>
                 [% END %]
               [% END %]
               [% IF ( isbneanissn ) %]
-                <li>ISBN/EAN/ISSN: [% isbneanissn %]</li>
+                <li>ISBN/EAN/ISSN: [% isbneanissn |html %]</li>
               [% END %]
               [% IF ( title ) %]
-                <li>Title: [% title %]</li>
+                <li>Title: [% title |html %]</li>
               [% END %]
               [% IF ( author ) %]
-                <li>Author: [% author %]</li>
+                <li>Author: [% author |html %]</li>
               [% END %]
               [% IF ( publisher ) %]
-                <li>Publisher: [% publisher %]</li>
+                <li>Publisher: [% publisher |html %]</li>
               [% END %]
               [% IF ( publicationyear ) %]
-                <li>Publication year: [% publicationyear %]</li>
+                <li>Publication year: [% publicationyear |html %]</li>
               [% END %]
               [% IF ( branch ) %]
-                <li>Library: [% branchname %]</li>
+                <li>Library: [% Branches.GetName( branch ) %]</li>
               [% END %]
             </ul>
           </p>
@@ -236,7 +284,7 @@ $(document).ready(function() {
         <ol>
           <li>
             <label for="invoicenumber">Invoice no:</label>
-            <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" class="focus" />
+            <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber |html %]" class="focus" />
           </li>
           <li>
             <label for="supplier">Vendor:</label>
@@ -257,11 +305,11 @@ $(document).ready(function() {
               <ol>
                 <li>
                   <label for="shipmentdatefrom">From:</label>
-                  <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom %]" class="datepicker" />
+                  <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
                 </li>
                 <li>
                   <label for="shipmentdateto">To:</label>
-                  <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto %]" class="datepicker" />
+                  <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
                 </li>
               </ol>
             </fieldset>
@@ -272,46 +320,41 @@ $(document).ready(function() {
               <ol>
                 <li>
                   <label for="billingdatefrom">From:</label>
-                  <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" class="datepicker" />
+                  <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
                 </li>
                 <li>
                   <label for="billingdateto">To:</label>
-                  <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" class="datepicker" />
+                  <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
                 </li>
               </ol>
             </fieldset>
           </li>
           <li>
             <label for="isbneanissn">ISBN / EAN / ISSN:</label>
-            <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn %]" />
+            <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn |html %]" />
           </li>
           <li>
             <label for="title">Title:</label>
-            <input type="text" id="title" name="title" value="[% title %]" />
+            <input type="text" id="title" name="title" value="[% title |html %]" />
           </li>
           <li>
             <label for="author">Author:</label>
-            <input type="text" id="author" name="author" value="[% author %]" />
+            <input type="text" id="author" name="author" value="[% author |html %]" />
           </li>
           <li>
             <label for="publisher">Publisher:</label>
-            <input type="text" id="publisher" name="publisher" value="[% publisher %]" />
+            <input type="text" id="publisher" name="publisher" value="[% publisher |html %]" />
           </li>
           <li>
             <label for="publicationyear">Publication year:</label>
-            <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" />
+            <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear |html %]" />
           </li>
           <li>
             <label for="branch">Library:</label>
             <select id="branch" name="branch">
               <option value="">All</option>
-              [% FOREACH branch IN branches_loop %]
-                [% IF ( branch.selected ) %]
-                  <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
-                [% ELSE %]
-                  <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
-                [% END %]
-              [% END %]
+              [%# FIXME Should not we filter the libraries %]
+              [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
             </select>
           </li>
         </ol>