From d42f694ae3d72e06e3da5b4d165a66edec8f5f6d 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 7696af2..ba51a74 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 ); } @@ -624,6 +624,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 8e86861..85dce56 100644 --- a/t/db_dependent/MarcModificationTemplates.t +++ b/t/db_dependent/MarcModificationTemplates.t @@ -1,6 +1,6 @@ use Modern::Perl; -use Test::More tests => 77; +use Test::More tests => 78; use_ok("MARC::Field"); use_ok("MARC::Record"); @@ -208,13 +208,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'); -- 2.0.0.rc2