Bug 18478 - QA Followup

Make sure to build necessary letters
Fix awkward construction

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2017-05-23 16:11:06 -04:00 committed by Kyle M Hall
parent e704be99dc
commit 8f726ae06d
2 changed files with 19 additions and 3 deletions

View file

@ -1054,7 +1054,7 @@ sub SendQueuedMessages {
_set_message_status( { message_id => $message->{'message_id'}, status => 'failed' } );
next MESSAGE;
}
$message->{to_address} = $message->{to_address} ? $message->{to_address} : $member->{'smsalertnumber'};
$message->{to_address} ||= $member->{'smsalertnumber'};
unless ( $message->{to_address} && $member->{'smsalertnumber'} ) {
_set_message_status( { message_id => $message->{'message_id'}, status => 'failed' } );
warn sprintf( "No smsalertnumber found for patron %s!", $message->{'borrowernumber'} ) if $params->{'verbose'} or $debug;

View file

@ -733,14 +733,30 @@ subtest '_koha_notify_reserve() tests' => sub {
};
my $mp = Test::MockModule->new( 'C4::Members::Messaging' );
$mp->mock("GetMessagingPreferences",$wants_hold_and_email);
my $sms_hold_notice = $builder->build_object({
class => 'Koha::Notice::Templates',
$dbh->do('DELETE FROM letter');
my $email_hold_notice = $builder->build({
source => 'Letter',
value => {
message_transport_type => 'email',
branchcode => '',
code => 'HOLD',
module => 'reserves',
lang => 'default',
}
});
my $sms_hold_notice = $builder->build({
source => 'Letter',
value => {
message_transport_type => 'sms',
branchcode => '',
code => 'HOLD',
module => 'reserves',
lang=>'default',
}
});