From 97508b9fc811b90c2533c34864a18da28c52d4b3 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 --- tools/letter.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/letter.pl b/tools/letter.pl index 4fcd8a8..ab4f78f 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.1.0