Lines 48-59
sub get_effective_server {
Link Here
|
48 |
Koha::Exceptions::MissingParameter->throw('Mandatory parameter missing: library') |
48 |
Koha::Exceptions::MissingParameter->throw('Mandatory parameter missing: library') |
49 |
unless $library; |
49 |
unless $library; |
50 |
|
50 |
|
51 |
my $servers_rs = Koha::SMTP::Servers->search({ library_id => $library->branchcode }); |
51 |
my ($server) = Koha::SMTP::Servers->search({ library_id => $library->branchcode }); |
52 |
if ( $servers_rs->count > 0 ) { |
|
|
53 |
return $servers_rs->next; |
54 |
} |
55 |
|
52 |
|
56 |
return $self->get_default; |
53 |
return $server || $self->get_default; |
57 |
} |
54 |
} |
58 |
|
55 |
|
59 |
=head3 get_default |
56 |
=head3 get_default |
Lines 67-83
Returns the default I<Koha::SMTP::Server> object.
Link Here
|
67 |
sub get_default { |
64 |
sub get_default { |
68 |
my ($self) = @_; |
65 |
my ($self) = @_; |
69 |
|
66 |
|
70 |
my $servers_rs = $self->search({ library_id => undef }); |
67 |
my ( $server ) = $self->search({ library_id => undef }); |
71 |
|
68 |
|
72 |
my $server; |
69 |
return $server || Koha::SMTP::Server->new( $self->default_setting ); |
73 |
if ($servers_rs->count > 0) { |
|
|
74 |
$server = $servers_rs->next; |
75 |
} |
76 |
else { |
77 |
$server = Koha::SMTP::Server->new( $self->default_setting ); |
78 |
} |
79 |
|
80 |
return $server; |
81 |
} |
70 |
} |
82 |
|
71 |
|
83 |
=head3 set_default |
72 |
=head3 set_default |