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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 3017-3023 sub NotifyOrderUsers { Link Here
3017
                    letter         => $letter,
3017
                    letter         => $letter,
3018
                    borrowernumber => $borrowernumber,
3018
                    borrowernumber => $borrowernumber,
3019
                    LibraryName    => C4::Context->preference("LibraryName"),
3019
                    LibraryName    => C4::Context->preference("LibraryName"),
3020
                    message_transport_type => 'email',
3020
                    message_transport_type => $patron->message_transport_type_for('email'),
3021
                }
3021
                }
3022
            ) or warn "can't enqueue letter $letter";
3022
            ) or warn "can't enqueue letter $letter";
3023
        }
3023
        }
(-)a/C4/Suggestions.pm (-1 / +1 lines)
Lines 481-487 sub ModSuggestion { Link Here
481
481
482
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
482
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
483
483
484
        my $transport = (C4::Context->preference("FallbackToSMSIfNoEmail")) && ($patron->smsalertnumber) && (!$patron->email) ? 'sms' : 'email';
484
        my $transport = $patron->message_transport_type_for('email');
485
485
486
        if (
486
        if (
487
            my $letter = C4::Letters::GetPreparedLetter(
487
            my $letter = C4::Letters::GetPreparedLetter(
(-)a/Koha/Patron.pm (+22 lines)
Lines 1273-1278 sub first_valid_email_address { Link Here
1273
    return $self->email() || $self->emailpro() || $self->B_email() || q{};
1273
    return $self->email() || $self->emailpro() || $self->B_email() || q{};
1274
}
1274
}
1275
1275
1276
=head3 message_transport_type_for
1277
1278
Given a message transport type, will return the transport type that should be used,
1279
including a fallback if needed.
1280
1281
my $mtt = $patron->message_transport_type_for('email');
1282
1283
=cut
1284
1285
sub message_transport_type_for {
1286
    my ( $self, $mtt ) = @_;
1287
1288
    if ( $mtt eq 'email' ) {
1289
        return 'sms'
1290
          if C4::Context->preference("FallbackToSMSIfNoEmail")
1291
          && $self->smsalertnumber
1292
          && !$self->notice_email_address;
1293
    }
1294
1295
    return $mtt;
1296
}
1297
1276
=head3 get_club_enrollments
1298
=head3 get_club_enrollments
1277
1299
1278
=cut
1300
=cut
(-)a/circ/pendingreserves.pl (-1 / +1 lines)
Lines 89-95 if ( $op eq 'cancel_reserve' and $reserve_id ) { Link Here
89
                C4::Letters::EnqueueLetter(
89
                C4::Letters::EnqueueLetter(
90
                    {   letter                 => $letter,
90
                    {   letter                 => $letter,
91
                        borrowernumber         => $patron->borrowernumber,
91
                        borrowernumber         => $patron->borrowernumber,
92
                        message_transport_type => 'email',
92
                        message_transport_type => $patron->message_transport_type_for('email'),
93
                        from_address           => $from_address,
93
                        from_address           => $from_address,
94
                    }
94
                    }
95
                );
95
                );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 198-204 Patrons: Link Here
198
           choices:
198
           choices:
199
               1: Enable
199
               1: Enable
200
               0: Disable
200
               0: Disable
201
         - sending purchase suggestion messages by SMS if no patron email is defined.
201
         - sending notices by SMS if patron has no email address.
202
     -
202
     -
203
         - "Send automatic renewal notices: "
203
         - "Send automatic renewal notices: "
204
         - pref: AutoRenewalNotices
204
         - pref: AutoRenewalNotices
(-)a/misc/cronjobs/membership_expiry.pl (-2 / +2 lines)
Lines 225-233 while ( my $recent = $upcoming_mem_expires->next ) { Link Here
225
    } else {
225
    } else {
226
        C4::Letters::EnqueueLetter({
226
        C4::Letters::EnqueueLetter({
227
            letter                 => $letter,
227
            letter                 => $letter,
228
            borrowernumber         =>  $recent->borrowernumber,
228
            borrowernumber         => $recent->borrowernumber,
229
            from_address           => $from_address,
229
            from_address           => $from_address,
230
            message_transport_type => 'email',
230
            message_transport_type => $recent->message_transport_type_for('email'),
231
        });
231
        });
232
    }
232
    }
233
}
233
}
(-)a/opac/opac-shareshelf.pl (-2 / +1 lines)
Lines 182-188 sub notify_owner { Link Here
182
            letter                 => $letter,
182
            letter                 => $letter,
183
            message_transport_type => 'email',
183
            message_transport_type => 'email',
184
            from_address => C4::Context->preference('KohaAdminEmailAddress'),
184
            from_address => C4::Context->preference('KohaAdminEmailAddress'),
185
            to_address   => $toaddr,
185
            message_transport_type => $patron->message_transport_type_for('email'),
186
        }
186
        }
187
    );
187
    );
188
}
188
}
189
- 

Return to bug 21781