Bug 28086

Summary: Email address shown on OpacMaintenancePage should use ReplytoDefault if set
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: david, fridolin.somers, jonathan.druart, tomascohen
Version: MainKeywords: Manual
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement changes the OPAC maintenance page* so that it uses the email address from the ReplyToDefault system preference, if it is set, for the "please contact the site administrator" email link. If ReplyToDefault is not set, it will use KohaAdminEmailAddress. If both ReplytoDefault and KohaAdminEmailAddress are not set, no link is shown. * Displays when the OpacMaintenance system preference is set to "Show".
Version(s) released in:
21.05.00
Circulation function:
Bug Depends on: 27940    
Bug Blocks:    
Attachments: Bug 28086: OpacMaintenance page should use ReplytoDefault if set
Bug 28086: OpacMaintenance page should use ReplytoDefault if set
Bug 28086: OpacMaintenance page should use ReplytoDefault if set
Bug 28086: OpacMaintenance page should use ReplytoDefault if set
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

Description Katrin Fischer 2021-04-04 19:31:22 UTC
For some email setups the email address of the library will be in ReplytoDefault and not in KohaAdminEmailAddress. So it would be great if we could check  ReplytoDefault for the email shown on the OPAC maintenance page first and use it if set with a fallback to the current behaviour of using KohaAdminEmailAdress.
Comment 1 Owen Leonard 2021-04-08 14:17:19 UTC
Created attachment 119325 [details] [review]
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

This patch changes the OPAC maintenance template so that it checks for a
value in the ReplyToDefault system preference when displaying the
"please contact the site administrator" email link.

Also changed: If neither ReplytoDefault nor KohaAdminEmailAddress is
defined, it won't show the link at all.

To test, apply the patch and set the OpacMaintenance preference to
"Show."

 - In the OPAC you should see the "System Maintenance" page.
 - Test this page with various settings:
   - ReplytoDefault and KohaAdminEmailAddress both populated.
   - Only ReplytoDefault
   - Only KohaAdminEmailAddress
   - Neither.

 Confirm that the correct email address is used in each case.
Comment 2 David Nind 2021-04-11 12:00:47 UTC
I can't apply the patch for some reason:

Applying: Bug 28086: OpacMaintenance page should use ReplytoDefault if set
error: sha1 information is lacking or useless (koha-tmpl/opac-tmpl/bootstrap/en/modules/maintenance.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 28086: OpacMaintenance page should use ReplytoDefault if set
Comment 3 Owen Leonard 2021-04-14 11:42:38 UTC
Created attachment 119561 [details] [review]
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

This patch changes the OPAC maintenance template so that it checks for a
value in the ReplyToDefault system preference when displaying the
"please contact the site administrator" email link.

Also changed: If neither ReplytoDefault nor KohaAdminEmailAddress is
defined, it won't show the link at all.

To test, apply the patch and set the OpacMaintenance preference to
"Show."

 - In the OPAC you should see the "System Maintenance" page.
 - Test this page with various settings:
   - ReplytoDefault and KohaAdminEmailAddress both populated.
   - Only ReplytoDefault
   - Only KohaAdminEmailAddress
   - Neither.

 Confirm that the correct email address is used in each case.
Comment 4 David Nind 2021-04-14 11:58:16 UTC
Created attachment 119564 [details] [review]
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

This patch changes the OPAC maintenance template so that it checks for a
value in the ReplyToDefault system preference when displaying the
"please contact the site administrator" email link.

Also changed: If neither ReplytoDefault nor KohaAdminEmailAddress is
defined, it won't show the link at all.

To test, apply the patch and set the OpacMaintenance preference to
"Show."

 - In the OPAC you should see the "System Maintenance" page.
 - Test this page with various settings:
   - ReplytoDefault and KohaAdminEmailAddress both populated.
   - Only ReplytoDefault
   - Only KohaAdminEmailAddress
   - Neither.

 Confirm that the correct email address is used in each case.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Jonathan Druart 2021-04-14 12:20:37 UTC
Created attachment 119568 [details] [review]
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

This patch changes the OPAC maintenance template so that it checks for a
value in the ReplyToDefault system preference when displaying the
"please contact the site administrator" email link.

Also changed: If neither ReplytoDefault nor KohaAdminEmailAddress is
defined, it won't show the link at all.

To test, apply the patch and set the OpacMaintenance preference to
"Show."

 - In the OPAC you should see the "System Maintenance" page.
 - Test this page with various settings:
   - ReplytoDefault and KohaAdminEmailAddress both populated.
   - Only ReplytoDefault
   - Only KohaAdminEmailAddress
   - Neither.

 Confirm that the correct email address is used in each case.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2021-04-14 12:26:21 UTC
Hum, pondering. Why the OPAC maintenance only?

Why not this one as well for instance?
Koha/Patron/Password/Recovery.pm:    my $kohaEmail = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress');  # send from patron's branch or Koha Admin
Comment 7 Katrin Fischer 2021-04-17 16:45:11 UTC
(In reply to Jonathan Druart from comment #6)
> Hum, pondering. Why the OPAC maintenance only?
> 
> Why not this one as well for instance?
> Koha/Patron/Password/Recovery.pm:    my $kohaEmail = $library->branchemail
> || C4::Context->preference('KohaAdminEmailAddress');  # send from patron's
> branch or Koha Admin

Yes please, if we have missed other cases, we should do them too. But I recommend not fixing them all in the same bug to keep things moving.
Comment 8 Katrin Fischer 2021-04-17 19:05:53 UTC
Created attachment 119802 [details] [review]
Bug 28086: OpacMaintenance page should use ReplytoDefault if set

This patch changes the OPAC maintenance template so that it checks for a
value in the ReplyToDefault system preference when displaying the
"please contact the site administrator" email link.

Also changed: If neither ReplytoDefault nor KohaAdminEmailAddress is
defined, it won't show the link at all.

To test, apply the patch and set the OpacMaintenance preference to
"Show."

 - In the OPAC you should see the "System Maintenance" page.
 - Test this page with various settings:
   - ReplytoDefault and KohaAdminEmailAddress both populated.
   - Only ReplytoDefault
   - Only KohaAdminEmailAddress
   - Neither.

 Confirm that the correct email address is used in each case.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2021-04-17 19:15:16 UTC
(In reply to Jonathan Druart from comment #6)
> Hum, pondering. Why the OPAC maintenance only?
> 
> Why not this one as well for instance?
> Koha/Patron/Password/Recovery.pm:    my $kohaEmail = $library->branchemail
> || C4::Context->preference('KohaAdminEmailAddress');  # send from patron's
> branch or Koha Admin

Pondering why this still works for us, I think something happens in 
sub _send_message_by_email to that. Jonathan, can you maybe verify and let me know if I should file another bug?
Comment 10 Jonathan Druart 2021-04-21 13:16:37 UTC
I am not sure I understand the point of having KohaAdminEmailAddress a fallback for ReplytoDefault everywhere. In that case why do we keep KohaAdminEmailAddress?
Comment 11 Katrin Fischer 2021-04-21 13:25:39 UTC
(In reply to Jonathan Druart from comment #10)
> I am not sure I understand the point of having KohaAdminEmailAddress a
> fallback for ReplytoDefault everywhere. In that case why do we keep
> KohaAdminEmailAddress?

E-mail configuration varies widely. If a library has set a reply-to you can assume they want to use it in these cases. If they have left it empty, we should use KohaAdminEmailAdress.

Reply-to is mostly much needed for support companies. If you are self hosting using your own institution's mail server, you won't need it.
Comment 12 Jonathan Druart 2021-04-21 13:30:18 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 13 Fridolin Somers 2021-04-29 13:30:19 UTC
Enhancement not pushed to 20.11.x
Comment 14 Katrin Fischer 2021-05-01 21:43:49 UTC
Actually more of a bugfix I think - in our case at the moment always a 'noreply@' is shown.
Comment 15 Tomás Cohen Arazi (tcohen) 2021-05-02 03:38:59 UTC
I think we should have a new configuration for this particular use case (email address to be displayed in OPAC when some error needs to be reported).

If I was to pick one, I would say the admin address is the right one, and libraries should set different values for each branch. But I see Katrin's point/need.
Comment 16 Katrin Fischer 2021-05-02 12:25:32 UTC
(In reply to Tomás Cohen Arazi from comment #15)
> I think we should have a new configuration for this particular use case
> (email address to be displayed in OPAC when some error needs to be reported).
> 
> If I was to pick one, I would say the admin address is the right one, and
> libraries should set different values for each branch. But I see Katrin's
> point/need.

It's not only my need actually. I think as the reply-to address is used when you reply to emails, it makes a lot of sense to use it first. If you don't want to use it, you don't have to set it at all. I believe this is all the configuration we need here. It's optional and probably will only be set when you have a use case that requires it.