From 6507565ef00605aa75d0d42e5ee8b278dc0c3000 Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Thu, 28 Mar 2024 13:52:05 +0100 Subject: [PATCH] - add special handling if IE-XML has no lzaid --- perl/exit_strategy.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/perl/exit_strategy.pl b/perl/exit_strategy.pl index 014a7e5..ec5d2fa 100644 --- a/perl/exit_strategy.pl +++ b/perl/exit_strategy.pl @@ -255,7 +255,8 @@ SQL_DELETE_PLAN # $ret{"dcrecords"} = \@dcrecords; ############################################################################### { - my $lza_id_counter = 0; + my $lza_id_counter=0; + my %lza_id_counter_hash; sub write_addsql($dbh, $plans, $refhash) { my $iefile = basename($refhash->{"filename"}); my ($ieid, $ieversion); @@ -273,8 +274,13 @@ SQL_DELETE_PLAN } @{$refhash->{"dcrecords"}}; my $lza_id = @{$lza_id_kv}[1]; if (!defined $lza_id) { - $lza_id = sprintf("SLUB:LZA:migration_from_rosetta:unknown_%05lu", $lza_id_counter++); - warn ("no lza id detected on $refhash->{filename}, using $lza_id now!"); + if (!exists( $lza_id_counter_hash{ $ieid} )) { + $lza_id = sprintf("SLUB:LZA:migration_from_rosetta:unknown_%05lu", $lza_id_counter++); + warn("no lza id detected on $refhash->{filename}, using $lza_id now!"); + $lza_id_counter_hash{ $ieid} = $lza_id; + } else { + $lza_id = $lza_id_counter_hash{ $ieid}; + } } # start SQL insert eval {$plans->{aip}->execute($ieid, $lza_id, $ieversion)} or die "sql problem detected with $ieid ($ieversion), plz check if there is a dublette dir, ", $dbh->errstr; -- GitLab