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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2933-2939 sub NotifyOrderUsers { Link Here
2933
                    letter                 => $letter,
2933
                    letter                 => $letter,
2934
                    borrowernumber         => $borrowernumber,
2934
                    borrowernumber         => $borrowernumber,
2935
                    LibraryName            => C4::Context->preference("LibraryName"),
2935
                    LibraryName            => C4::Context->preference("LibraryName"),
2936
                    message_transport_type => 'email',
2936
                    message_transport_type => $patron->message_transport_type_for('email'),
2937
                }
2937
                }
2938
            ) or warn "can't enqueue letter $letter";
2938
            ) or warn "can't enqueue letter $letter";
2939
        }
2939
        }
(-)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 452-455 __END__ Link Here
452
Koha Development Team <http://koha-community.org/>
449
Koha Development Team <http://koha-community.org/>
453
450
454
=cut
451
=cut
455
(-)a/Koha/Patron.pm (-1 / +31 lines)
Lines 1745-1750 sub first_valid_email_address { Link Here
1745
    return $email;
1745
    return $email;
1746
}
1746
}
1747
1747
1748
=head3 message_transport_type_for
1749
1750
Given a message transport type, will return the transport type that should be used,
1751
including a fallback if needed.
1752
1753
my $mtt = $patron->message_transport_type_for('email');
1754
1755
=cut
1756
1757
sub message_transport_type_for {
1758
    my ( $self, $mtt ) = @_;
1759
1760
    if ( $mtt eq 'email' ) {
1761
        return 'sms'
1762
            if C4::Context->preference("FallbackToSMSIfNoEmail")
1763
            && $self->smsalertnumber
1764
            && !$self->notice_email_address;
1765
    }
1766
1767
    return $mtt;
1768
}
1769
1748
=head3 get_club_enrollments
1770
=head3 get_club_enrollments
1749
1771
1750
=cut
1772
=cut
Lines 2704-2710 sub queue_notice { Link Here
2704
            or ( $mtt eq 'phone' and not $self->phone ) )
2726
            or ( $mtt eq 'phone' and not $self->phone ) )
2705
        {
2727
        {
2706
            push @{ $return{fallback} }, $mtt;
2728
            push @{ $return{fallback} }, $mtt;
2707
            $mtt = 'print';
2729
            if (   C4::Context->preference("FallbackToSMSIfNoEmail")
2730
                && $mtt eq 'email'
2731
                && $self->smsalertnumber
2732
                && !$self->notice_email_address )
2733
            {
2734
                $mtt = 'sms';
2735
            } else {
2736
                $mtt = 'print';
2737
            }
2708
        }
2738
        }
2709
        next if $mtt eq 'print' && $print_sent;
2739
        next if $mtt eq 'print' && $print_sent;
2710
        $letter_params->{message_transport_type} = $mtt;
2740
        $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 264-270 Patrons: Link Here
264
           choices:
264
           choices:
265
               1: Enable
265
               1: Enable
266
               0: Disable
266
               0: Disable
267
         - sending purchase suggestion messages by SMS if no patron email is defined.
267
         - sending notices by SMS if patron has no email address.
268
     -
268
     -
269
         - "Send automatic renewal notices: "
269
         - "Send automatic renewal notices: "
270
         - pref: AutoRenewalNotices
270
         - pref: AutoRenewalNotices
Lines 523-526 Patrons: Link Here
523
             homebranch: "Home library"
523
             homebranch: "Home library"
524
             location: "Location"
524
             location: "Location"
525
             itemcallnumber: "Item's callnumber"
525
             itemcallnumber: "Item's callnumber"
526
             ccode: "Collection"
526
             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