Bug 28581: Use 'from_email_address' where appropriate
This patch replaces a few more trivial cases where we were using library->branchemail with a fallback to KohaAdminEmail to just use the new library->from_email_address method directly instead. There were also a couple of cases where we were passing borrowernumber and the patrons library from address too.. this is unneccesary as the code in _send_email_massage will already default to patron library from address if we do not pass an override. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Added a semicolon. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
7c6575e86a
commit
7c7794f1b2
|
|
@ -1849,7 +1849,7 @@ sub _koha_notify_reserve {
|
|||
|
||||
my $library = Koha::Libraries->find( $hold->branchcode )->unblessed;
|
||||
|
||||
my $admin_email_address = $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress');
|
||||
my $admin_email_address = $library->from_email_address;
|
||||
|
||||
my %letter_params = (
|
||||
module => 'reserves',
|
||||
|
|
|
|||
|
|
@ -1335,7 +1335,7 @@ sub generic_confirm {
|
|||
"No target email addresses found. Either select at least one partner or check your ILL partner library records.")
|
||||
if ( !$to );
|
||||
# Create the from, replyto and sender headers
|
||||
my $from = $branch->branchemail;
|
||||
my $from = $branch->from_email_address;
|
||||
my $replyto = $branch->inbound_ill_address;
|
||||
Koha::Exceptions::Ill::NoLibraryEmail->throw(
|
||||
"Your library has no usable email address. Please set it.")
|
||||
|
|
@ -1427,7 +1427,7 @@ sub send_patron_notice {
|
|||
# Notice should come from the library where the request was placed,
|
||||
# not the patrons home library
|
||||
my $branch = Koha::Libraries->find($self->branchcode);
|
||||
my $from_address = $branch->branchemail;
|
||||
my $from_address = $branch->from_email_address;
|
||||
my $reply_address = $branch->inbound_ill_address;
|
||||
|
||||
# Send the notice to the patron via the chosen transport methods
|
||||
|
|
|
|||
|
|
@ -84,13 +84,13 @@ if ( $op eq 'cancel_reserve' and $reserve_id ) {
|
|||
},
|
||||
);
|
||||
if ( $letter ) {
|
||||
my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress');
|
||||
my $from_address = $library->from_email_address;
|
||||
|
||||
C4::Letters::EnqueueLetter(
|
||||
{ letter => $letter,
|
||||
borrowernumber => $patron->borrowernumber,
|
||||
message_transport_type => 'email',
|
||||
from_address => $admin_email_address,
|
||||
from_address => $from_address,
|
||||
}
|
||||
);
|
||||
unless ( $patron->notice_email_address ) {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ for my $number_of_days (@days) {
|
|||
my $budget = C4::Budgets::GetBudget( $suggestion->{budgetid} );
|
||||
my $patron = Koha::Patrons->find( $budget->{budget_owner_id} );
|
||||
my $email_address = $patron->notice_email_address;
|
||||
my $library = $patron->library;
|
||||
my $admin_email_address = $library->branchemail
|
||||
|| C4::Context->preference('KohaAdminEmailAddress');
|
||||
|
||||
if ($email_address) {
|
||||
say "Patron " . $patron->borrowernumber . " is going to be notified" if $verbose;
|
||||
|
|
@ -70,8 +67,7 @@ for my $number_of_days (@days) {
|
|||
{
|
||||
letter => $letter,
|
||||
borrowernumber => $patron->borrowernumber,
|
||||
message_transport_type => 'email',
|
||||
from_address => $admin_email_address,
|
||||
message_transport_type => 'email'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,8 +469,7 @@ foreach my $branchcode (@branches) {
|
|||
}
|
||||
|
||||
my $library = Koha::Libraries->find($branchcode);
|
||||
my $admin_email_address = $library->branchemail
|
||||
|| C4::Context->preference('KohaAdminEmailAddress');
|
||||
my $admin_email_address = $library->from_email_address;
|
||||
my $branch_email_address = C4::Context->preference('AddressForFailedOverdueNotices')
|
||||
|| $library->inbound_email_address;
|
||||
my @output_chunks; # may be sent to mail or stdout or csv file.
|
||||
|
|
|
|||
|
|
@ -187,9 +187,6 @@ if ( $op =~ /save/i ) {
|
|||
my $patron = Koha::Patrons->find( $suggestion_only->{managedby} );
|
||||
my $email_address = $patron->notice_email_address;
|
||||
if ($patron->notice_email_address) {
|
||||
my $library = $patron->library;
|
||||
my $admin_email_address = $library->branchemail
|
||||
|| C4::Context->preference('KohaAdminEmailAddress');
|
||||
|
||||
my $letter = C4::Letters::GetPreparedLetter(
|
||||
module => 'suggestions',
|
||||
|
|
@ -206,8 +203,7 @@ if ( $op =~ /save/i ) {
|
|||
{
|
||||
letter => $letter,
|
||||
borrowernumber => $patron->borrowernumber,
|
||||
message_transport_type => 'email',
|
||||
from_address => $admin_email_address,
|
||||
message_transport_type => 'email'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue