From 6882a6a9332a722fba30adba7879c07d67d30bcd Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Wed, 14 Feb 2018 14:24:59 +0100
Subject: [PATCH] Bug 20194: Display both itemtypes in checkin table

And move ccode in its own column

Test plan:
1. Check in an item and verify that both itemtypes are displayed in the
   table
---
 circ/returns.pl                                    |  3 +-
 .../intranet-tmpl/prog/en/modules/circ/returns.tt  | 33 ++++++++++++++++++++--
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/circ/returns.pl b/circ/returns.pl
index bd30f5cb64..8286c292d4 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -601,7 +601,8 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
         $ri{itemauthor}          = $biblio->author;
         $ri{itemcallnumber}      = $item->itemcallnumber;
         $ri{dateaccessioned}     = $item->dateaccessioned;
-        $ri{itemtype}            = $item->effective_itemtype;
+        $ri{itemtype}            = Koha::ItemTypes->find($item->biblioitem->itemtype);
+        $ri{itype}               = Koha::ItemTypes->find($item->itype);
         $ri{itemnote}            = $item->itemnotes;
         $ri{itemnotes_nonpublic} = $item->itemnotes_nonpublic;
         $ri{ccode}               = $item->ccode;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
index 62878d64dd..3f7433b6e0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -628,8 +628,25 @@
 [% IF ( riloop ) %]
     <h2>Checked-in items</h2>
     <table id="checkedintable">
-    <thead><tr><th class="ci-duedate">Due date</th><th class="ci-title">Title</th><th class="ci-author">Author</th><th class="ci-barcode">Barcode</th><th class="ci-homelibrary">Home library</th><th class="ci-holdinglibrary">Holding library</th><th class="ci-shelvinglocation">Shelving location</th><th class="ci-callnumber">Call number</th><th class="ci-dateaccessioned">Date acquired</th><th class="ci-type">Type</th><th class="ci-patron">Patron</th><th class="ci-note">Note</th></tr></thead>
-
+        <thead>
+            <tr>
+                <th class="ci-duedate">Due date</th>
+                <th class="ci-title">Title</th>
+                <th class="ci-author">Author</th>
+                <th class="ci-barcode">Barcode</th>
+                <th class="ci-homelibrary">Home library</th>
+                <th class="ci-holdinglibrary">Holding library</th>
+                <th class="ci-shelvinglocation">Shelving location</th>
+                <th class="ci-callnumber">Call number</th>
+                <th class="ci-dateaccessioned">Date acquired</th>
+                <th class="ci-type">Item type</th>
+                <th class="ci-ccode">Collection</th>
+                <th class="ci-patron">Patron</th>
+                <th class="ci-note">Note</th>
+            </tr>
+        </thead>
+
+        <tbody>
         [% FOREACH riloo IN riloop %]
             <tr>
             <td class="ci-duedate">[% IF ( riloo.duedate ) %]
@@ -655,7 +672,16 @@
             <td class="ci-shelvinglocation">[% riloo.location %]</td>
             <td class="ci-callnumber">[% riloo.itemcallnumber %]</td>
             <td class="ci-dateaccessioned">[% riloo.dateaccessioned | $KohaDates %]</td>
-            <td class="ci-type">[% ItemTypes.GetDescription( riloo.itemtype ) %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) %]</td>
+            <td class="ci-type">
+                [% IF riloo.itemtype %]
+                    [% riloo.itemtype.translated_description %]
+                    <br>
+                [% END %]
+                [% IF riloo.itype %]
+                    [% riloo.itype.translated_description %]
+                [% END %]
+            </td>
+            <td class="ci-ccode">[% AuthorisedValues.GetByCode('CCODE', riloo.ccode) %]</td>
             <td class="ci-patron">[% IF ( riloo.duedate ) %]
                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% riloo.borrowernumber %]">
                     [% riloo.borsurname %], [% riloo.borfirstname %] ([% riloo.borcategorycode %])
@@ -676,6 +702,7 @@
             </td>
            </tr>
         [% END %]
+        </tbody>
     </table>
 [% END %]
 </div>
-- 
2.14.2