[Koha-patches] [PATCH] 6302 follow up

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Thu Dec 15 09:06:39 CET 2011


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 Koha-patches mailing list