@@ -, +, @@ list the to_address field. SQL query again. concatenated by , in the to_address field. be able to confirm the delivery to multiple addresses). queued notices from above. notice. - Set up an App password for your Google Account - Configure a new 'SMTP Server' under 'Administration > SMTP servers' using the following settings where `User name` = your Google email address and `Password` = your APP password, not your Google account password): Host: smtp.gmail.com Port: 587 Timeout: 120 SSL: STARTTLS User name: GOOGLEACCOUNTUSER Password: GOOGLEAPPPASSWORD - Set this server as default --- Koha/Patron.pm | 15 +++++++++++---- t/db_dependent/Koha/Patron.t | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -1619,12 +1619,19 @@ sub notice_email_address{ my ( $self ) = @_; my $which_address = C4::Context->preference("EmailFieldPrimary"); - # if syspref is set to 'first valid' (value == OFF), look up email address - if ( $which_address eq 'OFF' ) { - return $self->first_valid_email_address; + my @addresses; + for my $email_field ( split ",", $which_address ) { + + # if syspref is set to 'first valid' (value == OFF), look up email address + if ( $email_field eq 'OFF' ) { + return $self->first_valid_email_address; + } + + my $email_address = $self->$email_field; + push @addresses, $email_address if $email_address; } - return $self->$which_address || ''; + return join(",",@addresses); } =head3 first_valid_email_address --- a/t/db_dependent/Koha/Patron.t +++ a/t/db_dependent/Koha/Patron.t @@ -1790,7 +1790,7 @@ subtest 'notify_library_of_registration()' => sub { }; subtest 'notice_email_address' => sub { - plan tests => 2; + plan tests => 3; $schema->storage->txn_begin; my $patron = $builder->build_object({ class => 'Koha::Patrons' }); @@ -1802,6 +1802,9 @@ subtest 'notice_email_address' => sub { t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'emailpro' ); is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is emailpro"); + t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'email,emailpro' ); + is ($patron->notice_email_address, $patron->email.",".$patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is email|emailpro"); + $patron->delete; $schema->storage->txn_rollback; }; --