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

(-)a/C4/Letters.pm (+1 lines)
Lines 1602-1607 sub _send_message_by_sms { Link Here
1602
        {
1602
        {
1603
            destination => $patron->smsalertnumber,
1603
            destination => $patron->smsalertnumber,
1604
            message     => $message->{'content'},
1604
            message     => $message->{'content'},
1605
            message_id  => $message->{'message_id'},
1605
        }
1606
        }
1606
    );
1607
    );
1607
1608
(-)a/C4/SMS.pm (-1 / +2 lines)
Lines 74-80 sub send_sms { Link Here
74
    my $self = shift;
74
    my $self = shift;
75
    my $params= shift;
75
    my $params= shift;
76
76
77
    foreach my $required_parameter ( qw( message destination ) ) {
77
    foreach my $required_parameter ( qw( message destination message_id ) ) {
78
        # Should I warn in some way?
78
        # Should I warn in some way?
79
        return unless defined $params->{ $required_parameter };
79
        return unless defined $params->{ $required_parameter };
80
    }
80
    }
Lines 120-125 sub send_sms { Link Here
120
        $sent = $sender->send_sms(
120
        $sent = $sender->send_sms(
121
            to   => $params->{destination},
121
            to   => $params->{destination},
122
            text => $params->{message},
122
            text => $params->{message},
123
            _message_id => $params->{'message_id'},
123
        );
124
        );
124
    };
125
    };
125
126
(-)a/t/SMS.t (-2 / +11 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use t::lib::Mocks;
20
use t::lib::Mocks;
21
21
22
use Test::More tests => 7;
22
use Test::More tests => 8;
23
23
24
BEGIN {
24
BEGIN {
25
    use_ok('C4::SMS', qw( driver send_sms ));
25
    use_ok('C4::SMS', qw( driver send_sms ));
Lines 38-54 is( $send_sms, undef, 'send_sms without arguments returns undef' ); Link Here
38
38
39
$send_sms = C4::SMS->send_sms({
39
$send_sms = C4::SMS->send_sms({
40
    destination => 'my destination',
40
    destination => 'my destination',
41
    message_id => 1,
41
});
42
});
42
is( $send_sms, undef, 'send_sms without message returns undef' );
43
is( $send_sms, undef, 'send_sms without message returns undef' );
43
44
44
$send_sms = C4::SMS->send_sms({
45
$send_sms = C4::SMS->send_sms({
45
    message => 'my message',
46
    message => 'my message',
47
    message_id => 1,
46
});
48
});
47
is( $send_sms, undef, 'send_sms without destination returns undef' );
49
is( $send_sms, undef, 'send_sms without destination returns undef' );
48
50
49
$send_sms = C4::SMS->send_sms({
51
$send_sms = C4::SMS->send_sms({
50
    destination => 'my destination',
52
    destination => 'my destination',
51
    message => 'my message',
53
    message => 'my message',
54
});
55
is( $send_sms, undef, 'send_sms without message_id returns undef' );
56
57
$send_sms = C4::SMS->send_sms({
58
    destination => 'my destination',
59
    message => 'my message',
60
    message_id => 1,
52
    driver => '',
61
    driver => '',
53
});
62
});
54
is( $send_sms, undef, 'send_sms with an undef driver returns undef' );
63
is( $send_sms, undef, 'send_sms with an undef driver returns undef' );
Lines 57-62 $send_sms = C4::SMS->send_sms({ Link Here
57
    destination => '+33123456789',
66
    destination => '+33123456789',
58
    message => 'my message',
67
    message => 'my message',
59
    driver => 'Test',
68
    driver => 'Test',
69
    message_id => 1,
60
});
70
});
61
is( $send_sms, 1, 'send_sms returns 1' );
71
is( $send_sms, 1, 'send_sms returns 1' );
62
72
63
- 

Return to bug 31481