Bug 4461: Checks on library email before enqueuing letter
authorAleisha Amohia <aleishaamohia@hotmail.com>
Thu, 19 Mar 2020 00:26:33 +0000 (00:26 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 6 Apr 2020 10:18:48 +0000 (11:18 +0100)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

opac/opac-reportproblem.pl

index 4f5ce5e..0df2c73 100755 (executable)
@@ -97,12 +97,13 @@ if ( $op eq 'addreport' ) {
                 my $transport = 'email';
                 my $reply_address = $patron->email || $patron->emailpro || $patron->B_email;
 
-                if ( $recipient eq 'admin' ) {
+                if ( $recipient eq 'library' and defined($library->get_effective_email) and $library->get_effective_email ne C4::Context->preference('KohaAdminEmailAddress') ) {
+                    # the problem report is intended for a librarian and will be received at a library email address
                     C4::Letters::EnqueueLetter({
                         letter                 => $letter,
                         borrowernumber         => $borrowernumber,
                         message_transport_type => $transport,
-                        to_address             => C4::Context->preference('KohaAdminEmailAddress'),
+                        to_address             => $library->get_effective_email,
                         reply_address          => $reply_address,
                     });
                 } else {
@@ -110,7 +111,7 @@ if ( $op eq 'addreport' ) {
                         letter                 => $letter,
                         borrowernumber         => $borrowernumber,
                         message_transport_type => $transport,
-                        to_address             => $library->get_effective_email,
+                        to_address             => C4::Context->preference('KohaAdminEmailAddress'),
                         reply_address          => $reply_address,
                     });
                 }