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

(-)a/C4/Form/MessagingPreferences.pm (-3 / +3 lines)
Lines 93-99 OPTION: foreach my $option (@$messaging_options) { Link Here
93
        }
93
        }
94
94
95
        if ( $option->{'takes_days'} ) {
95
        if ( $option->{'takes_days'} ) {
96
            if ( defined $query->param( $option->{'message_attribute_id'} . '-DAYS' ) ) {
96
            if ( $query->param( $option->{'message_attribute_id'} . '-DAYS' ) ) {
97
                $updater->{'days_in_advance'} = $query->param( $option->{'message_attribute_id'} . '-DAYS' );
97
                $updater->{'days_in_advance'} = $query->param( $option->{'message_attribute_id'} . '-DAYS' );
98
            }
98
            }
99
        }
99
        }
Lines 135-141 PREF: foreach my $option (@$messaging_options) { Link Here
135
            $option->{days_in_advance} = $days_in_advance;
135
            $option->{days_in_advance} = $days_in_advance;
136
            @{ $option->{'select_days'} } = map {
136
            @{ $option->{'select_days'} } = map {
137
                {
137
                {
138
                    day      => $_,
138
                    day      => $_ || q{},
139
                    selected => $_ == $days_in_advance
139
                    selected => $_ == $days_in_advance
140
                }
140
                }
141
            } ( 0 .. MAX_DAYS_IN_ADVANCE );
141
            } ( 0 .. MAX_DAYS_IN_ADVANCE );
Lines 173-179 sub restore_form_values { Link Here
173
            $option->{days_in_advance} = $days_in_advance;
173
            $option->{days_in_advance} = $days_in_advance;
174
            @{ $option->{'select_days'} } = map {
174
            @{ $option->{'select_days'} } = map {
175
                {
175
                {
176
                    day      => $_,
176
                    day      => $_ || q{},
177
                    selected => $_ == $days_in_advance
177
                    selected => $_ == $days_in_advance
178
                }
178
                }
179
            } ( 0 .. MAX_DAYS_IN_ADVANCE );
179
            } ( 0 .. MAX_DAYS_IN_ADVANCE );
(-)a/C4/Members/Messaging.pm (-4 / +5 lines)
Lines 129-136 sub SetMessagingPreference { Link Here
129
            return;
129
            return;
130
        }
130
        }
131
    }
131
    }
132
    $params->{'days_in_advance'} = undef unless exists( $params->{'days_in_advance'} );
132
    $params->{'days_in_advance'} = undef if !exists $params->{'days_in_advance'} || $params->{'days_in_advance'} <= 0;
133
    $params->{'wants_digest'}    = 0     unless exists( $params->{'wants_digest'} );
133
    $params->{'wants_digest'}    = 0 unless exists( $params->{'wants_digest'} );
134
134
135
    my $dbh = C4::Context->dbh();
135
    my $dbh = C4::Context->dbh();
136
136
Lines 149-155 END_SQL Link Here
149
    my $sth     = $dbh->prepare($delete_sql);
149
    my $sth     = $dbh->prepare($delete_sql);
150
    my $deleted = $sth->execute(@bind_params);
150
    my $deleted = $sth->execute(@bind_params);
151
151
152
    if ( $params->{'message_transport_types'} ) {
152
    if ( $params->{'message_transport_types'}
153
        && !( $params->{'message_attribute_id'} == 2 && !$params->{'days_in_advance'} ) )
154
    {
153
        my $insert_bmp = <<'END_SQL';
155
        my $insert_bmp = <<'END_SQL';
154
INSERT INTO borrower_message_preferences
156
INSERT INTO borrower_message_preferences
155
(borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest)
157
(borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest)
156
- 

Return to bug 28308