send an alert to all borrowers having put an alert on a given subject.
+ Returns undef or { error => 'message } on failure.
+ Returns true on success.
+
=cut
sub SendAlerts {
: 'text/plain; charset="utf-8"',
}
);
- sendmail(%mail) or carp $Mail::Sendmail::error;
+ unless( sendmail(%mail) ) {
+ carp $Mail::Sendmail::error;
+ return { error => $Mail::Sendmail::error };
+ }
}
}
elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
if (!@$externalid){
carp "No Order seleted";
- return { error => "no_order_seleted" };
+ return { error => "no_order_selected" };
}
$strsth .= join( ",", @$externalid ) . ")";
. " Content="
. $letter->{content}
) if C4::Context->preference("LetterLog");
- 1;
}
# send an "account details" notice to a newly created user
elsif ( $type eq 'members' ) {
: 'text/plain; charset="utf-8"',
}
);
- sendmail(%mail) or carp $Mail::Sendmail::error;
+ unless( sendmail(%mail) ) {
+ carp $Mail::Sendmail::error;
+ return { error => $Mail::Sendmail::error };
+ }
}
+
+ # If we come here, return an OK status
+ return 1;
}
=head2 GetPreparedLetter( %params )
$err2 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) }
"Fake sendmail",
"SendAlerts is using the mocked sendmail routine";
-is($err2, "", "Successfully sent serial notification");
+is($err2, 1, "Successfully sent serial notification");
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
}