From 4fc79075039ce3737ac7cda13f952baab299e848 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 31 Oct 2014 10:14:16 +0100 Subject: [PATCH] Bug 11319: [QA follow-up] Remove a warning from GetModificationTemplates Content-Type: text/plain; charset=utf-8 Removes this warning: Use of uninitialized value $template_id in string eq at C4/MarcModificationTemplates.pm line 84. GetModificationTemplates has no template_id if called from marc_modification_templates.pl without operation (first click from interface) and from tools/stage-marc-import.pl. Slightly adjusted the POD lines accordingly. Signed-off-by: Marcel de Rooy --- C4/MarcModificationTemplates.pm | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm index 52b28fe..a428313 100644 --- a/C4/MarcModificationTemplates.pm +++ b/C4/MarcModificationTemplates.pm @@ -66,9 +66,10 @@ files telling Koha what fields to insert data into. =head2 GetModificationTemplates - my @templates = GetModificationTemplates( [ $template_id ] ); + my @templates = GetModificationTemplates( $template_id ); + + Passing optional $template_id marks it as the selected template. - Passing a $template_id will mark the given id as the selected template. =cut sub GetModificationTemplates { @@ -81,7 +82,8 @@ 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 && $template->{'template_id'} eq $template_id; push( @templates, $template ); } -- 1.7.7.6