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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2951-2957 sub NotifyOrderUsers { Link Here
2951
                    letter                 => $letter,
2951
                    letter                 => $letter,
2952
                    borrowernumber         => $borrowernumber,
2952
                    borrowernumber         => $borrowernumber,
2953
                    LibraryName            => C4::Context->preference("LibraryName"),
2953
                    LibraryName            => C4::Context->preference("LibraryName"),
2954
                    message_transport_type => 'email',
2954
                    message_transport_type => $patron->message_transport_type_for('email'),
2955
                }
2955
                }
2956
            ) or warn "can't enqueue letter $letter";
2956
            ) or warn "can't enqueue letter $letter";
2957
        }
2957
        }
(-)a/C4/Suggestions.pm (-5 / +1 lines)
Lines 269-278 sub ModSuggestion { Link Here
269
269
270
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
270
        my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
271
271
272
        my $transport =
272
        my $transport = $patron->message_transport_type_for('email');
273
               ( C4::Context->preference("FallbackToSMSIfNoEmail") )
274
            && ( $patron->smsalertnumber )
275
            && ( !$patron->email ) ? 'sms' : 'email';
276
273
277
        if (
274
        if (
278
            my $letter = C4::Letters::GetPreparedLetter(
275
            my $letter = C4::Letters::GetPreparedLetter(
Lines 458-461 __END__ Link Here
458
Koha Development Team <http://koha-community.org/>
455
Koha Development Team <http://koha-community.org/>
459
456
460
=cut
457
=cut
461
(-)a/Koha/Patron.pm (-1 / +31 lines)
Lines 1949-1954 sub first_valid_email_address { Link Here
1949
    return $email;
1949
    return $email;
1950
}
1950
}
1951
1951
1952
=head3 message_transport_type_for
1953
1954
Given a message transport type, will return the transport type that should be used,
1955
including a fallback if needed.
1956
1957
my $mtt = $patron->message_transport_type_for('email');
1958
1959
=cut
1960
1961
sub message_transport_type_for {
1962
    my ( $self, $mtt ) = @_;
1963
1964
    if ( $mtt eq 'email' ) {
1965
        return 'sms'
1966
            if C4::Context->preference("FallbackToSMSIfNoEmail")
1967
            && $self->smsalertnumber
1968
            && !$self->notice_email_address;
1969
    }
1970
1971
    return $mtt;
1972
}
1973
1952
=head3 get_club_enrollments
1974
=head3 get_club_enrollments
1953
1975
1954
=cut
1976
=cut
Lines 3016-3022 sub queue_notice { Link Here
3016
            or ( $mtt eq 'phone' and not $self->phone ) )
3038
            or ( $mtt eq 'phone' and not $self->phone ) )
3017
        {
3039
        {
3018
            push @{ $return{fallback} }, $mtt;
3040
            push @{ $return{fallback} }, $mtt;
3019
            $mtt = 'print';
3041
            if (   C4::Context->preference("FallbackToSMSIfNoEmail")
3042
                && $mtt eq 'email'
3043
                && $self->smsalertnumber
3044
                && !$self->notice_email_address )
3045
            {
3046
                $mtt = 'sms';
3047
            } else {
3048
                $mtt = 'print';
3049
            }
3020
        }
3050
        }
3021
        next if $mtt eq 'print' && $print_sent;
3051
        next if $mtt eq 'print' && $print_sent;
3022
        $letter_params->{message_transport_type} = $mtt;
3052
        $letter_params->{message_transport_type} = $mtt;
(-)a/circ/pendingreserves.pl (-1 / +1 lines)
Lines 90-96 if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { Link Here
90
                    {
90
                    {
91
                        letter                 => $letter,
91
                        letter                 => $letter,
92
                        borrowernumber         => $patron->borrowernumber,
92
                        borrowernumber         => $patron->borrowernumber,
93
                        message_transport_type => 'email',
93
                        message_transport_type => $patron->message_transport_type_for('email'),
94
                        from_address           => $from_address,
94
                        from_address           => $from_address,
95
                    }
95
                    }
96
                );
96
                );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-2 / +2 lines)
Lines 265-271 Patrons: Link Here
265
           choices:
265
           choices:
266
               1: Enable
266
               1: Enable
267
               0: Disable
267
               0: Disable
268
         - sending purchase suggestion messages by SMS if no patron email is defined.
268
         - sending notices by SMS if patron has no email address.
269
     -
269
     -
270
         - "Send automatic renewal notices: "
270
         - "Send automatic renewal notices: "
271
         - pref: AutoRenewalNotices
271
         - pref: AutoRenewalNotices
Lines 526-529 Patrons: Link Here
526
             homebranch: "Home library"
526
             homebranch: "Home library"
527
             location: "Location"
527
             location: "Location"
528
             itemcallnumber: "Item's callnumber"
528
             itemcallnumber: "Item's callnumber"
529
             ccode: "Collection"
529
             ccode: "Collection"
(-)a/opac/opac-shareshelf.pl (-2 / +1 lines)
Lines 210-216 sub notify_owner { Link Here
210
            letter                 => $letter,
210
            letter                 => $letter,
211
            message_transport_type => 'email',
211
            message_transport_type => 'email',
212
            from_address           => C4::Context->preference('KohaAdminEmailAddress'),
212
            from_address           => C4::Context->preference('KohaAdminEmailAddress'),
213
            to_address             => $toaddr,
213
            message_transport_type => $patron->message_transport_type_for('email'),
214
        }
214
        }
215
    );
215
    );
216
}
216
}
217
- 

Return to bug 21781