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

(-)a/C4/Letters.pm (-5 / +8 lines)
Lines 25-43 use Module::Load::Conditional qw( can_load ); Link Here
25
25
26
use Try::Tiny;
26
use Try::Tiny;
27
27
28
use C4::Members;
29
use C4::Log qw( logaction );
28
use C4::Log qw( logaction );
29
use C4::Members;
30
use C4::SMS;
30
use C4::SMS;
31
use C4::Templates;
31
use C4::Templates;
32
use Koha::SMS::Providers;
32
use Koha::Auth::TwoFactorAuth;
33
33
use Koha::DateUtils qw( dt_from_string output_pref );
34
use Koha::Email;
34
use Koha::Email;
35
use Koha::Exceptions;
35
use Koha::Notice::Messages;
36
use Koha::Notice::Messages;
36
use Koha::Notice::Templates;
37
use Koha::Notice::Templates;
37
use Koha::Notice::Util;
38
use Koha::Notice::Util;
38
use Koha::DateUtils qw( dt_from_string output_pref );
39
use Koha::Auth::TwoFactorAuth;
40
use Koha::Patrons;
39
use Koha::Patrons;
40
use Koha::SMS::Providers;
41
use Koha::SMTP::Servers;
41
use Koha::SMTP::Servers;
42
use Koha::Subscriptions;
42
use Koha::Subscriptions;
43
43
Lines 980-985 sub SendQueuedMessages { Link Here
980
    my $limit = $params->{limit};
980
    my $limit = $params->{limit};
981
    my $where = $params->{where};
981
    my $where = $params->{where};
982
982
983
    Koha::Exceptions::BadParameter->throw("Parameter message_id cannot be empty if passed.")
984
        if ( exists( $params->{message_id} ) && !$params->{message_id} );
985
983
    my $smtp_transports = {};
986
    my $smtp_transports = {};
984
987
985
    my $count_messages = 0;
988
    my $count_messages = 0;
(-)a/t/db_dependent/Letters.t (-2 / +17 lines)
Lines 18-24 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 87;
21
use Test::More tests => 90;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
use Test::Exception;
24
use Test::Exception;
Lines 158-163 my $yesterday = dt_from_string->subtract( days => 1 ); Link Here
158
Koha::Notice::Messages->find($messages->[0]->{message_id})->time_queued($yesterday)->store;
158
Koha::Notice::Messages->find($messages->[0]->{message_id})->time_queued($yesterday)->store;
159
159
160
# SendQueuedMessages
160
# SendQueuedMessages
161
162
throws_ok {
163
    C4::Letters::SendQueuedMessages( { message_id => undef } );
164
}
165
'Koha::Exceptions::BadParameter', 'Undef message_id throws an exception';
166
167
throws_ok {
168
    C4::Letters::SendQueuedMessages( { message_id => 0 } );
169
}
170
'Koha::Exceptions::BadParameter', 'message_id of 0 throws an exception';
171
172
throws_ok {
173
    C4::Letters::SendQueuedMessages( { message_id => q{} } );
174
}
175
'Koha::Exceptions::BadParameter', 'Empty string message_id throws an exception';
176
161
my $messages_processed = C4::Letters::SendQueuedMessages( { type => 'email' });
177
my $messages_processed = C4::Letters::SendQueuedMessages( { type => 'email' });
162
is($messages_processed, 0, 'No queued messages processed if type limit passed with unused type');
178
is($messages_processed, 0, 'No queued messages processed if type limit passed with unused type');
163
$messages_processed = C4::Letters::SendQueuedMessages( { type => 'sms' });
179
$messages_processed = C4::Letters::SendQueuedMessages( { type => 'sms' });
164
- 

Return to bug 34731