Bug 25067: Move PO file manipulation code into gulp tasks
[koha.git] / Koha / SMTP / Servers.pm
blobd7451e9a87c6c63c9bbc105490a9f46cbd16a975
1 package Koha::SMTP::Servers;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
18 use Modern::Perl;
20 use Koha::Database;
21 use Koha::Exceptions;
23 use Koha::SMTP::Server;
25 use base qw(Koha::Objects);
27 =head1 NAME
29 Koha::SMTP::Servers - Koha SMTP Server Object set class
31 =head1 API
33 =head2 Class methods
35 =head3 get_default
37 my $server = Koha::SMTP::Servers->new->get_default;
39 Returns the default I<Koha::SMTP::Server> object.
41 =cut
43 sub get_default {
44 my ($self) = @_;
46 my $default;
47 my $smtp_config = C4::Context->config('smtp_server');
49 if ( $smtp_config ) {
50 $default = Koha::SMTP::Server->new( $smtp_config );
52 else {
53 $default = Koha::SMTP::Server->new( $self->default_setting );
56 $default->{_is_system_default} = 1;
57 return $default;
60 =head2 Internal methods
62 =head3 _type
64 Return type of object, relating to Schema ResultSet
66 =cut
68 sub _type {
69 return 'SmtpServer';
72 =head3 default_setting
74 my $hash = Koha::SMTP::Servers::default_setting;
76 Returns the default setting that is to be used when no user-defined default
77 SMTP server is provided
79 =cut
81 sub default_setting {
82 return {
83 name => 'localhost',
84 host => 'localhost',
85 port => 25,
86 timeout => 120,
87 ssl_mode => 'disabled',
88 user_name => undef,
89 password => undef,
90 debug => 0
94 =head3 object_class
96 Return object class
98 =cut
100 sub object_class {
101 return 'Koha::SMTP::Server';