remove all accents from pager links
[webpac] / tools / mods2unimarc.pl
index 634c1f1..03892b4 100755 (executable)
@@ -53,6 +53,7 @@ my $nr = 0;
 my $marc = MARC->new;
 
 my $ENCODING = 'ISO-8859-2';
+$ENCODING = 'windows-1250';
 
 my $twig=XML::Twig->new(
        twig_roots => { 'mods' => \&mods },
@@ -231,7 +232,7 @@ sub mods {
                        if ($t =~ m/([^:]+):\s+(.+)$/) {
                                $tmp->{$1} = $2;
                        } else {
-                               die "can't parse $t";
+                               print STDERR "can't parse '$t' in ",Dumper($phy_desc);
                        }
                }
                my $data = $tmp->{pagin};
@@ -244,7 +245,9 @@ sub mods {
        }
        marc_rep($m_cache,'215');
 
-       marc_add_single($m_cache,'001',undef,$ref->{recordInfo}->{recordIdentifier});
+       my $mfn = $ref->{recordInfo}->{recordIdentifier};
+       $mfn =~ s/[^0-9]//g;
+       marc_add_single($m_cache,'001',undef,$mfn);
 
        marc_add($m_cache,'200','a',$ref->{titleInfo}->{title});
        marc_add($m_cache,'200','e',$ref->{titleInfo}->{subTitle});
@@ -262,10 +265,22 @@ sub mods {
                        if ($related eq "series") {
                                marc_add_rep($m_cache,'225','a',$ri->{titleInfo}->{title});
                                foreach my $pn (@{$ri->{titleInfo}->{partNumber}}) {
-                                       marc_add_rep($m_cache,'999','a',$pn);
+                                       if ($journal) {
+                                               marc_add_rep($m_cache,'999','a',$pn);
+                                       } else {
+                                               marc_add_rep($m_cache,'225','v',$pn);
+                                       }
                                }
                        } elsif ($related eq "preceding") {
-                               marc_add_rep($m_cache,'430','a',$ri->{titleInfo}->{title});
+                               marc_add($m_cache,'520','a',$ri->{titleInfo}->{title});
+                               if ($ri->{identifier}) {
+                                       if ($ri->{identifier}->{type} eq "issn") {
+                                               marc_add($m_cache,'520','x',$ri->{identifier}->{content});
+                                       } else {
+                                               die "can't store identifier type $type";
+                                       }
+                               }
+                               marc_rep($m_cache,'520');
                        } else {
                                die "can't parse related item type $related" if ($related);
                        }
@@ -274,6 +289,8 @@ sub mods {
 
        marc_add_single($m_cache,'205','a',$ref->{originInfo}->{edition});
 
+       marc_add($m_cache,'210','a',$ref->{originInfo}->{place});
+
        my $publisher = $ref->{originInfo}->{publisher};
        if ($publisher =~ m,^(.+?)\s*/\s*(.+)$,) {
                marc_add($m_cache,'210','a', $2);
@@ -282,7 +299,6 @@ sub mods {
                marc_add($m_cache,'210','c', $publisher);
        }
 
-       marc_add($m_cache,'210','a',$ref->{originInfo}->{place});
        marc_add($m_cache,'210','d',$ref->{originInfo}->{dateIssued});
 
        marc_single($m_cache,'210');