[Patches] [PATCH] 6302 follow up

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 03:11:11 NZDT 2011


From: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
Date: Wed, 14 Dec 2011 15:54:22 +0100
Subject: [PATCH] 6302 follow up
Content-Type: text/plain; charset="utf-8"

Updates to_address in message queue when sending an email (when needed).
---
 C4/Letters.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/C4/Letters.pm b/C4/Letters.pm
index 862121c..2420e4a 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;
 
-- 
1.6.0.6




More information about the Patches mailing list