Bug 22566: Clarify intent of reports and add warnings

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4e4f0b637c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2019-06-18 14:24:27 +01:00 committed by Fridolin Somers
parent 0bf47532e6
commit 4e31d54c9b
1 changed files with 9 additions and 8 deletions

View File

@ -166,6 +166,11 @@ exit 1 unless ($ok);
$send_email++ if ($send_all); # if we send all, then we must want emails.
if ( $send_email && !$admin_email && ($report eq 'full')) {
printf("Sending the full report by email requires --admin-email.\n");
exit 1;
}
=head2 Helpers
=head3 execute
@ -441,14 +446,12 @@ sub emit {
# We have a report to send, or we want to send even empty
# reports.
# Send to branch
# Select email address to send to
my $addressee;
if ( $part->{email_address} ) {
$addressee = $part->{email_address};
}
elsif ( !$part->{no_branch_email} ) {
#push @emails, "***We tried to send a branch report, but we have no email address for this branch.***\n\n";
$addressee = C4::Context->preference('KohaAdminEmailAddress')
if ( C4::Context->preference('KohaAdminEmailAddress') );
}
@ -476,17 +479,15 @@ sub emit {
}
)
or warn
"can't enqueue letter $part->{letter} for $params->{admin_email}";
"can't enqueue letter $part->{letter} for $params->{admin_email}";
}
}
else {
$addressee ||=
defined( $params->{admin_email} )
? $params->{admin_email} . "\n"
: 'No recipient found' . "\n";
my $email =
"-------- Email message --------" . "\n\n";
$email .= "To: $addressee\n";
$email .= "Cc: " . $params->{admin_email} . "\n"
if ( $params->{admin_email} );
$email .= "Subject: "
. $part->{letter}->{title} . "\n\n"
. $part->{letter}->{content};