From eff8f8c0d0ce3843b215c9e501d926be93eac597 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 Nov 2014 16:13:41 +0100 Subject: [PATCH] Bug 13215: (follow-up) Fix notice edition Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- tools/letter.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/letter.pl b/tools/letter.pl index 4fcd8a8df2..ab4f78f2d6 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -254,12 +254,18 @@ sub add_validate { my $title = shift @title; my $content = shift @content; my $letter = C4::Letters::getletter( $oldmodule, $code, $branchcode, $mtt); + + # getletter can return the default letter even if we pass a branchcode + # If we got the default one and we needed the specific one, we didn't get the one we needed! + if ( $letter and $branchcode ne $letter->{branchcode} ) { + $letter = undef; + } unless ( $title and $content ) { # Delete this mtt if no title or content given delete_confirmed( $branchcode, $oldmodule, $code, $mtt ); next; } - elsif ( $letter->{message_transport_type} eq $mtt ) { + elsif ( $letter and $letter->{message_transport_type} eq $mtt ) { $dbh->do( q{ UPDATE letter -- 2.39.5