From: Dobrica Pavlinusic Date: Wed, 21 Nov 2007 10:09:55 +0000 (+0000) Subject: r1661@llin: dpavlin | 2007-11-21 11:09:52 +0100 X-Git-Url: http://git.rot13.org/?p=webpac2;a=commitdiff_plain;h=d5fe5d95d47f109bb40da6e314b4674d73d8b36b;hp=5e7646d2fc344be951099e4d03b7347cbb4075ba r1661@llin: dpavlin | 2007-11-21 11:09:52 +0100 fix marc_template hadling of field value 0 git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1062 07558da8-63fa-0310-ba24-9fe276d99e06 --- diff --git a/TODO b/TODO index df6ce18..3394728 100644 --- a/TODO +++ b/TODO @@ -49,6 +49,7 @@ + indicator(field,nr) nr=1|2 for MARC input -> rec(field,'i1') or rec(field,'i2') + validator don't accept 0 as valid subfield + subroutines gets mungled in normalization files [2.33] ++ fix marc_template hadling of field value 0 - rewrite WebPAC::Input to be based on Module::Pluggable - check usage of config in normalize file (database, input name?) - load_ds/save_ds should use on-disk hash to preserve inodes diff --git a/lib/WebPAC/Normalize/MARC.pm b/lib/WebPAC/Normalize/MARC.pm index 1f5896c..2126483 100644 --- a/lib/WebPAC/Normalize/MARC.pm +++ b/lib/WebPAC/Normalize/MARC.pm @@ -223,7 +223,8 @@ sub marc_template { foreach my $sf ( @{ $_template->{$name}->{order}->{$template} } ) { my ( $sf, $nr ) = @$sf; - my $v = $fill_in->{$sf}->[$nr] || die "can't find fill_in $sf/$nr"; + my $v = $fill_in->{$sf}->[$nr]; + die "can't find fill_in $sf/$nr" unless defined $v; if ( $name eq 'isis') { ( $sf, $nr ) = @{ $from_mapping->{$sf}->[$nr] }; } diff --git a/t/3-normalize-marc.t b/t/3-normalize-marc.t index 1ed57dc..0a29c27 100755 --- a/t/3-normalize-marc.t +++ b/t/3-normalize-marc.t @@ -3,7 +3,7 @@ use strict; use blib; -use Test::More tests => 262; +use Test::More tests => 325; BEGIN { use_ok( 'WebPAC::Test' ); @@ -49,6 +49,8 @@ my $rec = { 'v' => 'v-8-1', },{ 'v' => 'v-9-1', + },{ + 'v' => '0', }], }; @@ -102,6 +104,7 @@ my $marc_out = [ [440, "0", "1", "a", "a-7-1"], [440, "0", "1", "a", "a-8-1 ;", "v", "v-8-1"], [440, "0", "1", "v", "v-9-1"], + [440, 0, 1, "v", 0], ]; is_deeply( test_marc_template($rec), $marc_out , 'is_deeply');