Bugzilla – Attachment 186002 Details for
Bug 24499
Add new syspref EnhancedMessaging for central activation/desactivation of notifications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24499: New syspref EnhancedMessaging for clearer functionality
Bug-24499-New-syspref-EnhancedMessaging-for-cleare.patch (text/plain), 9.38 KB, created by
Thibaud Guillot (thibaud_g)
on 2025-09-01 09:38:53 UTC
(
hide
)
Description:
Bug 24499: New syspref EnhancedMessaging for clearer functionality
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2025-09-01 09:38:53 UTC
Size:
9.38 KB
patch
obsolete
>From 3a835ab999ff42c0f8f3ff7f2790335072865e2d Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Wed, 26 Jan 2022 16:13:16 +0100 >Subject: [PATCH] Bug 24499: New syspref EnhancedMessaging for clearer > functionality > >Actually there is EnhancedMessagingPreferences that can be set on >"Allow" or "Don't allow" to show or not show messaging preferences for >patrons. >But this syspref does not prevent notifications from being sent. > >From your comments, I decide to create a new syspref which show dialog >alert on patron details (Patron messaging preferences section) but >prevent misc/cronjobs/advance_notices.pl script. > >EnhancedMessagingPreferences keep the same behavior I just took over >preferences descriptions to make clearer context (on >EnhancedMessagingPreferencesOPAC too). > >Test plan : > >1 - Be sure to have a patron with a loan >2 - Also be sure to have a model on your library in "Notices & slips" >3 - Set max days for advance_notices on patron details table >4 - Then set EnhancedMessagingPreferences to "Allow" >5 - On Patron details you will see the table for settings notifications >6 - Run the misc/cronjobs/advance_notices.pl script manually >7 - The script find a notice and add a message in message_queue table >8 - Set now EnhancedMessagingPreferences to "Don't allow" >9 - Repeat the step 5, you don't see the table right now >10 - Repeat the step 6, same behavior, a message is created and stored >11 - Now apply this patch and launch updatedatabase.pl >12 - You will see the new syspref "EnhanceMessaging" >13 - If you want you can repeat steps 4 to 10 - same behavior again >14 - But now, you can set to "Don't send" on EnhancedMessaging >15 - See on patron details page, there is a dialog alert to inform >16 - Run again the step 6, normally it will send you a warn and no >message was created or stored. > >Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> >--- > .../bug_24499-add_EnhancedMessaging_syspref.pl | 11 +++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/patrons.pref | 16 ++++++++++++---- > .../prog/en/modules/members/moremember.tt | 5 +++++ > misc/cronjobs/advance_notices.pl | 8 ++++---- > 5 files changed, 33 insertions(+), 8 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_24499-add_EnhancedMessaging_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_24499-add_EnhancedMessaging_syspref.pl b/installer/data/mysql/atomicupdate/bug_24499-add_EnhancedMessaging_syspref.pl >new file mode 100755 >index 00000000000..50bd5ecc47d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24499-add_EnhancedMessaging_syspref.pl >@@ -0,0 +1,11 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_24499", >+ description => "Add new system preference EnhancedMessaging", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('EnhancedMessaging', '1', NULL, "Send/Don't send notifications througt misc/cronjobs/advance_notices.pl", 'YesNo') }); >+ }, >+ }; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 67cd533dafb..024ebb3c5cc 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -259,6 +259,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''), > ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'), > ('EnableSearchHistory','0','','Enable or disable search history','YesNo'), >+('EnhancedMessaging','1','NULL','If ON, send notifications throught the misc/cronjobs/advance_notices.pl.','YesNo'), > ('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), > ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), > ('ERMModule', '0', NULL, 'Enable the e-resource management module', '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 22788828bbc..3525a918f0c 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 >@@ -159,21 +159,29 @@ Patrons: > - "<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/membership_expiry.pl</code> cronjob. Ask your system administrator to schedule it." > - "<br><strong>NOTE:</strong> The parameters you use to select patrons when running the cronjob will supersede a user's messaging preferences. For example, a user may have opted to receive the expiry notice but if they are not included in the search parameters on the cronjob then they will not receive the notice." > Notices and notifications: >+ - >+ - pref: EnhancedMessaging >+ choices: >+ 1: Send >+ 0: Don't send >+ - "notifications throught <code>misc/cronjobs/advance_notices.pl</code>." >+ - '<br><strong>NOTE:</strong> This only applies to courtesy notices.' >+ >+ - "<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/process_message_queue.pl</code> and the <code>misc/cronjobs/advance_notices.pl</code> cronjob. Ask your system administrator to schedule them." > - > - pref: EnhancedMessagingPreferences > choices: > 1: Allow > 0: "Don't allow" >- - "staff to manage which notices patrons will receive and when they will receive them." >- - '<br><strong>NOTE:</strong> This only applies to courtesy notices. To manage if patrons have also access to these settings, use <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EnhancedMessagingPreferencesOPAC">EnhancedMessagingPreferencesOPAC</a>.' >- - "<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/process_message_queue.pl</code> and the <code>misc/cronjobs/advance_notices.pl</code> cronjob. Ask your system administrator to schedule them." >+ - "staff to manage which notices patrons when they will receive them." >+ - '<br><strong>NOTE:</strong> To manage if patrons have also access to these settings, use <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EnhancedMessagingPreferencesOPAC">EnhancedMessagingPreferencesOPAC</a>.' > - > - pref: EnhancedMessagingPreferencesOPAC > choices: > 1: Show > 0: "Don't show" > - "patron messaging setting on the OPAC." >- - '<br><strong>NOTE:</strong> <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EnhancedMessagingPreferences">EnhancedMessagingPreferences</a> must be enabled.' >+ - '<br><strong>NOTE:</strong> <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EnhancedMessaging">EnhancedMessaging</a> must be enabled.' > - > - pref: AutoEmailNewUser > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index cdb10f8e48b..7990cc3e8b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -424,6 +424,11 @@ > [% IF CAN_user_borrowers_edit_borrowers %] > <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=3"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > [% END %] >+ [% IF ( Koha.Preference('EnhancedMessaging') == 0 ) %] >+ <div class="dialog alert"> >+ <i class="fa fa-warning"></i> Notifications actually disabled >+ </div> >+ [% END %] > </div> > <div class="rows"> > <ol> >diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl >index 82fd3101b19..5d0c1389b94 100755 >--- a/misc/cronjobs/advance_notices.pl >+++ b/misc/cronjobs/advance_notices.pl >@@ -206,14 +206,14 @@ pod2usage( -verbose => 2 ) if $man; > # 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 >-if ( !C4::Context->preference('EnhancedMessagingPreferences') && $verbose ) { >+if ( ! C4::Context->preference('EnhancedMessaging') ) { > warn <<'END_WARN'; > >-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. >+The "EnhancedMessaging" syspref is off. >+This syspref must set to "Send" to use this script. > > END_WARN >+ exit > } > unless ($confirm) { > pod2usage(1); >-- >2.39.5
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 24499
:
129834
|
145356
|
147411
|
147412
|
147413
|
176059
|
176060
|
176061
| 186002 |
186003
|
186004