Bug 12922 - Do not DIE the advance_notices.pl -cronjob if no letter of type is found!!

We failed to deliver advance_notices because a template for sms's is undefined, because we don't support
sending sms' as advance_notice.
This crashed the cronjob because digests are set to die instead of the warn used in non-digest.
And we get angry customers asking for compensation!

This patch replaces the die with warn.

TEST PREPARATION:

0. Edit the ODUEDGST letter, find an undefined letter for any trasport type.

TEST PLAN:

1. Find a borrower and from the messaging preferences set the "Advance notice" transport type to
   the undefined digest. Set the "Days in Advance" to 1.
2. Check-out something for that borrower and set the due date for tomorrow.
3. Run "misc/cronjobs/advance_notices.pl -c -n -v" from the terminal.
4. BEFORE THIS PATCH: You get an error
   "No circulation PREDUEDGST letter transported by sms at /home/koha/kohaclone/C4/Letters.pm line 609."
   and the script dies.
4. AFTER THIS PATCH: You get an error
   "No circulation PREDUEDGST letter transported by sms at /home/koha/kohaclone/C4/Letters.pm line 609."
   but the script keep on going!

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
Olli-Antti Kivilahti 2014-09-15 11:38:32 +03:00 committed by Mason James
parent 558e7aaff2
commit e7eacdfaf5
1 changed files with 6 additions and 6 deletions

View File

@ -266,7 +266,7 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
message_transport_type => $transport,
} )
or warn "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter;
push @letters, $letter if $letter;
}
}
} else {
@ -302,7 +302,7 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
message_transport_type => $transport,
} )
or warn "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter;
push @letters, $letter if $letter;
}
}
}
@ -376,8 +376,8 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) {
message_transport_type => $transport,
}
)
or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter;
or warn "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter if $letter;
}
if ( @letters ) {
@ -434,8 +434,8 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) {
message_transport_type => $transport,
}
)
or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter;
or warn "no letter of type '$letter_type' found. Please see sample_notices.sql";
push @letters, $letter if $letter;
}
if ( @letters ) {