Bugzilla – Attachment 111122 Details for
Bug 26595
Add SMTP server column to libraries table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26595: Add Koha::Library->smtp_server_info
Bug-26595-Add-KohaLibrary-smtpserverinfo.patch (text/plain), 2.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-10-02 11:19:02 UTC
(
hide
)
Description:
Bug 26595: Add Koha::Library->smtp_server_info
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-10-02 11:19:02 UTC
Size:
2.46 KB
patch
obsolete
>From 4640318379bbd8913cf906e223cb79c10b4350cf Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 1 Oct 2020 12:06:13 -0300 >Subject: [PATCH] Bug 26595: Add Koha::Library->smtp_server_info > >This patch adds a method for retrieving brief information about the >linked (or not) SMTP server for embedding on API requests. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Library.t >=> SUCCESS: Tests pass! >3. Sign off :-D >--- > Koha/Library.pm | 17 +++++++++++++++++ > t/db_dependent/Koha/Library.t | 21 ++++++++++++++++++++- > 2 files changed, 37 insertions(+), 1 deletion(-) > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index 165d974f44..90da8e2816 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -115,6 +115,23 @@ sub smtp_server { > return $self; > } > >+=head3 smtp_server_info >+ >+Returns the SMTP server info for the library, or 'system_default' if it is the system default. >+ >+=cut >+ >+sub smtp_server_info { >+ my ($self) = @_; >+ >+ my $smtp_server = $self->smtp_server; >+ >+ return { name => 'system_default' } >+ if $smtp_server->is_system_default; >+ >+ return { name => $smtp_server->name, smtp_server_id => $smtp_server->id }; >+} >+ > =head3 inbound_email_address > > my $to_email = Koha::Library->inbound_email_address; >diff --git a/t/db_dependent/Koha/Library.t b/t/db_dependent/Koha/Library.t >index 23e88578b3..8c1d12ae28 100644 >--- a/t/db_dependent/Koha/Library.t >+++ b/t/db_dependent/Koha/Library.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > > use Koha::Database; > use Koha::SMTP::Servers; >@@ -93,3 +93,22 @@ subtest 'smtp_server() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'smtp_server_info() tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ my $smtp_server = $builder->build_object({ class => 'Koha::SMTP::Servers' }); >+ >+ # No SMTP server assigned to library, return system default >+ is_deeply( $library->smtp_server_info, { name => 'system_default' }, 'System default is returned' ); >+ >+ # Assign an SMTP server >+ $library->smtp_server({ smtp_server => $smtp_server }); >+ is_deeply( $library->smtp_server_info, { name => $smtp_server->name, smtp_server_id => $smtp_server->id }, 'The right information is returned when SMTP server is assigned' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.28.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26595
:
111122
|
111123
|
111124
|
111125
|
111155
|
111156
|
111157
|
111158
|
111550
|
111551
|
111552
|
111553
|
111606
|
111621
|
111622