From 4a30bccba9f421c3129f7976fdb07a698e19196d Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Wed, 22 Jul 2009 18:07:30 +0100 Subject: [PATCH] Stop generation of unnecessary warning messages to log over undef values Signed-off-by: Galen Charlton Signed-off-by: Henri-Damien LAURENT --- C4/Letters.pm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 86c2a69fe0..469627d33c 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -400,18 +400,26 @@ sub SendAlerts { # ... then send mail if ( $databookseller->{bookselleremail} - || $databookseller->{contemail} ) - { + || $databookseller->{contemail} ) { + my $mail_to = $databookseller->{bookselleremail}; + if ($databookseller->{contemail}) { + if (!$mail_to) { + $mail_to = $databookseller->{contemail}; + } else { + $mail_to .= q|,|; + $mail_to .= $databookseller->{contemail}; + } + } + my $mail_subj = $innerletter->{title}; + my $mail_msg = $innerletter->{content}; + $mail_msg ||= q{}; + $mail_subj ||= q{}; + my %mail = ( - To => $databookseller->{bookselleremail} - . ( - $databookseller->{contemail} - ? "," . $databookseller->{contemail} - : "" - ), + To => $mail_to, From => $userenv->{emailaddress}, - Subject => "" . $innerletter->{title}, - Message => "" . $innerletter->{content}, + Subject => $mail_subj, + Message => $mail_msg, 'Content-Type' => 'text/plain; charset="utf8"', ); sendmail(%mail); -- 2.39.5