From 16a2e243eaa64a7f22d6b4ace4a3b9dcb25afcd4 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 24 Nov 2013 23:19:16 +0100 Subject: [PATCH] check year validity and report invalid_year in $skip --- html.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/html.pl b/html.pl index ef041d2..84d54e2 100755 --- a/html.pl +++ b/html.pl @@ -155,7 +155,12 @@ while( my $row = $sth_select_authors->fetchrow_hashref ) { if ($elt->localname eq 'controlfield') { if ( $tag eq '008' ) { - $biblio_year->{ $row->{biblionumber} } = $data->{year} = substr($elt->textContent, 7, 4 ); + my $year = substr($elt->textContent, 7, 4 ); + if ( $year !~ m/^\d+$/ ) { + $year = 0; + push @{ $skip->{invalid_year} }, $row->{biblionumber}; + } + $biblio_year->{ $row->{biblionumber} } = $data->{year} = $year; } next; } elsif ($elt->localname eq 'datafield') { -- 2.20.1