From ab586abaee5efac2e5f7b652c5b226465698fb87 Mon Sep 17 00:00:00 2001 From: Jon Knight Date: Wed, 23 Aug 2017 09:03:38 +0000 Subject: [PATCH] Bug 18690: Add error if there are multiple MARC templates with the same name Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- misc/migration_tools/bulkmarcimport.pl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index f71d885674..e444558932 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -122,13 +122,19 @@ if(defined $localcust) { #local customize module if($marc_mod_template ne '') { my @templates = GetModificationTemplates(); foreach my $this_template (@templates) { - if($this_template->{'name'} eq $marc_mod_template) { - $marc_mod_template_id = $this_template->{'template_id'}; - last; - } + if($this_template->{'name'} eq $marc_mod_template) { + if($marc_mod_template_id < 0) { + $marc_mod_template_id = $this_template->{'template_id'}; + } else { + print "WARNING: MARC modification template name " . + "'$marc_mod_template' matches multiple templates. " . + "Please rename these templates\n"; + exit 1; + } + } } if($marc_mod_template_id < 0) { - die "Can't located MARC modification template '$marc_mod_template'\n"; + die "Can't located MARC modification template '$marc_mod_template'\n"; } } -- 2.39.5