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

(-)a/C4/Letters.pm (+1 lines)
Lines 1620-1625 sub _send_message_by_sms { Link Here
1620
        {
1620
        {
1621
            destination => $patron->smsalertnumber,
1621
            destination => $patron->smsalertnumber,
1622
            message     => $message->{'content'},
1622
            message     => $message->{'content'},
1623
            message_id  => $message->{'message_id'},
1623
        }
1624
        }
1624
    );
1625
    );
1625
1626
(-)a/C4/SMS.pm (-1 / +2 lines)
Lines 78-84 sub send_sms { Link Here
78
    my $self = shift;
78
    my $self = shift;
79
    my $params= shift;
79
    my $params= shift;
80
80
81
    foreach my $required_parameter ( qw( message destination ) ) {
81
    foreach my $required_parameter ( qw( message destination message_id ) ) {
82
        # Should I warn in some way?
82
        # Should I warn in some way?
83
        return unless defined $params->{ $required_parameter };
83
        return unless defined $params->{ $required_parameter };
84
    }
84
    }
Lines 132-137 sub send_sms { Link Here
132
        $sent = $sender->send_sms(
132
        $sent = $sender->send_sms(
133
            to   => $params->{destination},
133
            to   => $params->{destination},
134
            text => $params->{message},
134
            text => $params->{message},
135
            _message_id => $params->{'message_id'},
135
        );
136
        );
136
    };
137
    };
137
138
(-)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 => 8;
22
use Test::More tests => 9;
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-43 is( $send_sms, undef, 'send_sms without arguments returns undef' ); Link Here
38
($send_sms) = C4::SMS->send_sms(
38
($send_sms) = C4::SMS->send_sms(
39
    {
39
    {
40
        destination => 'my destination',
40
        destination => 'my destination',
41
        message_id => 1,
41
    }
42
    }
42
);
43
);
43
is( $send_sms, undef, 'send_sms without message returns undef' );
44
is( $send_sms, undef, 'send_sms without message returns undef' );
Lines 45-58 is( $send_sms, undef, 'send_sms without message returns undef' ); Link Here
45
($send_sms) = C4::SMS->send_sms(
46
($send_sms) = C4::SMS->send_sms(
46
    {
47
    {
47
        message => 'my message',
48
        message => 'my message',
49
        message_id => 1,
48
    }
50
    }
49
);
51
);
50
is( $send_sms, undef, 'send_sms without destination returns undef' );
52
is( $send_sms, undef, 'send_sms without destination returns undef' );
51
53
54
$send_sms = C4::SMS->send_sms({
55
    destination => 'my destination',
56
    message => 'my message',
57
});
58
is( $send_sms, undef, 'send_sms without message_id returns undef' );
59
52
( $send_sms, $error ) = C4::SMS->send_sms(
60
( $send_sms, $error ) = C4::SMS->send_sms(
53
    {
61
    {
54
        destination => 'my destination',
62
        destination => 'my destination',
55
        message     => 'my message',
63
        message     => 'my message',
64
        message_id => 1,
56
        driver      => '',
65
        driver      => '',
57
    }
66
    }
58
);
67
);
Lines 64-69 is( $error, 'SMS_SEND_DRIVER_MISSING', 'Error code returned is SMS_SEND_DRIVE Link Here
64
        destination => '+33123456789',
73
        destination => '+33123456789',
65
        message     => 'my message',
74
        message     => 'my message',
66
        driver      => 'Test',
75
        driver      => 'Test',
76
        message_id => 1,
67
    }
77
    }
68
);
78
);
69
is( $send_sms, 1, 'send_sms returns 1' );
79
is( $send_sms, 1, 'send_sms returns 1' );
70
- 

Return to bug 31481