Bug 20806: Add item type description holds history page
authorJosef Moravec <josef.moravec@gmail.com>
Tue, 29 May 2018 09:15:09 +0000 (09:15 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 18 Jul 2018 17:01:45 +0000 (17:01 +0000)
Test plan:

0) Do not apply the patch
1) Set AllowHoldItemTypeSelection to Allow
2) Place some hold for a patron, some with specific item type and some
without item type
3) On holds history page you should see blank or item type code in item
type column
4) Apply the patch
5) Now you should see description in item type column
6) Set AllowHoldItemTypeSelection to Don't Allow
7) You shold not see the item type column, but column visibility
settings should continue working ;)

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt

index f2e8ebb..ff19d79 100644 (file)
@@ -4,6 +4,7 @@
 [% USE AuthorisedValues %]
 [% USE Branches %]
 [% USE ColumnsSettings %]
+[% USE ItemTypes %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Holds history for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
@@ -32,6 +33,8 @@
     <div class="dialog message">This patron has no holds history.</div>
 [% ELSE %]
 
+[% SET show_itemtype_column = Koha.Preference('AllowHoldItemTypeSelection') %]
+
 <div id="holdshistory" style="overflow:hidden">
   <table id="table_holdshistory">
       <thead>
@@ -43,7 +46,9 @@
         <th class="title-string">Expiration date</th>
         <th class="title-string">Waiting date</th>
         <th class="title-string">Cancellation date</th>
-        <th>Item type</th>
+        [% IF show_itemtype_column %]
+          <th>Requested item type</th>
+        [% END %]
         <th>Status</th>
       </thead>
       <tbody>
                   <span title="0000-00-00"></span>
               [% END %]
           </td>
-          <td>[% hold.itemtype %]</td>
+          [% IF show_itemtype_column %]
+            <td>
+              [% IF hold.itemtype %]
+                  [% ItemTypes.GetDescription( hold.itemtype ) %]
+              [% ELSE %]
+                  Any item type
+              [% END %]
+            </td>
+          [% END %]
           <td>
           [% IF hold.found == 'F' %]
               Fulfilled
     <script type="text/javascript" id="js">
         $(document).ready(function() {
             var columns_settings = [% ColumnsSettings.GetColumns('members', 'holdshistory', 'holdshistory-table', 'json') %];
+            [% UNLESS show_itemtype_column %]
+              //Remove item type column settings
+              columns_settings.splice(8,1);
+            [% END %]
             var table = KohaTable("table_holdshistory", {
                 "sPaginationType": "four_button",
                 "aaSorting": [[4, 'desc']],