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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2881-2887 sub NotifyOrderUsers { Link Here
2881
                    letter         => $letter,
2881
                    letter         => $letter,
2882
                    borrowernumber => $borrowernumber,
2882
                    borrowernumber => $borrowernumber,
2883
                    LibraryName    => C4::Context->preference("LibraryName"),
2883
                    LibraryName    => C4::Context->preference("LibraryName"),
2884
                    message_transport_type => 'email',
2884
                    message_transport_type => $patron->message_transport_type_for('email'),
2885
                }
2885
                }
2886
            ) or warn "can't enqueue letter $letter";
2886
            ) or warn "can't enqueue letter $letter";
2887
        }
2887
        }
(-)a/C4/Suggestions.pm (-4 / +1 lines)
Lines 263-272 sub ModSuggestion { Link Here
263
263
264
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
264
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
265
265
266
        my $transport =
266
        my $transport = $patron->message_transport_type_for('email');
267
               ( C4::Context->preference("FallbackToSMSIfNoEmail") )
268
            && ( $patron->smsalertnumber )
269
            && ( !$patron->email ) ? 'sms' : 'email';
270
267
271
        if (
268
        if (
272
            my $letter = C4::Letters::GetPreparedLetter(
269
            my $letter = C4::Letters::GetPreparedLetter(
(-)a/Koha/Patron.pm (+22 lines)
Lines 1686-1691 sub first_valid_email_address { Link Here
1686
    return $email;
1686
    return $email;
1687
}
1687
}
1688
1688
1689
=head3 message_transport_type_for
1690
1691
Given a message transport type, will return the transport type that should be used,
1692
including a fallback if needed.
1693
1694
my $mtt = $patron->message_transport_type_for('email');
1695
1696
=cut
1697
1698
sub message_transport_type_for {
1699
    my ( $self, $mtt ) = @_;
1700
1701
    if ( $mtt eq 'email' ) {
1702
        return 'sms'
1703
          if C4::Context->preference("FallbackToSMSIfNoEmail")
1704
          && $self->smsalertnumber
1705
          && !$self->notice_email_address;
1706
    }
1707
1708
    return $mtt;
1709
}
1710
1689
=head3 get_club_enrollments
1711
=head3 get_club_enrollments
1690
1712
1691
=cut
1713
=cut
(-)a/circ/pendingreserves.pl (-1 / +1 lines)
Lines 87-93 if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { Link Here
87
                C4::Letters::EnqueueLetter(
87
                C4::Letters::EnqueueLetter(
88
                    {   letter                 => $letter,
88
                    {   letter                 => $letter,
89
                        borrowernumber         => $patron->borrowernumber,
89
                        borrowernumber         => $patron->borrowernumber,
90
                        message_transport_type => 'email',
90
                        message_transport_type => $patron->message_transport_type_for('email'),
91
                        from_address           => $from_address,
91
                        from_address           => $from_address,
92
                    }
92
                    }
93
                );
93
                );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 261-267 Patrons: Link Here
261
           choices:
261
           choices:
262
               1: Enable
262
               1: Enable
263
               0: Disable
263
               0: Disable
264
         - sending purchase suggestion messages by SMS if no patron email is defined.
264
         - sending notices by SMS if patron has no email address.
265
     -
265
     -
266
         - "Send automatic renewal notices: "
266
         - "Send automatic renewal notices: "
267
         - pref: AutoRenewalNotices
267
         - pref: AutoRenewalNotices
(-)a/misc/cronjobs/membership_expiry.pl (-2 / +2 lines)
Lines 290-298 while ( my $recent = $upcoming_mem_expires->next ) { Link Here
290
290
291
    C4::Letters::EnqueueLetter({
291
    C4::Letters::EnqueueLetter({
292
        letter                 => $letter,
292
        letter                 => $letter,
293
        borrowernumber         =>  $recent->borrowernumber,
293
        borrowernumber         => $recent->borrowernumber,
294
        from_address           => $from_address,
294
        from_address           => $from_address,
295
        message_transport_type => 'email',
295
        message_transport_type => $recent->message_transport_type_for('email'),
296
    });
296
    });
297
    $count_enqueued++;
297
    $count_enqueued++;
298
298
(-)a/opac/opac-shareshelf.pl (-2 / +1 lines)
Lines 205-211 sub notify_owner { Link Here
205
            letter                 => $letter,
205
            letter                 => $letter,
206
            message_transport_type => 'email',
206
            message_transport_type => 'email',
207
            from_address => C4::Context->preference('KohaAdminEmailAddress'),
207
            from_address => C4::Context->preference('KohaAdminEmailAddress'),
208
            to_address   => $toaddr,
208
            message_transport_type => $patron->message_transport_type_for('email'),
209
        }
209
        }
210
    );
210
    );
211
}
211
}
212
- 

Return to bug 21781