From 763012a9128d073675386967759edd7848b06077 Mon Sep 17 00:00:00 2001
From: Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
Date: Fri, 5 May 2017 17:24:11 +0200
Subject: [PATCH] Bug 7317: Add branch details to generic emails.

* Koha/Illrequest.pm (generic_confirm): Add a branch details block at
  end of generic email template.
---
 Koha/Illrequest.pm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm
index 82072d8f84..ac0b5d5afc 100644
--- a/Koha/Illrequest.pm
+++ b/Koha/Illrequest.pm
@@ -750,8 +750,22 @@ EOF
 Please let us know if you are able to supply this to us.
 
 Kind Regards
+
 EOF
 
+        my $branch = Koha::Libraries->find($params->{current_branchcode})
+            || die "Invalid current branchcode. Are you logged in as the database user?";
+        my @address = map { $branch->$_ }
+            qw/ branchname branchaddress1 branchaddress2 branchaddress3
+                branchzip branchcity branchstate branchcountry branchphone
+                branchemail /;
+        my $address = "";
+        foreach my $line ( @address ) {
+            $address .= $line . "\n" if $line;
+        }
+
+        $draft->{body} .= $address;
+
         my $partners = Koha::Patrons->search({
             categorycode => $self->_config->partner_code
         });
@@ -774,8 +788,6 @@ EOF
         $to =~ s/\x00/; /;      # Replace others with '; '
         die "No target email addresses found. Either select at least one partner or check your ILL partner library records." if ( !$to );
         # Create the from, replyto and sender headers
-        $branch = Koha::Libraries->find($params->{current_branchcode})
-            || die "Invalid current branchcode. Are you logged in as the database user?";
         my $from = $branch->branchemail;
         my $replyto = $branch->branchreplyto || $from;
         die "Your branch has no email address. Please set it."
-- 
2.11.0