View | Details | Raw Unified | Return to bug 22823
Collapse All | Expand All

(-)a/Koha/Library.pm (-3 / +3 lines)
Lines 65-79 sub get_effective_marcorgcode { Link Here
65
    return $self->marcorgcode || C4::Context->preference("MARCOrgCode");
65
    return $self->marcorgcode || C4::Context->preference("MARCOrgCode");
66
}
66
}
67
67
68
=head3 get_effective_email
68
=head3 inbound_email_address
69
69
70
  my $to_email = Koha::Library->get_effective_email;
70
  my $to_email = Koha::Library->inbound_email_address;
71
71
72
Returns an effective email address which should be accessible to librarians at the branch.
72
Returns an effective email address which should be accessible to librarians at the branch.
73
73
74
=cut
74
=cut
75
75
76
sub get_effective_email {
76
sub inbound_email_address {
77
    my ($self) = @_;
77
    my ($self) = @_;
78
78
79
    return
79
    return
(-)a/t/db_dependent/Koha/Libraries.t (-6 / +5 lines)
Lines 452-458 subtest '->get_effective_marcorgcode' => sub { Link Here
452
    $schema->storage->txn_rollback;
452
    $schema->storage->txn_rollback;
453
};
453
};
454
454
455
subtest '->get_effective_email' => sub {
455
subtest '->inbound_email_address' => sub {
456
456
457
    plan tests => 4;
457
    plan tests => 4;
458
458
Lines 471-489 subtest '->get_effective_email' => sub { Link Here
471
    t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'admin@mylibrary.com' );
471
    t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'admin@mylibrary.com' );
472
    t::lib::Mocks::mock_preference( 'ReplytoDefault', 'reply@mylibrary.com' );
472
    t::lib::Mocks::mock_preference( 'ReplytoDefault', 'reply@mylibrary.com' );
473
473
474
    is( $library_1->get_effective_email, $library_1->branchreplyto,
474
    is( $library_1->inbound_email_address, $library_1->branchreplyto,
475
       'If defined, use branches replyto address');
475
       'If defined, use branches replyto address');
476
476
477
    $library_1->branchreplyto(undef)->store();
477
    $library_1->branchreplyto(undef)->store();
478
    is( $library_1->get_effective_email, $library_1->branchemail,
478
    is( $library_1->inbound_email_address, $library_1->branchemail,
479
       'Fallback to branches email address when branchreplyto is undefined');
479
       'Fallback to branches email address when branchreplyto is undefined');
480
480
481
    $library_1->branchemail(undef)->store();
481
    $library_1->branchemail(undef)->store();
482
    is( $library_1->get_effective_email, 'reply@mylibrary.com',
482
    is( $library_1->inbound_email_address, 'reply@mylibrary.com',
483
       'Fallback to ReplytoDefault email address when branchreplyto and branchemail are undefined');
483
       'Fallback to ReplytoDefault email address when branchreplyto and branchemail are undefined');
484
484
485
    t::lib::Mocks::mock_preference( 'ReplytoDefault', undef );
485
    t::lib::Mocks::mock_preference( 'ReplytoDefault', undef );
486
    is( $library_1->get_effective_email, 'admin@mylibrary.com',
486
    is( $library_1->inbound_email_address, 'admin@mylibrary.com',
487
       'Fallback to KohaAdminEmailAddress email address when branchreplyto, branchemail and eplytoDefault are undefined');
487
       'Fallback to KohaAdminEmailAddress email address when branchreplyto, branchemail and eplytoDefault are undefined');
488
488
489
    $schema->storage->txn_rollback;
489
    $schema->storage->txn_rollback;
490
- 

Return to bug 22823