From 56c64f3cf5d9db9b1129b0eb5343013fa6151407 Mon Sep 17 00:00:00 2001
From: jeremy breuillard <jeremy.breuillard@biblibre.com>
Date: Thu, 16 Dec 2021 17:59:03 +0100
Subject: [PATCH] Bug 6734: Show location in serials history table

Opac: On a record(Serials) details the location wasn't displayed on the "Normal view" and "Full history" tabs

Test plan:
1)Intranet: Make sure to have at least two different Serials/Subscriptions on the same record with the field 'location' filled in
2)Opac: Find your Serials/Subscriptions
3)Click 'More details' and notice the 3 tabs : Normal view, Brief history, Full history
4)Go to 'Normal view' and 'Full history' to notice that 'location' is missing
5)Apply patch, refresh your browser & repeat 4)
6)The location is now visible

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 C4/Serials.pm                                                 | 3 ++-
 .../opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt | 3 +++
 .../opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt      | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index d840bf24b7..acc387f4f7 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -471,7 +471,8 @@ sub GetFullSubscriptionsFromBiblionumber {
             year(IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate)) as year,
             biblio.title as bibliotitle,
             subscription.branchcode AS branchcode,
-            subscription.subscriptionid AS subscriptionid
+            subscription.subscriptionid AS subscriptionid,
+            subscription.location AS location
   FROM      serial 
   LEFT JOIN subscription ON 
           (serial.subscriptionid=subscription.subscriptionid)
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt
index deecd07834..31a6cf80cd 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt
@@ -4,6 +4,7 @@
 [% USE AdditionalContents %]
 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
+[% USE AuthorisedValues %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Full subscription history for [% bibliotitle | html %] &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -129,6 +130,7 @@
                                         <tr>
                                             <th>Date</th>
                                             <th>Library</th>
+                                            <th>Location</th>
                                             <th>Notes</th>
                                             <th>Date received</th>
                                             <th>Number</th>
@@ -151,6 +153,7 @@
                                                     [% END %]
                                                 </td>
                                                 <td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) | html %]</td>
+                                                <td>[% AuthorisedValues.GetByCode( 'LOC', serial.location, 1 ) | html %]</td>
                                                 <td>[% serial.notes | html %]</td>
                                                 [% IF ( serial.status2 && serial.planneddate ) %]
                                                     <td data-order="[% serial.planneddate | html %]">
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt
index fcd8a68ad6..3e1c02c968 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt
@@ -1,5 +1,6 @@
 [% USE Koha %]
 [% USE AdditionalContents %]
+[% USE AuthorisedValues %]
 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
 [% INCLUDE 'doc-head-open.inc' %]
@@ -131,6 +132,9 @@
                                     [% END %]
 
                                     <h3>[% subscription_LOO.branchname | html %]</h3>
+                                    [% IF ( subscription_LOO.location ) %]
+                                        <p>Location : <em>[% AuthorisedValues.GetByCode( 'LOC', subscription_LOO.location, 1 ) | html | html_line_break %]</em></p>
+                                    [% END %]
 
                                     [% IF ( subscription_LOO.notes ) %]
                                         <p>[% subscription_LOO.notes | html | html_line_break %]</p>
-- 
2.30.2