From f64203eb17b57537ec59ea7352d34e8fb160031d Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Mon, 31 Aug 2020 16:35:10 -0300
Subject: [PATCH] Bug 26327: Include transacting library in fines

This patch introduces a new column on the fines table to display the
checkout library when the fine is tied to a checkout.

To test:
1. Have an overdue item that generated a fee
2. Look at the 'Accounting' tab, 'Make a payment'
=> FAIL: There's no information about the library
3. Apply this patch
4. Restart all
5. Reload and repeat 2
=> SUCCESS: There's a column with the library name!
6. Identify the issue_id for the mentioned checkout and:
   $ koha-mysql kohadev
   > UPDATE old_issues SET branchcode='TOM' WHERE issue_id=11;
  (i.e. set the branchcode to an invalid value, to emulate a deleted
   branch).
7. Reload
=> SUCCESS: It doesn't explode, it doesn't display a library name.
8. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
index fa6c6460533..c66aecbf2df 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
@@ -53,6 +53,7 @@
     <th>Due date</th>
     <th>Checkin date</th>
     <th>Checkout date</th>
+    <th class="checked_out_from">Checked out from</th>
     <th class="NoSort">Payment note</th>
     <th>Amount</th>
     <th>Amount outstanding</th>
@@ -112,6 +113,11 @@
             [% line.checkout.issuedate | $KohaDates %]
         [% END %]
     </td>
+    <td class="checked_out_from">
+        [% IF line.issue_id && line.checkout.library %]
+            [% line.checkout.library.branchname | html %]
+        [% END %]
+    </td>
     <td class="actions">
         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
         <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none"><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-remove"></i></a></span>
@@ -124,7 +130,7 @@
 
 <tfoot>
     <tr>
-        <td class="total" colspan="11">Total due:</td>
+        <td class="total" colspan="12">Total due:</td>
         <td style="text-align: right;">[% total | $Price %]</td>
     </tr>
     [% IF outstanding_credits.total_outstanding < 0 %]
-- 
2.28.0