Lines 43-63
Returns the default I<Koha::SMTP::Server> object.
Link Here
|
43 |
sub get_default { |
43 |
sub get_default { |
44 |
my ($self) = @_; |
44 |
my ($self) = @_; |
45 |
|
45 |
|
46 |
my $default; |
46 |
my $default = $self->search({ is_default => 1 }, { rows => 1 })->single; |
47 |
|
47 |
|
48 |
my $smtp_config = C4::Context->config('smtp_server'); |
48 |
unless ($default) { # no database default |
|
|
49 |
my $smtp_config = C4::Context->config('smtp_server'); |
49 |
|
50 |
|
50 |
if ( $default = $self->search({ is_default => 1 }, { rows => 1 })->single ) { |
51 |
if ( $smtp_config ) { # use koha-conf.xml |
|
|
52 |
$default = Koha::SMTP::Server->new( $smtp_config ); |
53 |
} |
54 |
else { |
55 |
$default = Koha::SMTP::Server->new( $self->default_setting ); |
56 |
} |
51 |
|
57 |
|
52 |
} |
58 |
$default->{_is_system_default} = 1; |
53 |
elsif ( $smtp_config ) { |
|
|
54 |
$default = Koha::SMTP::Server->new( $smtp_config ); |
55 |
} |
56 |
else { |
57 |
$default = Koha::SMTP::Server->new( $self->default_setting ); |
58 |
} |
59 |
} |
59 |
|
60 |
|
60 |
$default->{_is_system_default} = 1; |
|
|
61 |
return $default; |
61 |
return $default; |
62 |
} |
62 |
} |
63 |
|
63 |
|
64 |
- |
|
|