Bugzilla – Attachment 115800 Details for
Bug 18532
Messaging preferences for auto renewals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18532: (follow-up) Remove digest switch and add preference
Bug-18532-follow-up-Remove-digest-switch-and-add-p.patch (text/plain), 8.35 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-01-26 09:43:57 UTC
(
hide
)
Description:
Bug 18532: (follow-up) Remove digest switch and add preference
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-01-26 09:43:57 UTC
Size:
8.35 KB
patch
obsolete
>From b34b1366406aff1dcd749249a9d14bbc5834f893 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 14 May 2020 12:53:30 +0000 >Subject: [PATCH] Bug 18532: (follow-up) Remove digest switch and add > preference > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../data/mysql/atomicupdate/bug-18532.perl | 28 +++------------- > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/patrons.pref | 7 ++++ > misc/cronjobs/automatic_renewals.pl | 33 ++++++++++++------- > 4 files changed, 35 insertions(+), 34 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug-18532.perl b/installer/data/mysql/atomicupdate/bug-18532.perl >index 1e6fb321116..4bb601dd6e3 100644 >--- a/installer/data/mysql/atomicupdate/bug-18532.perl >+++ b/installer/data/mysql/atomicupdate/bug-18532.perl >@@ -28,29 +28,6 @@ if( CheckVersion( $DBversion ) ) { > (7, 'sms', 1, 'circulation', 'AUTO_RENEWALS_DGST') > }); > >- $dbh->do( qq{ >- insert ignore into borrower_message_preferences (categorycode, message_attribute_id, days_in_advance, wants_digest) >- select c.categorycode, 7, NULL, 1 >- from categories c >- left join >- borrower_message_preferences p >- on c.categorycode = p.categorycode >- and p.message_attribute_id = 7 >- where p.categorycode is null >- >- }); >- >- $dbh->do( qq{ >- insert ignore into borrower_message_preferences (borrowernumber, message_attribute_id, days_in_advance, wants_digest) >- select b.borrowernumber, 7, NULL, 1 >- from borrowers b >- left join >- borrower_message_preferences p >- on b.borrowernumber = p.borrowernumber >- and p.message_attribute_id = 7 >- where p.borrowernumber is null >- }); >- > $dbh->do( qq{ > insert into borrower_message_transport_preferences (borrower_message_preference_id, message_transport_type) > select p.borrower_message_preference_id, 'email' >@@ -62,6 +39,11 @@ if( CheckVersion( $DBversion ) ) { > and t.borrower_message_preference_id is null; > }); > >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) >+ VALUES ('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice') >+ }); >+ > # Always end with this (adjust the bug info) > SetVersion( $DBversion ); > print "Upgrade to $DBversion done (Bug 18532 - Add AUTO_RENEWALS in message_attributes and add AUTO_RENEWALS_DGST letter)\n"; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 3157830c198..d566ab86988 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -78,6 +78,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'), > ('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'), > ('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'), >+('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice'), > ('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'), > ('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'), > ('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 1b3e386cc90..bebb2a24ba3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -185,6 +185,13 @@ Patrons: > yes: Enable > no: Disable > - sending purchase suggestion messages by SMS if no patron email is defined. >+ - >+ - "Send automatic renewal notices " >+ - pref: AutoRenewalNotices >+ choices: >+ never: never >+ preferences: according to patron messaging preferences >+ cron: (Deprecated) according to cron switch > Patron forms: > - > - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:" >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index a02bdf9c165..3b66381cc27 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -43,6 +43,8 @@ and the renewal isn't premature (No Renewal before) the issue is renewed. > > =item B<-s|--send-notices> > >+DEPRECATED: The system preference AutoRenewalNotices should be used to determine >+whether notices are sent or not > Send AUTO_RENEWALS notices to patrons if the auto renewal has been done. > > =item B<-v|--verbose> >@@ -53,14 +55,10 @@ Print report to standard out. > > Without this parameter no changes will be made > >-=item B<-d|--digest> >- >-Flag to indicate that this script should process digest messages. >- > =item B<-b|--digest-per-branch> > > Flag to indicate that generation of message digests should be >-performed separately for each branch. Needs --digest option. >+performed separately for each branch. > > A patron could potentially have loans at several different branches > There is no natural branch to set as the sender on the aggregated >@@ -89,18 +87,32 @@ use Koha::Checkouts; > use Koha::Libraries; > use Koha::Patrons; > >-my ( $help, $send_notices, $verbose, $confirm, $digest, $digest_per_branch ); >+my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch ); > GetOptions( > 'h|help' => \$help, > 's|send-notices' => \$send_notices, > 'v|verbose' => \$verbose, > 'c|confirm' => \$confirm, >- 'd|digest|' => \$digest, > 'b|digest-per-branch' => \$digest_per_branch, > ) || pod2usage(1); > > pod2usage(0) if $help; > >+my $send_notices_pref = C4::Context->preference('AutoRenewalNotices') >+if ( $send_notices_pref = '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 >+} else { >+ # If not following cron then we should not send if set to never >+ # and always send any generated according to preferences if following those >+ $send_notices = $send_notices_pref eq 'never' ? 0 : 1; >+} >+ > # Since advance notice options are not visible in the web-interface > # unless EnhancedMessagingPreferences is on, let the user know that > # this script probably isn't going to do much >@@ -128,10 +140,9 @@ my %report; > while ( my $auto_renew = $auto_renews->next ) { > print "examining item '" . $auto_renew->itemnumber . "' to auto renew\n" if $verbose; > >- my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber, >- message_name => 'auto_renewals' } ); >- >- next if !$digest && $borrower_preferences && $borrower_preferences->{'wants_digest'}; >+ my $borrower_preferences; >+ $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber, >+ message_name => 'auto_renewals' } ) if $send_notices_pref eq 'preferences'; > > # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script > my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber, undef, 1 ); >-- >2.30.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 18532
:
95030
|
95031
|
95337
|
95338
|
95456
|
96049
|
96050
|
96487
|
96494
|
96495
|
98078
|
98079
|
99193
|
99194
|
104880
|
104881
|
104882
|
104883
|
105500
|
105501
|
105502
|
105503
|
114316
|
115798
|
115799
|
115800
|
115801
|
115802
|
115829
|
115830
|
115831
|
115832
|
115833
|
118198
|
118199
|
118205
|
118318
|
118329
|
118330
|
118331
|
118356