View | Details | Raw Unified | Return to bug 30515
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_30515-add_system_preferences.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30515",
5
    description => "Add system preferences for patron specific overdue notice preferences",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $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')});
11
        say $out "UsePatronPreferencesForOverdueNotices system preference added";
12
13
        $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')});
14
        say $out "UsePatronPreferencesForOverdueNoticesPrint system preference added";
15
    },
16
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+2 lines)
Lines 854-859 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
854
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
854
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
855
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
855
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
856
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
856
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
857
('UsePatronPreferencesForOverdueNotices', '0', NULL, 'Use patron specific messaging preferences for overdue notices if available', 'YesNo'),
858
('UsePatronPreferencesForOverdueNoticesPrint', 'always', 'always|fallback|never', 'When to send print notices when using patron specific messaging preferences for overdue notices', 'Choice'),
857
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
859
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
858
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
860
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
859
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
861
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (+3 lines)
Lines 37-42 Link Here
37
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
37
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
38
          [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
38
          [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
39
          [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
39
          [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
40
          [% ELSIF ( messaging_preference.Overdue1 ) %]<span>Overdue 1</span>
41
          [% ELSIF ( messaging_preference.Overdue2 ) %]<span>Overdue 2</span>
42
          [% ELSIF ( messaging_preference.Overdue3 ) %]<span>Overdue 3</span>
40
          [% ELSE %]<span>Unknown</span>
43
          [% ELSE %]<span>Unknown</span>
41
          [% END %]
44
          [% END %]
42
      </td>
45
      </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+3 lines)
Lines 719-724 Link Here
719
                                                [% ELSIF ( prefs.Ill_update ) %]<span>Interlibrary loan updated</span>
719
                                                [% ELSIF ( prefs.Ill_update ) %]<span>Interlibrary loan updated</span>
720
                                                [% ELSIF ( prefs.Auto_Renewals ) %]<span>Auto renewal</span>
720
                                                [% ELSIF ( prefs.Auto_Renewals ) %]<span>Auto renewal</span>
721
                                                [% ELSIF ( prefs.Hold_Reminder ) %]<span>Hold reminder</span>
721
                                                [% ELSIF ( prefs.Hold_Reminder ) %]<span>Hold reminder</span>
722
                                                [% ELSIF ( prefs.Overdue1 ) %]<span>Overdue 1</span>
723
                                                [% ELSIF ( prefs.Overdue2 ) %]<span>Overdue 2</span>
724
                                                [% ELSIF ( prefs.Overdue3 ) %]<span>Overdue 3</span>
722
                                                [% ELSE %]<span>Unknown</span>
725
                                                [% ELSE %]<span>Unknown</span>
723
                                                [% END %]:
726
                                                [% END %]:
724
                                                <strong>[% transport.transport | html %]</strong><br />
727
                                                <strong>[% transport.transport | html %]</strong><br />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+15 lines)
Lines 641-646 Circulation: Link Here
641
              source: LOST
641
              source: LOST
642
            - "when the outstanding balance is written off."
642
            - "when the outstanding balance is written off."
643
    Checkin policy:
643
    Checkin policy:
644
        -
645
            - Use message preferences based on
646
            - pref: UsePatronPreferencesForOverdueNotices
647
              choices:
648
                  1: individual patron preference
649
                  0: patron category
650
            - when sending overdue notices.
651
        -
652
            - When using individual patron preferences for overdue notices
653
            - pref: UsePatronPreferencesForOverdueNoticesPrint
654
              choices:
655
                  always: always
656
                  fallback: when no other transport set
657
                  never: never
658
            - print notice.
644
        -
659
        -
645
            - pref: TrapHoldsOnOrder
660
            - pref: TrapHoldsOnOrder
646
              choices:
661
              choices:
(-)a/misc/cronjobs/overdue_notices.pl (-5 / +20 lines)
Lines 25-36 use Pod::Usage qw( pod2usage ); Link Here
25
use Text::CSV_XS;
25
use Text::CSV_XS;
26
use DateTime;
26
use DateTime;
27
use DateTime::Duration;
27
use DateTime::Duration;
28
use List::MoreUtils qw( uniq );
28
29
29
use Koha::Script -cron;
30
use Koha::Script -cron;
30
use C4::Context;
31
use C4::Context;
31
use C4::Letters;
32
use C4::Letters;
32
use C4::Overdues qw( GetOverdueMessageTransportTypes parse_overdues_letter );
33
use C4::Overdues qw( GetOverdueMessageTransportTypes parse_overdues_letter );
33
use C4::Log qw( cronlogaction );
34
use C4::Log qw( cronlogaction );
35
use C4::Members::Messaging qw( GetMessagingPreferences );
34
use Koha::Patron::Debarments qw( AddUniqueDebarment );
36
use Koha::Patron::Debarments qw( AddUniqueDebarment );
35
use Koha::DateUtils qw( dt_from_string output_pref );
37
use Koha::DateUtils qw( dt_from_string output_pref );
36
use Koha::Calendar;
38
use Koha::Calendar;
Lines 711-721 END_SQL Link Here
711
                    push @items, $item_info;
713
                    push @items, $item_info;
712
                }
714
                }
713
                $sth2->finish;
715
                $sth2->finish;
714
716
                my @message_transport_types;
715
                my @message_transport_types = @{ GetOverdueMessageTransportTypes( $branchcode, $overdue_rules->{categorycode}, $i) };
717
                if (C4::Context->preference('UsePatronPreferencesForOverdueNotices')) {
716
                @message_transport_types = @{ GetOverdueMessageTransportTypes( q{}, $overdue_rules->{categorycode}, $i) }
718
                    my $patronpref = GetMessagingPreferences(
719
                        { borrowernumber => $borrowernumber, message_name => "Overdue$i"});
720
                    if ($patronpref && $patronpref->{'transports'}) {
721
                        @message_transport_types = keys %{$patronpref->{'transports'}};
722
                    }
723
                    my $print_behavior = C4::Context->preference('UsePatronPreferencesForOverdueNoticesPrint');
724
                    if (
725
                        $print_behavior eq 'always' ||
726
                        $print_behavior eq 'fallback' && !@message_transport_types
727
                    ) {
728
                        unshift(@message_transport_types, 'shift');
729
                    }
730
                } else {
731
                    @message_transport_types = @{ GetOverdueMessageTransportTypes( $branchcode, $overdue_rules->{categorycode}, $i) };
732
                    @message_transport_types = @{ GetOverdueMessageTransportTypes( q{}, $overdue_rules->{categorycode}, $i) }
717
                    unless @message_transport_types;
733
                    unless @message_transport_types;
718
734
                }
719
735
720
                my $print_sent = 0; # A print notice is not yet sent for this patron
736
                my $print_sent = 0; # A print notice is not yet sent for this patron
721
                for my $mtt ( @message_transport_types ) {
737
                for my $mtt ( @message_transport_types ) {
722
- 

Return to bug 30515