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

(-)a/C4/Form/MessagingPreferences.pm (+7 lines)
Lines 74-79 sub handle_form_action { Link Here
74
    my ( $query, $target_params, $template, $insert, $categorycode ) = @_;
74
    my ( $query, $target_params, $template, $insert, $categorycode ) = @_;
75
    my $messaging_options = C4::Members::Messaging::GetMessagingOptions();
75
    my $messaging_options = C4::Members::Messaging::GetMessagingOptions();
76
76
77
    my $patron_odue_notices = C4::Context->multivalue_preference('UsePatronPreferencesForOverdueNotices');
78
77
    # TODO: If a "NONE" box and another are checked somehow (javascript failed), we should pay attention to the "NONE" box
79
    # TODO: If a "NONE" box and another are checked somehow (javascript failed), we should pay attention to the "NONE" box
78
    my $prefs_set = 0;
80
    my $prefs_set = 0;
79
OPTION: foreach my $option (@$messaging_options) {
81
OPTION: foreach my $option (@$messaging_options) {
Lines 98-103 OPTION: foreach my $option (@$messaging_options) { Link Here
98
            }
100
            }
99
        }
101
        }
100
102
103
        if ( $option->{message_name} =~ m{^Overdue} && !grep { $option->{message_name} eq $_ } @$patron_odue_notices ) {
104
105
            # If the user is not allowed to set this Overdue message we reset it
106
            $updater->{message_transport_types} = [];
107
        }
101
        C4::Members::Messaging::SetMessagingPreference($updater);
108
        C4::Members::Messaging::SetMessagingPreference($updater);
102
    }
109
    }
103
110
(-)a/installer/data/mysql/atomicupdate/bug_40791.pl (+25 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "40791",
5
    description => "Make UsePatronPreferencesForOverdueNotices multi-valuated",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        my ( $UsePatronPreferencesForOverdueNotices, $type ) = $dbh->selectrow_array(
11
            q{SELECT value, type FROM systempreferences WHERE variable='UsePatronPreferencesForOverdueNotices'});
12
13
        if ( $type ne 'multiple' ) {
14
            my $new_value = $UsePatronPreferencesForOverdueNotices ? q{Overdue1,Overdue2,Overdue3} : q{};
15
16
            $dbh->do(
17
                q{
18
                    UPDATE systempreferences
19
                    SET value=?, options='Overdue1,Overdue2,Overdue3', explanation='Select patron specific messaging preferences for overdue notices', type='multiple'
20
                    WHERE variable="UsePatronPreferencesForOverdueNotices"
21
                }, undef, $new_value
22
            );
23
        }
24
    },
25
    }
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 873-879 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
873
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
873
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
874
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
874
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
875
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
875
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
876
('UsePatronPreferencesForOverdueNotices', '0', NULL, 'Use patron specific messaging preferences for overdue notices if available', 'YesNo'),
876
('UsePatronPreferencesForOverdueNotices', '', 'Overdue1|Overdue2|Overdue3', 'Select patron specific messaging preferences for overdue notices if available', 'multiple'),
877
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
877
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
878
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
878
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
879
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
879
('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 19-30 Link Here
19
        </tr>
19
        </tr>
20
    </thead>
20
    </thead>
21
    <tbody>
21
    <tbody>
22
        [% SET UsePatronPreferencesForOverdueNotices = Koha.MultivaluePreference('UsePatronPreferencesForOverdueNotices') %]
22
        [% FOREACH messaging_preference IN messaging_preferences %]
23
        [% FOREACH messaging_preference IN messaging_preferences %]
23
            [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
24
            [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
24
            [% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %]
25
            [% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %]
25
            [% NEXT IF messaging_preference.Patron_Expiry && (category.enforce_expiry_notice || patron.category.enforce_expiry_notice) %]
26
            [% NEXT IF messaging_preference.Patron_Expiry && (category.enforce_expiry_notice || patron.category.enforce_expiry_notice) %]
26
            [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
27
            [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
27
            [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
28
            [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
29
            [% NEXT IF messaging_preference.message_name.match('^Overdue') && !UsePatronPreferencesForOverdueNotices.grep(messaging_preference.message_name).size %]
30
28
            <tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
31
            <tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
29
                <td
32
                <td
30
                    >[% IF ( messaging_preference.Item_Due ) %]
33
                    >[% IF ( messaging_preference.Item_Due ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-5 / +5 lines)
Lines 642-653 Circulation: Link Here
642
            - "when the outstanding balance is written off."
642
            - "when the outstanding balance is written off."
643
    Checkin policy:
643
    Checkin policy:
644
        -
644
        -
645
            - Use message preferences based on
645
            - Use patron preferences for the following overdue notices:
646
            - pref: UsePatronPreferencesForOverdueNotices
646
            - pref: UsePatronPreferencesForOverdueNotices
647
              choices:
647
              multiple:
648
                  1: individual patron preference
648
                  Overdue1: Overdue 1
649
                  0: patron category
649
                  Overdue2: Overdue 2
650
            - when sending overdue notices.
650
                  Overdue3: Overdue 3
651
        -
651
        -
652
            - pref: TrapHoldsOnOrder
652
            - pref: TrapHoldsOnOrder
653
              choices:
653
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (+2 lines)
Lines 72-83 Link Here
72
                                        </tr>
72
                                        </tr>
73
                                    </thead>
73
                                    </thead>
74
                                    <tbody>
74
                                    <tbody>
75
                                        [% SET UsePatronPreferencesForOverdueNotices = Koha.MultivaluePreference('UsePatronPreferencesForOverdueNotices') %]
75
                                        [% FOREACH messaging_preference IN messaging_preferences %]
76
                                        [% FOREACH messaging_preference IN messaging_preferences %]
76
                                            [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
77
                                            [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
77
                                            [% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %]
78
                                            [% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %]
78
                                            [% NEXT IF messaging_preference.Patron_Expiry && enforce_expiry_notice %]
79
                                            [% NEXT IF messaging_preference.Patron_Expiry && enforce_expiry_notice %]
79
                                            [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
80
                                            [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
80
                                            [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
81
                                            [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
82
                                            [% NEXT IF messaging_preference.message_name.match('^Overdue') && !UsePatronPreferencesForOverdueNotices.grep(messaging_preference.message_name).size %]
81
                                            <tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
83
                                            <tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
82
                                                <td
84
                                                <td
83
                                                    >[% IF ( messaging_preference.Item_Due ) %]
85
                                                    >[% IF ( messaging_preference.Item_Due ) %]
(-)a/misc/cronjobs/overdue_notices.pl (-6 / +9 lines)
Lines 749-759 END_SQL Link Here
749
                $sth2->finish;
749
                $sth2->finish;
750
750
751
                my @message_transport_types;
751
                my @message_transport_types;
752
                if ( C4::Context->preference('UsePatronPreferencesForOverdueNotices') ) {
752
                if ( my $patron_odue_notices =
753
                    my $patronpref = C4::Members::Messaging::GetMessagingPreferences(
753
                    C4::Context->multivalue_preference('UsePatronPreferencesForOverdueNotices') )
754
                        { borrowernumber => $borrowernumber, message_name => "Overdue$i" } );
754
                {
755
                    if ( $patronpref && $patronpref->{'transports'} ) {
755
                    if ( grep { "Overdue$i" eq $_ } @$patron_odue_notices ) {
756
                        @message_transport_types = keys %{ $patronpref->{'transports'} };
756
                        my $patronpref = C4::Members::Messaging::GetMessagingPreferences(
757
                            { borrowernumber => $borrowernumber, message_name => "Overdue$i" } );
758
                        if ( $patronpref && $patronpref->{'transports'} ) {
759
                            @message_transport_types = keys %{ $patronpref->{'transports'} };
760
                        }
757
                    }
761
                    }
758
                }
762
                }
759
763
760
- 

Return to bug 40791