Bug 21627 - System preference for recipient emails of gather_print_notices.pl
Summary: System preference for recipient emails of gather_print_notices.pl
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Imani
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-22 10:23 UTC by Joonas Kylmälä
Modified: 2025-01-13 22:48 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 21627: Add option to set emails for send_print_notices cronjob (4.15 KB, patch)
2025-01-10 14:29 UTC, Imani
Details | Diff | Splinter Review
Bug 21627: Add SendPrintNoticesCombineEmails and SendPrintNoticesEmails system preferences. (2.92 KB, patch)
2025-01-10 14:30 UTC, Imani
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2018-10-22 10:23:38 UTC
I think it would be nice if the librarians without shell access to the server could change the email address list that the gather_print_notices.pl cronjob uses to send emails to. Now the only way is to specify the --email option when running the script. I suggest a system preference for this that would have a comma separated list of emails.
Comment 1 Olli-Antti Kivilahti 2018-10-22 10:37:26 UTC
We could have a syspref category 'cronjobs' and we could configure all the cronjobs there. Atleast the portions which make sense to configure via sysprefs. That should be most/all of them.

Also what is needed is way to validate that the syspref values are valid.
For ex. we use a lot of YAML-valued sysprefs. It would be important to be able to pop in a custom validation subroutine.

Also syspref changes need to be logged. I recall there was some kind of a logging subsystem for sysprefs, and that may be sufficient.
Comment 2 Joonas Kylmälä 2018-10-22 10:44:28 UTC
(In reply to Olli-Antti Kivilahti from comment #1)
> We could have a syspref category 'cronjobs' and we could configure all the
> cronjobs there. Atleast the portions which make sense to configure via
> sysprefs. That should be most/all of them.

Great idea!

> Also what is needed is way to validate that the syspref values are valid.
> For ex. we use a lot of YAML-valued sysprefs. It would be important to be
> able to pop in a custom validation subroutine.
> 
> Also syspref changes need to be logged. I recall there was some kind of a
> logging subsystem for sysprefs, and that may be sufficient.

These should have their own reports. At least the first issue has already: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20930
Comment 3 Katrin Fischer 2018-10-28 17:35:30 UTC
> We could have a syspref category 'cronjobs' and we could configure all the
> cronjobs there. Atleast the portions which make sense to configure via
> sysprefs. That should be most/all of them.

+1

And yes, system preference changes are loggged - saved me more than one time.
Comment 4 Danielle Elder 2018-12-06 17:16:41 UTC
I would love to see the email address default to the branches.branchemail when the --split parameter is used.Otherwise I have to set up additional crons to send the individual notices to each branch e-mail. This gets very lengthy and can end up being dozens of crons for systems with multiple branches. I'd love to simplify this for multi-branch libraries.
Comment 5 Danielle Elder 2018-12-06 17:17:22 UTC
I would love to see the email address default to the branches.branchemail when the --split parameter is used.Otherwise I have to set up additional crons to send the individual notices to each branch e-mail. This gets very lengthy and can end up being dozens of crons for systems with multiple branches. I'd love to simplify this for multi-branch libraries.
Comment 6 Magnus Enger 2019-12-17 14:59:28 UTC
(In reply to Danielle Elder from comment #5)
> I would love to see the email address default to the branches.branchemail
> when the --split parameter is used.Otherwise I have to set up additional
> crons to send the individual notices to each branch e-mail. 

How do you do that? If you do --split and several --email, does not all the files get sent to all the addresses?
Comment 7 Imani 2025-01-09 14:26:51 UTC
(In reply to Danielle Elder from comment #5)
> I would love to see the email address default to the branches.branchemail
> when the --split parameter is used.Otherwise I have to set up additional
> crons to send the individual notices to each branch e-mail. This gets very
> lengthy and can end up being dozens of crons for systems with multiple
> branches. I'd love to simplify this for multi-branch libraries.

Hi Danielle, I'm looking at the issue above and saw your comment. I'm curious about your circumstances if they are still relevant. Is this a security concern with sending all the files to all the branches or simply a quality of life issue with the branches not having to sort through the files for other branches to get the notices for their own? Either way I think it will be a little bit out of scope for this bug but can be its own separate issue which I can make after I address the original issue.

Thanks!
~Imani
Comment 8 Imani 2025-01-10 14:29:21 UTC
Created attachment 176339 [details] [review]
Bug 21627: Add option to set emails for send_print_notices cronjob

To test:
    1. Apply Patch, updatedatabase, restart_all
    2. go to misc/cronjobs/gather_print_notices.pl and uncomment line 77 which says `say $_ for @emails;`
    3. from the misc/cronjobs folder run `perl gather_print_notices.pl -e dev@null.org -e any@other.email`
	    1. the emails you entered in the command line should be printed and nothing else
    4. Search for the system preference 'SendPrintNoticesEmails' and set its value to a comma separated list of values
    5. run gather_print_notices again and you should see the values you entered in the system preference instead of the ones you enter at the command line
    6. search for the system preference SendPrintNoticesCombineEmails and set its value to 'in addition to'
    7. run gather_print_notices again and you should see a combination of the command line emails and the emails you set in the SendPrintNoticesEmails system preference.
    8. recomment line 77 in gather_print_notices.pl
Comment 9 Imani 2025-01-10 14:30:28 UTC
Created attachment 176340 [details] [review]
Bug 21627: Add SendPrintNoticesCombineEmails and SendPrintNoticesEmails system preferences.
Comment 10 holly 2025-01-13 22:48:49 UTC
Dani's comment is still relevant. Large library systems have a need for the cron to split and send notice files to the library email matching the patron home library. 
The primary need is simplicity for libraries (not having to sort through for their files). 
Some libraries do limit patron visibility by library or library group for patron data security. Some library systems will have a security want or need for separated files.