Bug 38306 - Make automatic_renewals.pl cronjob quiet if EnhancedMessagingPreferences syspref is off
Summary: Make automatic_renewals.pl cronjob quiet if EnhancedMessagingPreferences sysp...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Marcel de Rooy
URL:
Keywords: no-sandbox
Depends on:
Blocks:
 
Reported: 2024-10-31 00:10 UTC by Aleisha Amohia
Modified: 2025-11-03 21:16 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose (1.64 KB, patch)
2024-10-31 02:33 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose (1.69 KB, patch)
2025-01-09 19:10 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose (1.79 KB, patch)
2025-10-31 08:44 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-10-31 00:10:31 UTC
And the cronjob isn't being called with $verbose

If the EnhancedMessagingPreferences system preference is off, the automatic_renewals.pl cronjob will print this daily, even if the script is not run with $verbose

/etc/cron.daily/koha-common:

The "EnhancedMessagingPreferences" syspref is off.
Therefore, it is unlikely that this script will actually produce any messages to be sent.
To change this, edit the "EnhancedMessagingPreferences" syspref.
Comment 1 Aleisha Amohia 2024-10-31 02:33:42 UTC
Created attachment 173741 [details] [review]
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose

This enhancement will amend the automatic_renewals.pl script to only print a warning about the EnhancedMessagingPreferences system preference being disabled if the script was run with verbose.

To test:

1. Disable EnhancedMessagingPreferences
2. Run misc/cronjobs/automatic_renewals.pl
3. Notice the warning is printed
4. Apply the patch and restart services
5. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed
6. Run misc/cronjobs/automatic_renewals.pl --verbose and notice the warning is printed
7. Enable EnhancedMessagingPreferences
8. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed

Sponsored-by: Catalyst IT
Comment 2 Brendan Lawlor 2025-01-09 19:10:44 UTC
Created attachment 176299 [details] [review]
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose

This enhancement will amend the automatic_renewals.pl script to only print a warning about the EnhancedMessagingPreferences system preference being disabled if the script was run with verbose.

To test:

1. Disable EnhancedMessagingPreferences
2. Run misc/cronjobs/automatic_renewals.pl
3. Notice the warning is printed
4. Apply the patch and restart services
5. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed
6. Run misc/cronjobs/automatic_renewals.pl --verbose and notice the warning is printed
7. Enable EnhancedMessagingPreferences
8. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed

Sponsored-by: Catalyst IT
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 3 Marcel de Rooy 2025-02-21 10:35:26 UTC
What about:

my $send_notices_pref = C4::Context->preference('AutoRenewalNotices');
if ( $send_notices_pref eq 'cron' ) {
    warn <<'END_WARN';

The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
The send_notices switch for this script is deprecated, you should either set the preference
to 'Never send emails' or 'Follow patron messaging preferences'

END_WARN
Comment 4 Aleisha Amohia 2025-09-11 02:32:59 UTC
(In reply to Marcel de Rooy from comment #3)
> What about:
> 
> my $send_notices_pref = C4::Context->preference('AutoRenewalNotices');
> if ( $send_notices_pref eq 'cron' ) {
>     warn <<'END_WARN';
> 
> The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
> The send_notices switch for this script is deprecated, you should either set
> the preference
> to 'Never send emails' or 'Follow patron messaging preferences'
> 
> END_WARN

Sorry Marcel I wonder if there was more to add to your comment and it got left off? I don't understand the suggestion.

Setting back to needs signoff.
Comment 5 Marcel de Rooy 2025-10-31 08:33:37 UTC
Revisiting much too late. Trying to understand myself now..
Comment 6 Marcel de Rooy 2025-10-31 08:42:56 UTC
(In reply to Marcel de Rooy from comment #3)
> What about:
> 
> my $send_notices_pref = C4::Context->preference('AutoRenewalNotices');
> if ( $send_notices_pref eq 'cron' ) {
>     warn <<'END_WARN';
> 
> The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
> The send_notices switch for this script is deprecated, you should either set
> the preference
> to 'Never send emails' or 'Follow patron messaging preferences'
> 
> END_WARN

Lets consider this out of scope for now. It is not related to EnhancedMessaging.
It was just a question if we should add verbose here too. Never mind.
Comment 7 Marcel de Rooy 2025-10-31 08:44:21 UTC
Created attachment 188766 [details] [review]
Bug 38306: Only print EnhancedMessagingPreferences warning if run with verbose

This enhancement will amend the automatic_renewals.pl script to only print a warning about the EnhancedMessagingPreferences system preference being disabled if the script was run with verbose.

To test:

1. Disable EnhancedMessagingPreferences
2. Run misc/cronjobs/automatic_renewals.pl
3. Notice the warning is printed
4. Apply the patch and restart services
5. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed
6. Run misc/cronjobs/automatic_renewals.pl --verbose and notice the warning is printed
7. Enable EnhancedMessagingPreferences
8. Run misc/cronjobs/automatic_renewals.pl and notice the warning is not printed

Sponsored-by: Catalyst IT
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2025-10-31 08:46:36 UTC
Pragmatic here. Theoretically, could imagine that I would like to see the warn when running this manually or so. But seeing this daily in the default cron call that does not have verbose, might be more annoying.
Comment 9 Lucas Gass (lukeg) 2025-11-03 21:16:00 UTC
Nice work everyone!

Pushed to main for 25.11