From d3e191b9c66806797bce4271a82897780346e8d7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 14 Dec 2011 15:54:22 +0100 Subject: [PATCH] 6302 follow up Updates to_address in message queue when sending an email (when needed). Signed-off-by: Koustubha Kale Signed-off-by: Paul Poulain (cherry picked from commit 2ab11c4892f87c054df02763804e34f070d931e1) Signed-off-by: Chris Nighswonger --- C4/Letters.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 862121cb8a..2420e4a0ec 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -836,8 +836,8 @@ sub _send_message_by_email ($;$$$) { if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) { $sendmail_params{ Bcc } = $bcc; } - + _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated if ( sendmail( %sendmail_params ) ) { _set_message_status( { message_id => $message->{'message_id'}, status => 'sent' } ); @@ -863,6 +863,12 @@ sub _send_message_by_sms ($) { return $success; } +sub _update_message_to_address { + my ($id, $to)= @_; + my $dbh = C4::Context->dbh(); + $dbh->do('UPDATE message_queue SET to_address=? WHERE message_id=?',undef,($to,$id)); +} + sub _set_message_status ($) { my $params = shift or return undef; -- 2.39.5