Bug 21432: (bug 20899 follow-up) Fix patron's name display for deleted patrons
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / issuehistory.tt
index 0d3c01d..215b40d 100644 (file)
@@ -1,12 +1,14 @@
+[% USE raw %]
 [% USE Asset %]
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE Branches %]
+[% USE ColumnsSettings %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Catalog &rsaquo; Checkout history for [% biblio.title |html %]</title>
+<title>Koha &rsaquo; Catalog &rsaquo; Checkout history for [% biblio.title | html %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% Asset.css("css/datatables.css") %]
+[% Asset.css("css/datatables.css") | $raw %]
 </head>
 
 <body id="catalog_issuehistory" class="catalog">
@@ -14,7 +16,7 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo; Checkout history for <i>[% biblio.title |html %]</i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo; Checkout history for <i>[% biblio.title | html %]</i></div>
 
 <div id="doc3" class="yui-t2">
 
        <div id="yui-main">
        <div class="yui-b">
 
-<h1>Checkout history for [% biblio.title |html %]</h1>
-[% IF biblio.author %]<h3>by [% biblio.author %]</h3>[% END %]
+<h1>Checkout history for [% biblio.title | html %]</h1>
+[% IF biblio.author %]<h3>by [% biblio.author | html %]</h3>[% END %]
+
+[% SET show_patron_column = Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %]
 
 <div class="searchresults">
-    [% IF checkouts.count %]
-        <h4>Checked out [% checkouts.count %] times</h4>
+    [% IF checkouts %]
+        <h4>Checked out [% checkouts.size | html %] times</h4>
         <table id="table_issues">
             <thead><tr>
-            [% IF Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %]
+            [% IF show_patron_column %]
             <th>Patron</th>
             [% END %]
             <th>Barcode</th>
             <tbody>
         [% FOREACH checkout IN checkouts %]
             <tr>
-                [% IF Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %]
-                <td>[% INCLUDE 'patron-title.inc' patron => checkout.patron hide_patron_infos_if_needed=1 %]</td>
+                [% IF show_patron_column %]
+                    <td>
+                        [% IF checkout.patron %][%# Not set for deleted patron records %]
+                            [% INCLUDE 'patron-title.inc' patron => checkout.patron hide_patron_infos_if_needed=1 %]
+                        [% END %]
+                    </td>
                 [% END %]
                 <td>
                     [% IF checkout.item.barcode %] [%# FIXME This test is not mandatory I think %]
-                        <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout.item.biblionumber %]&amp;itemnumber=[% checkout.item.itemnumber %]">[% checkout.item.barcode %]</a>
+                        <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout.item.biblionumber | html %]&amp;itemnumber=[% checkout.item.itemnumber | html %]">[% checkout.item.barcode | html %]</a>
                     [% ELSE %]
                         &nbsp;
                     [% END %]</td>
                 <td>[% IF checkout.branchcode %]
-                        [% Branches.GetName( checkout.branchcode ) %]
+                        [% Branches.GetName( checkout.branchcode ) | html %]
                     [% ELSE %]
                         &nbsp;
                     [% END %]</td>
                 <td>[% IF checkout.renewals %]
-                        Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates with_hours => 1  %]</small>
+                        Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates with_hours => 1 | html %]</small>
                             [% END %]
                     [% ELSE %]
                         No
                     [% END %]</td>
                 <td>[% IF checkout.issuedate %]
-                        <span title="[% checkout.issuedate %]">[% checkout.issuedate |$KohaDates with_hours => 1  %]</span>
+                        <span title="[% checkout.issuedate | html %]">[% checkout.issuedate |$KohaDates with_hours => 1 | html %]</span>
                     [% ELSE %]
                         <span title="0000-00-00"></span>
                     [% END %]</td>
                 <td>[% IF checkout.date_due %]
-                        <span title="[% checkout.date_due %]">[% checkout.date_due |$KohaDates with_hours => 1  %]</span>
+                        <span title="[% checkout.date_due | html %]">[% checkout.date_due |$KohaDates with_hours => 1 | html %]</span>
                     [% ELSE %]
                         <span title="0000-00-00"></span>
                     [% END %]</td>
                 <td>[% IF checkout.returndate %]
-                        <span title="[% checkout.returndate %]">[% checkout.returndate |$KohaDates with_hours => 1  %]</span>
+                        <span title="[% checkout.returndate | html %]">[% checkout.returndate |$KohaDates with_hours => 1 | html %]</span>
                     [% ELSE %]
                         <span title="Checked out"><small>Checked out</small></span>
                     [% END %]</td>
@@ -84,7 +92,7 @@
                </table>
     [% ELSE %]
         <div class="dialog message"><p>
-        <b>[% biblio.title |html %][% IF biblio.author %], by [% biblio.author %][% END %]</b> has never been checked out.</p></div>
+        <b>[% biblio.title | html %][% IF biblio.author %], by [% biblio.author | html %][% END %]</b> has never been checked out.</p></div>
 
     [% END %]
 </div>
 
 [% MACRO jsinclude BLOCK %]
 [% INCLUDE 'datatables.inc' %]
+[% INCLUDE 'columns_settings.inc' %]
     <script type="text/javascript" id="js">
         $(document).ready(function() {
-            $("#table_issues").dataTable($.extend(true, {}, dataTablesDefaults, {
+            var columns_settings = [% ColumnsSettings.GetColumns('catalogue', 'detail', 'checkoutshistory-table', 'json') %];
+            [% UNLESS show_patron_column %]
+            // Remove the patron column definition
+            columns_settings.splice(0,1);
+            [% END %]
+            var table = KohaTable("table_issues", {
                 "aoColumnDefs": [
                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
                 ],
+                "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
                 "aaSorting": [[ 4, "desc" ]],
                 "sPaginationType": "full_numbers"
-            }));
+            }, columns_settings);
         });
     </script>
 [% END %]