From 8b75c53f0a1b34ae05b5cc5acdaa4fc48b072640 Mon Sep 17 00:00:00 2001 From: Juan Romay Sieira Date: Mon, 18 Jul 2011 11:53:37 +0200 Subject: [PATCH 36/36] [Bug 6590] - Path to apply after the first one. With this patch, koha will remove hyphens during zebra indexing, and not during cataloging. Content-Type: text/plain; charset="utf-8" --- C4/Biblio.pm | 43 ------------------------------------- misc/cronjobs/zebraqueue_start.pl | 33 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index c026e76..d797f40 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -3461,49 +3461,6 @@ sub ModBiblioMarc { # the previous version of the record $oldRecord = GetMarcBiblio($biblionumber); } - # - if (C4::Context->preference("IsbnIssnRemoveHyphens")){ - my $isbn; - my $issn; - if ( $encoding eq 'UNIMARC' ) { - if ( my $f010 = $record->field('010') ) { - if ( $f010->subfield('a') ) { - $isbn = $f010->subfield('a'); - $isbn =~ s/-//g; - $f010->update( 'a' => $isbn ); - } - } - if ( my $f011 = $record->field('011') ) { - if ( $f011->subfield('a') ) { - $issn = $f011->subfield('a'); - $issn =~ s/-//g; - $f011->update( 'a' => $issn ); - } - } - } elsif ($encoding eq 'MARC21') { - if ( my $f020 = $record->field('020') ) { - $isbn = $f020->subfield('a'); - $isbn =~ s/-//g; - $f020->update( 'a' => $isbn ); - } - if ( my $f022 = $record->field('022') ) { - $issn = $f022->subfield('a'); - $issn =~ s/-//g; - $f022->update( 'a' => $issn ); - } - } elsif ($encoding eq 'NORMARC') { - if ( my $f020 = $record->field('020') ) { - $isbn = $f020->subfield('a'); - $isbn =~ s/-//g; - $f020->update( 'a' => $isbn ); - } - if ( my $f022 = $record->field('022') ) { - $issn = $f022->subfield('a'); - $issn =~ s/-//g; - $f022->update( 'a' => $issn ); - } - } - } $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?"); $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber ); $sth->finish; diff --git a/misc/cronjobs/zebraqueue_start.pl b/misc/cronjobs/zebraqueue_start.pl index ea84156..d434fbb 100755 --- a/misc/cronjobs/zebraqueue_start.pl +++ b/misc/cronjobs/zebraqueue_start.pl @@ -58,6 +58,39 @@ while (($id,$biblionumber,$operation,$server)=$readsth->fetchrow){ # get the XML if ($server eq "biblioserver") { my $marc = GetMarcBiblio($biblionumber); + # + if ($marc && C4::Context->preference("IsbnIssnRemoveHyphens")){ + my $isbn; + my $issn; + my $encoding = C4::Context->preference("marcflavour"); + if ( $encoding eq 'UNIMARC' ) { + if ( my $f010 = $marc->field('010') ) { + if ( $f010->subfield('a') ) { + $isbn = $f010->subfield('a'); + $isbn =~ s/-//g; + $f010->update( 'a' => $isbn ); + } + } + if ( my $f011 = $marc->field('011') ) { + if ( $f011->subfield('a') ) { + $issn = $f011->subfield('a'); + $issn =~ s/-//g; + $f011->update( 'a' => $issn ); + } + } + } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') { + if ( my $f020 = $marc->field('020') ) { + $isbn = $f020->subfield('a'); + $isbn =~ s/-//g; + $f020->update( 'a' => $isbn ); + } + if ( my $f022 = $marc->field('022') ) { + $issn = $f022->subfield('a'); + $issn =~ s/-//g; + $f022->update( 'a' => $issn ); + } + } + } $marcxml = $marc->as_xml_record() if $marc; } elsif ($server eq "authorityserver") { $marcxml =C4::AuthoritiesMarc::GetAuthorityXML($biblionumber); -- 1.7.1