From 41550a880892ab2029daf5c2fad5791f5df36871 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 9 May 2012 12:47:19 -0400 Subject: [PATCH] Bug 5544 - All Notices from Branch Email Address Right now overdues from from the branch, but the others come from the admin email address - this is a problem in multi-branch systems because they have to come up with one email address that all branches have access to. C4::Letters::_send_message_by_email currently sets the from address in the following order: 1) Address specified in message 2) Koha admin email address The order will now be: 1) Address specified in message 2) Borrowers home library email address 3) Koha admin email address --- C4/Letters.pm | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 89213fe..3df6405 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -897,9 +897,10 @@ sub _send_message_by_email ($;$$$) { my $message = shift or return; my ($username, $password, $method) = @_; - my $to_address = $message->{to_address}; + my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} ); + my $branch = GetBranchDetail( $member->{'branchcode'} ); + my $to_address = $message->{'to_address'}; unless ($to_address) { - my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} ); unless ($member) { warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; _set_message_status( { message_id => $message->{'message_id'}, @@ -930,7 +931,7 @@ sub _send_message_by_email ($;$$$) { my $is_html = $content_type =~ m/html/io; my %sendmail_params = ( To => $to_address, - From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'), + From => $message->{'from_address'} || $branch->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'), Subject => $subject, charset => 'utf8', Message => $is_html ? _wrap_html($content, $subject) : $content, -- 1.7.2.5