Bug 24726: Update overdue_notices to use inbound_email_address
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 25 Feb 2020 13:20:18 +0000 (13:20 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 19 Mar 2020 09:34:34 +0000 (09:34 +0000)
This patch updates the overdue_notices functionality to use the
inbound_email_address method to obtain the correct email address
for a branch.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

misc/cronjobs/overdue_notices.pl

index 75fd593..8b4fd7e 100755 (executable)
@@ -455,6 +455,7 @@ foreach my $branchcode (@branches) {
     my $library             = Koha::Libraries->find($branchcode);
     my $admin_email_address = $library->branchemail
       || C4::Context->preference('KohaAdminEmailAddress');
+    my $branch_email_address = $library->inbound_email_address;
     my @output_chunks;    # may be sent to mail or stdout or csv file.
 
     $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
@@ -821,7 +822,7 @@ END_SQL
                 borrowernumber         => undef,
                 message_transport_type => 'email',
                 attachments            => [$attachment],
-                to_address             => $admin_email_address,
+                to_address             => $branch_email_address,
             }
         ) unless $test_mode;
     }