Bugzilla – Attachment 163573 Details for
Bug 30515
Move Overdue transports to patron messaging preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30515: Move Overdue transports to patron messaging preferences
Bug-30515-Move-Overdue-transports-to-patron-messag.patch (text/plain), 10.56 KB, created by
David Gustafsson
on 2024-03-20 17:23:53 UTC
(
hide
)
Description:
Bug 30515: Move Overdue transports to patron messaging preferences
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2024-03-20 17:23:53 UTC
Size:
10.56 KB
patch
obsolete
>From d7af313430328fcdec3e066ced8e65de2a6d3bc2 Mon Sep 17 00:00:00 2001 >From: Stefan Berndtsson <stefan.berndtsson@gmail.com> >Date: Wed, 27 Sep 2017 14:30:49 +0200 >Subject: [PATCH] Bug 30515: Move Overdue transports to patron messaging > preferences > >Add syspref for using patron specific message preferences for >overdue messages instead of patron category level preferences. > >To test: >1) Set UsePatronPreferencesForOverdueNotices "individual patron preference" >2) Enable some transport for a patron in the messaging preferences form >2) Check out an item and set a due date that will result in an overdue notice >4) Run the overdue_notices.pl script >5) Verify that messages has been sent for the selected transport(s) >6) Run gather_print_notices.pl and verify a print notice is generated >7) Set UsePatronPreferencesForOverdueNotices to "when no other transport > set" >8) Run the overdue_notices.pl and gather_print_notices.pl and verify > that no print notice is generated >9) Disable all transports for the patron >10) Run the overdue_notices.pl and gather_print_notices.pl and verify > that print notice is generated >11) Set UsePatronPreferencesForOverdueNotices to "never" >12) Run the overdue_notices.pl and gather_print_notices.pl and verify > that no print notice is generated >13) Enable some transport(s) for the patron >14) Run the overdue_notices.pl and gather_print_notices.pl and verify > that no print notice is generated > >Sponsored-by: Gothenburg University Library >--- > .../bug_30515-add_system_preferences.pl | 16 +++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 ++ > .../en/includes/messaging-preference-form.inc | 3 +++ > .../prog/en/modules/admin/categories.tt | 3 +++ > .../admin/preferences/circulation.pref | 17 ++++++++++++- > misc/cronjobs/overdue_notices.pl | 24 +++++++++++++++---- > 6 files changed, 60 insertions(+), 5 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_30515-add_system_preferences.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_30515-add_system_preferences.pl b/installer/data/mysql/atomicupdate/bug_30515-add_system_preferences.pl >new file mode 100644 >index 00000000000..f72a624e980 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30515-add_system_preferences.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30515", >+ description => "Add system preferences for patron specific overdue notice preferences", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('UsePatronPreferencesForOverdueNotices', '0', NULL, 'Use patron specific messaging preferences for overdue notices if available', 'YesNo')}); >+ say $out "UsePatronPreferencesForOverdueNotices system preference added"; >+ >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('UsePatronPreferencesForOverdueNoticesPrint', 'always', 'always|fallback|never', 'When to send print notices when using patron specific messaging preferences for overdue notices', 'Choice')}); >+ say $out "UsePatronPreferencesForOverdueNoticesPrint system preference added"; >+ }, >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 669074aa506..03e23a7e80c 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -819,6 +819,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'), > ('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'), > ('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'), >+('UsePatronPreferencesForOverdueNotices', '0', NULL, 'Use patron specific messaging preferences for overdue notices if available', 'YesNo'), >+('UsePatronPreferencesForOverdueNoticesPrint', 'always', 'always|fallback|never', 'When to send print notices when using patron specific messaging preferences for overdue notices', 'Choice'), > ('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'), > ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'), > ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >index 6e08c2ee160..284eece3a63 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >@@ -34,6 +34,9 @@ > [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span> > [% ELSIF ( messaging_preference.Ill_update ) %]<span>Interlibrary loan updated</span> > [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span> >+ [% ELSIF ( messaging_preference.Overdue1 ) %]<span>Overdue 1</span> >+ [% ELSIF ( messaging_preference.Overdue2 ) %]<span>Overdue 2</span> >+ [% ELSIF ( messaging_preference.Overdue3 ) %]<span>Overdue 3</span> > [% ELSE %]<span>Unknown</span> > [% END %] > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index 766e6e80e70..08819a581b1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -653,6 +653,9 @@ > [% ELSIF ( prefs.Ill_update ) %]<span>Interlibrary loan updated</span> > [% ELSIF ( prefs.Auto_Renewals ) %]<span>Auto renewal</span> > [% ELSIF ( prefs.Hold_Reminder ) %]<span>Hold reminder</span> >+ [% ELSIF ( prefs.Overdue1 ) %]<span>Overdue 1</span> >+ [% ELSIF ( prefs.Overdue2 ) %]<span>Overdue 2</span> >+ [% ELSIF ( prefs.Overdue3 ) %]<span>Overdue 3</span> > [% ELSE %]<span>Unknown</span> > [% END %]: > <strong>[% transport.transport | html %]</strong><br /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 080e8fa4948..a573b7e121a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -571,7 +571,22 @@ Circulation: > - This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value > - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan." > - Each pair of values should be on a separate line. >- Checkin policy: >+ - >+ - Use message preferences based on >+ - pref: UsePatronPreferencesForOverdueNotices >+ choices: >+ 1: individual patron preference >+ 0: patron category >+ - when sending overdue notices. >+ - >+ - When using individual patron preferences for overdue notices >+ - pref: UsePatronPreferencesForOverdueNoticesPrint >+ choices: >+ always: always >+ fallback: when no other transport set >+ never: never >+ - print notice. >+ Checkin Policy: > - > - pref: TrapHoldsOnOrder > choices: >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 6f78b2838a1..a3ff3278fc6 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -25,12 +25,14 @@ use Pod::Usage qw( pod2usage ); > use Text::CSV_XS; > use DateTime; > use DateTime::Duration; >+use List::MoreUtils qw( uniq ); > > use Koha::Script -cron; > use C4::Context; > use C4::Letters; > use C4::Overdues qw( GetOverdueMessageTransportTypes parse_overdues_letter ); > use C4::Log qw( cronlogaction ); >+use C4::Members::Messaging qw( GetMessagingPreferences ); > use Koha::Patron::Debarments qw( AddUniqueDebarment ); > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Calendar; >@@ -711,11 +713,25 @@ END_SQL > push @items, $item_info; > } > $sth2->finish; >- >- my @message_transport_types = @{ GetOverdueMessageTransportTypes( $branchcode, $overdue_rules->{categorycode}, $i) }; >- @message_transport_types = @{ GetOverdueMessageTransportTypes( q{}, $overdue_rules->{categorycode}, $i) } >+ my @message_transport_types; >+ if (C4::Context->preference('UsePatronPreferencesForOverdueNotices')) { >+ my $patronpref = GetMessagingPreferences( >+ { borrowernumber => $borrowernumber, message_name => "Overdue$i"}); >+ if ($patronpref && $patronpref->{'transports'}) { >+ @message_transport_types = keys %{$patronpref->{'transports'}}; >+ } >+ my $print_behavior = C4::Context->preference('UsePatronPreferencesForOverdueNoticesPrint'); >+ if ( >+ $print_behavior eq 'always' || >+ $print_behavior eq 'fallback' && !@message_transport_types >+ ) { >+ unshift(@message_transport_types, 'shift'); >+ } >+ } else { >+ @message_transport_types = @{ GetOverdueMessageTransportTypes( $branchcode, $overdue_rules->{categorycode}, $i) }; >+ @message_transport_types = @{ GetOverdueMessageTransportTypes( q{}, $overdue_rules->{categorycode}, $i) } > unless @message_transport_types; >- >+ } > > my $print_sent = 0; # A print notice is not yet sent for this patron > for my $mtt ( @message_transport_types ) { >-- >2.43.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 30515
:
163564
|
163573
|
163574