Skip to content
Snippets Groups Projects
Commit cbc86823 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added handling, if LZA-ID does not exist (generate a dummy LZA-ID...

- added handling, if LZA-ID does not exist (generate a dummy LZA-ID 'SLUB:LZA:migration_from_rosetta:unknown_xxxxxx')
parent 9523246f
No related branches found
No related tags found
No related merge requests found
......@@ -254,12 +254,16 @@ SQL_DELETE_PLAN
# $ret{"files"} = \@files;
# $ret{"dcrecords"} = \@dcrecords;
###############################################################################
{
my $lza_id_counter = 0;
sub write_addsql($dbh, $plans, $refhash) {
my $iefile = basename($refhash->{"filename"});
my ($ieid, $ieversion);
if ($iefile =~ m/^V(\d+)-(IE\d*)\.xml$/) {
$ieversion=$1; $ieid=$2;
} else {
$ieversion = $1;
$ieid = $2;
}
else {
die "Could not detect PID and Version from IEFile '$iefile'\n";
}
my $lza_id_kv = List::Util::first {
......@@ -268,7 +272,10 @@ sub write_addsql ($dbh, $plans, $refhash) {
and (check_lzaid($dcvalue))
} @{$refhash->{"dcrecords"}};
my $lza_id = @{$lza_id_kv}[1];
if (! defined $lza_id) { $lza_id = "";}
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!");
}
# 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;
# FIXME if multiple locations exists
......@@ -298,6 +305,7 @@ sub write_addsql ($dbh, $plans, $refhash) {
}
return 1;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment