From 0f9066903e64aa9eb6214beade0921962bd8d6db Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Jun 2021 12:19:18 +0200 Subject: [PATCH] Bug 28487: Fallback to default template in overdue_notices There is no fallback to the "default" language if there is no language-specific template for the lang of the patron. I am not really sure why we are not using GetPreparredLetter here (which defaults), but this needs to be backported into all stable branches and so as small as possible. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 09fcc66ab89dd2c084dfe20d4b4dc43a5335b86a) Signed-off-by: Fridolin Somers --- misc/cronjobs/overdue_notices.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 8e81dd39c0..f675e4d4b9 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -600,7 +600,8 @@ END_SQL } } - my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, undef, $patron->lang ); + my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, undef, $patron->lang ) + || C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, undef, "default"); unless ($letter) { $verbose and warn qq|Message '$overdue_rules->{"letter$i"}' content not found|; @@ -691,7 +692,8 @@ END_SQL splice @items, $PrintNoticesMaxLines if $effective_mtt eq 'print' && $PrintNoticesMaxLines && scalar @items > $PrintNoticesMaxLines; #catch the case where we are sending a print to someone with an email - my $letter_exists = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, $effective_mtt, $patron->lang ) ? 1 : 0; + my $letter_exists = ( C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, $effective_mtt, $patron->lang ) + || C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"}, $branchcode, $effective_mtt, "default") ) ? 1 : 0; my $letter = parse_overdues_letter( { letter_code => $overdue_rules->{"letter$i"}, borrowernumber => $borrowernumber, -- 2.39.5