Bug 27424: Clarify logic
This patch simplifies how Koha::SMTP::Servers->get_default is written, to help readability. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
29c263241d
commit
1bfdd545d6
1 changed files with 10 additions and 10 deletions
|
@ -43,21 +43,21 @@ Returns the default I<Koha::SMTP::Server> object.
|
|||
sub get_default {
|
||||
my ($self) = @_;
|
||||
|
||||
my $default;
|
||||
my $default = $self->search({ is_default => 1 }, { rows => 1 })->single;
|
||||
|
||||
my $smtp_config = C4::Context->config('smtp_server');
|
||||
unless ($default) { # no database default
|
||||
my $smtp_config = C4::Context->config('smtp_server');
|
||||
|
||||
if ( $default = $self->search({ is_default => 1 }, { rows => 1 })->single ) {
|
||||
if ( $smtp_config ) { # use koha-conf.xml
|
||||
$default = Koha::SMTP::Server->new( $smtp_config );
|
||||
}
|
||||
else {
|
||||
$default = Koha::SMTP::Server->new( $self->default_setting );
|
||||
}
|
||||
|
||||
}
|
||||
elsif ( $smtp_config ) {
|
||||
$default = Koha::SMTP::Server->new( $smtp_config );
|
||||
}
|
||||
else {
|
||||
$default = Koha::SMTP::Server->new( $self->default_setting );
|
||||
$default->{_is_system_default} = 1;
|
||||
}
|
||||
|
||||
$default->{_is_system_default} = 1;
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue