From e2da2728402e629e1b0f0b293cb2d481e56a13bd Mon Sep 17 00:00:00 2001 From: "J. David Bavousett" Date: Mon, 14 Sep 2009 09:24:36 -0400 Subject: [PATCH] Bug 3619 - C4::Letters::_send_message_by_email does not obey AutoEmailPrimaryAddress This enhancement would cause C4::Letters::_send_message_by_email to obey the syspref. Signed-off-by: Galen Charlton --- C4/Letters.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 78f064ae18..3dc3e528e5 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -821,7 +821,9 @@ sub _send_message_by_email ($;$$$) { status => 'failed' } ); return; } - unless ($to_address = $member->{email}) { # assigment, not comparison + my $which_address = C4::Context->preference('AutoEmailPrimaryAddress'); + $to_address = $member->{$which_address}; + unless ($to_address) { # warn "FAIL: No 'to_address' and no email for " . ($member->{surname} ||'') . ", borrowernumber ($message->{borrowernumber})"; # warning too verbose for this more common case? _set_message_status( { message_id => $message->{'message_id'}, -- 2.39.5