Skip to content
Snippets Groups Projects
Commit 249d74b1 authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- added error message for PPNs without record data

parent 25a1cdb9
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ use File::Basename; ...@@ -31,6 +31,7 @@ use File::Basename;
use File::Copy qw(cp); use File::Copy qw(cp);
use File::Find; use File::Find;
use File::Path; use File::Path;
use Path::Tiny;
use Getopt::Long; use Getopt::Long;
use LWP::UserAgent; # to get MARC data use LWP::UserAgent; # to get MARC data
use MARC::Record; use MARC::Record;
...@@ -81,7 +82,7 @@ if ((!defined $ppn) && (!defined $noppn)) { confess("you need to specify a PPN ...@@ -81,7 +82,7 @@ if ((!defined $ppn) && (!defined $noppn)) { confess("you need to specify a PPN
if (!defined $output) { confess("you need to specify an output path, where the SIP will be stored"); } if (!defined $output) { confess("you need to specify an output path, where the SIP will be stored"); }
if (!defined $external_conservation_flag) { $external_conservation_flag="false"; } else { $external_conservation_flag="true"; } if (!defined $external_conservation_flag) { $external_conservation_flag="false"; } else { $external_conservation_flag="true"; }
if (! -d $directory) { confess("you need to specify an IE directory, which needs to be archived, $!"); } if (! -d $directory) { confess("you need to specify an IE directory, which needs to be archived, $!"); }
if ($directory !~ m#^/#) { $directory = abs_path($directory); } $directory = abs_path($directory);
if ($external_id !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external ID (^[a-z0-9]+\$)"); } if ($external_id !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external ID (^[a-z0-9]+\$)"); }
if ($external_workflow !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external workflow (^[a-z0-9]+\$)"); } if ($external_workflow !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external workflow (^[a-z0-9]+\$)"); }
if (!$external_value_descr) { confess("you need to specify an external value description (reason for archiving)"); } if (!$external_value_descr) { confess("you need to specify an external value description (reason for archiving)"); }
...@@ -238,9 +239,9 @@ sub get_mods_from ($$$$) { # $mods = ($url, $ppn, $searchkey, $recordschema) ...@@ -238,9 +239,9 @@ sub get_mods_from ($$$$) { # $mods = ($url, $ppn, $searchkey, $recordschema)
say "write DEBUG_${ppn}_response.xml"; say "write DEBUG_${ppn}_response.xml";
write_file("DEBUG_${ppn}_response.xml", $record->decoded_content); write_file("DEBUG_${ppn}_response.xml", $record->decoded_content);
} }
my $marcblob = $parser->parse_string( my $recordData = $xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*');
$xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*') if (!$recordData) { die("ERROR: Did not get any <recordData/> for PPN '$ppn' using '$sru'"); }
); my $marcblob = $parser->parse_string( $recordData );
my $marcblob_patched = patch_marc_response( $marcblob ); my $marcblob_patched = patch_marc_response( $marcblob );
if ($with_debug) { if ($with_debug) {
say "write DEBUG_${ppn}_marc_unpatched.xml"; say "write DEBUG_${ppn}_marc_unpatched.xml";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment