From 42323331d1fef84f9d99b37ad571a7f4ecf8ff3a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 12 Dec 2013 21:14:24 +0100 Subject: [PATCH] Bug 11395: Fix return for ModifyRecordWithTemplate Make sure the ModifyRecordWithTemplate routine returns undef. This patch also removes a warning if GetModificationTemplates is called without parameter. Verify prove t/db_dependent/MarcModificationTemplates.t returns green. --- C4/MarcModificationTemplates.pm | 4 +++- t/db_dependent/MarcModificationTemplates.t | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm index f143acd..f8d06c1 100644 --- a/C4/MarcModificationTemplates.pm +++ b/C4/MarcModificationTemplates.pm @@ -81,7 +81,7 @@ sub GetModificationTemplates { my @templates; while ( my $template = $sth->fetchrow_hashref() ) { - $template->{'selected'} = 1 if ( $template->{'template_id'} eq $template_id ); + $template->{'selected'} = 1 if ( $template_id and $template->{'template_id'} eq $template_id ); push( @templates, $template ); } @@ -627,6 +627,8 @@ sub ModifyRecordWithTemplate { warn( $record->as_formatted() ) if DEBUG >= 10; } + + return; } 1; __END__ diff --git a/t/db_dependent/MarcModificationTemplates.t b/t/db_dependent/MarcModificationTemplates.t index 04ff80a..e58c1c0 100644 --- a/t/db_dependent/MarcModificationTemplates.t +++ b/t/db_dependent/MarcModificationTemplates.t @@ -1,6 +1,6 @@ use Modern::Perl; -use Test::More tests => 74; +use Test::More tests => 75; use_ok("MARC::Field"); use_ok("MARC::Record"); @@ -183,13 +183,11 @@ is( AddModificationTemplateAction( my $record = new_record(); -ModifyRecordWithTemplate( $template_id, $record ); +is( ModifyRecordWithTemplate( $template_id, $record ), undef, "The ModifyRecordWithTemplate returns undef" ); my $expected_record = expected_record(); is_deeply( $record, $expected_record ); -done_testing; - sub new_record { my $record = MARC::Record->new; $record->leader('03174nam a2200445 a 4500'); -- 1.7.10.4