Bug 26290

Summary: Add the ability to set a default SMTP server in koha-conf.xml
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: System AdministrationAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: new feature    
Priority: P5 - low CC: gmcharlt, julian.maurice, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
With this enhancement, systems administrators can set a default/global SMTP configuration when creating the Koha instance, or by manually editing the koha-conf.xml.
Version(s) released in:
20.11.00
Circulation function:
Bug Depends on: 22343    
Bug Blocks:    
Attachments: Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml
Bug 26290: Make Makefile.PL aware of SMTP configs
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml
Bug 26290: Make Makefile.PL aware of SMTP configs
Bug 26290: Display the correct default values on the admin page

Description Tomás Cohen Arazi (tcohen) 2020-08-24 18:01:22 UTC
This way people installing Koha can set their SMTP on deployment.
Comment 1 Tomás Cohen Arazi (tcohen) 2020-08-24 20:06:46 UTC
Created attachment 109035 [details] [review]
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml

This patch adds an entry to koha-conf.xml for setting a default SMTP
server config. 'koha-create' gets option switches for all options.

To test:
1. Use the tweaked script to crete a new instance
2. Notice it contains entries for smtp_server and they respect your
   options.
3. If you don't choose any option, it sets the current default.
Comment 2 Tomás Cohen Arazi (tcohen) 2020-08-24 20:06:53 UTC
Created attachment 109036 [details] [review]
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml

This patch makes the mentioned method use the configured entry in
koha-conf.xml if present, instead of the hardcoded one, which is kept
for people that carries an old koha-conf.xml
Comment 3 Kyle M Hall (khall) 2020-09-03 11:15:46 UTC
Created attachment 109617 [details] [review]
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml

This patch adds an entry to koha-conf.xml for setting a default SMTP
server config. 'koha-create' gets option switches for all options.

To test:
1. Use the tweaked script to crete a new instance
2. Notice it contains entries for smtp_server and they respect your
   options.
3. If you don't choose any option, it sets the current default.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall (khall) 2020-09-03 11:16:11 UTC
Created attachment 109618 [details] [review]
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml

This patch makes the mentioned method use the configured entry in
koha-conf.xml if present, instead of the hardcoded one, which is kept
for people that carries an old koha-conf.xml

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Julian Maurice 2020-09-11 09:42:38 UTC
The SMTP server section can be entirely configured by a debian script, but the default etc/koha-conf.xml used by the "perl Makefile.PL" method cannot be configured at all.
Is there a specific reason for that ?
Comment 6 Tomás Cohen Arazi (tcohen) 2020-09-11 10:40:40 UTC
(In reply to Julian Maurice from comment #5)
> The SMTP server section can be entirely configured by a debian script, but
> the default etc/koha-conf.xml used by the "perl Makefile.PL" method cannot
> be configured at all.
> Is there a specific reason for that ?

I wasn't sure it was useful. Do you think so?
Comment 7 Julian Maurice 2020-09-11 11:36:54 UTC
(In reply to Tomás Cohen Arazi from comment #6)
> I wasn't sure it was useful. Do you think so?

I guess that if it's useful to debian package users, it should be useful to non-debian package users too.
That can be added in a follow-up bug, but I'm a bit worried about this pattern of adding features to debian packages and not in Koha "core". In the long term it could mean that it would be more and more difficult to install Koha on non-debian systems.
Comment 8 Tomás Cohen Arazi (tcohen) 2020-09-11 13:07:49 UTC
(In reply to Julian Maurice from comment #7)
> (In reply to Tomás Cohen Arazi from comment #6)
> > I wasn't sure it was useful. Do you think so?
> 
> I guess that if it's useful to debian package users, it should be useful to
> non-debian package users too.
> That can be added in a follow-up bug, but I'm a bit worried about this
> pattern of adding features to debian packages and not in Koha "core". In the
> long term it could mean that it would be more and more difficult to install
> Koha on non-debian systems.

Hold on. Its been a while since I touched the Makefile.PL, and I'm testing my follow-up.
Comment 9 Tomás Cohen Arazi (tcohen) 2020-09-11 14:29:32 UTC
Created attachment 109949 [details] [review]
Bug 26290: Make Makefile.PL aware of SMTP configs
Comment 10 Martin Renvoize (ashimema) 2020-09-25 13:47:46 UTC
Created attachment 110758 [details] [review]
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml

This patch adds an entry to koha-conf.xml for setting a default SMTP
server config. 'koha-create' gets option switches for all options.

To test:
1. Use the tweaked script to crete a new instance
2. Notice it contains entries for smtp_server and they respect your
   options.
3. If you don't choose any option, it sets the current default.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2020-09-25 13:47:50 UTC
Created attachment 110759 [details] [review]
Bug 26290: Make Koha::SMTP::Servers->get_default use koha-conf.xml

This patch makes the mentioned method use the configured entry in
koha-conf.xml if present, instead of the hardcoded one, which is kept
for people that carries an old koha-conf.xml

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize (ashimema) 2020-09-25 13:47:56 UTC
Created attachment 110760 [details] [review]
Bug 26290: Make Makefile.PL aware of SMTP configs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize (ashimema) 2020-09-25 13:52:21 UTC
All works well for me and tests are passing.

I worked through a dev install, standard install and a package build.. all good.

Passing QA
Comment 14 Jonathan Druart 2020-10-02 12:16:05 UTC
Created attachment 111141 [details] [review]
Bug 26290: Display the correct default values on the admin page

The "Default configuration" section at the top of the SMTP servers admin page
contains the hardcoded values in Koha::SMTP::Servers->default_setting.

It should be the values from the config (and default to hardcoded values unless defined)
Comment 15 Tomás Cohen Arazi (tcohen) 2020-10-02 12:19:54 UTC
(In reply to Jonathan Druart from comment #14)
> Created attachment 111141 [details] [review] [review]
> Bug 26290: Display the correct default values on the admin page
> 
> The "Default configuration" section at the top of the SMTP servers admin page
> contains the hardcoded values in Koha::SMTP::Servers->default_setting.
> 
> It should be the values from the config (and default to hardcoded values
> unless defined)

Thanks! I really missed it!
Comment 16 Jonathan Druart 2020-10-02 13:24:31 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 17 Lucas Gass (lukeg) 2020-10-20 18:13:57 UTC
new feature will not be backported to 20.05.x