Bugzilla – Attachment 30795 Details for
Bug 6681
Provide a way for removing authority links and holdings on Z39.50 record import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
This patch update the code and fix MARC flavour problem by removing all subfields $9 from the imported record.
Bug-6681---When-importing-a-biblio-record-via-Z395.patch (text/plain), 3.25 KB, created by
simith.doliveira
on 2014-08-14 17:37:37 UTC
(
hide
)
Description:
This patch update the code and fix MARC flavour problem by removing all subfields $9 from the imported record.
Filename:
MIME Type:
Creator:
simith.doliveira
Created:
2014-08-14 17:37:37 UTC
Size:
3.25 KB
patch
obsolete
>From 2810216e7e0851f5e1b84ce2fa428680d6151bc3 Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Thu, 14 Aug 2014 13:34:28 -0400 >Subject: [PATCH] Bug 6681 - When importing a biblio record via Z39.50, > authority links also get imported > >--- > C4/Biblio.pm | 36 ++++++++++++++++++++++++++++++++++++ > acqui/neworderempty.pl | 6 ++---- > cataloguing/addbiblio.pl | 3 ++- > 3 files changed, 40 insertions(+), 5 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d465cf6..ec405b1 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -136,6 +136,7 @@ BEGIN { > &TransformHtmlToMarc > &TransformHtmlToXml > prepare_host_field >+ &RemoveItemsAndAuthidsFromRecord > ); > } > >@@ -2777,6 +2778,41 @@ sub get_koha_field_from_marc { > return $kohafield; > } > >+=head2 RemoveItemsAndAuthidsFromRecord >+ >+ RemoveItemsAndAuthidsFromRecord($record); >+ >+ Remove all items (952) from the record. >+ Also removes all authids (subfield 9 in headings) >+ >+=cut >+ >+sub RemoveItemsAndAuthidsFromRecord { >+ my $record = shift; >+ my $frameworkcode = shift || ''; >+ >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); >+ >+ # Remove all the items from the record >+ foreach my $item ($record->field($itemtag)) { >+ $record->delete_field($item); >+ } >+ >+ # Remove all authid links ($9) in the record >+ if ( $marcflavour eq "MARC21" ) { >+ my @heading = qw(100 110 111 130 440 600 610 611 630 648 650 651 655 700 710 711 730 800 810 811 830); >+ foreach (@heading) { >+ foreach my $field ($record->field($_)) { >+ $field->delete_subfield(code => '9'); >+ unless($field->subfields()) { >+ $record->delete_field($field); >+ } >+ } >+ } >+ } >+} >+ > =head2 TransformMarcToKohaOneField > > $result = TransformMarcToKohaOneField( $kohatable, $kohafield, $record, $result, $frameworkcode ) >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 256175a..57e12b1 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -145,10 +145,8 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){ > my ($marcrecord, $encoding) = MARCfindbreeding($params->{'breedingid'}); > die("Could not find the selected record in the reservoir, bailing") unless $marcrecord; > >- # Remove all the items (952) from the imported record >- foreach my $item ($marcrecord->field('952')) { >- $marcrecord->delete_field($item); >- } >+ # Do a cleanup on the imported record >+ RemoveItemsAndAuthidsFromRecord($marcrecord, $params->{'frameworkcode'}); > > my $duplicatetitle; > #look for duplicates >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 5b06706..368323b 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -795,7 +795,8 @@ if (($biblionumber) && !($breedingid)){ > $record = GetMarcBiblio($biblionumber); > } > if ($breedingid) { >- ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; >+ ( $record, $encoding ) = MARCfindbreeding( $breedingid ); >+ RemoveItemsAndAuthidsFromRecord($record, $frameworkcode) if $record; > } > > #populate hostfield if hostbiblionumber is available >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6681
:
4892
|
6929
|
7115
|
7117
|
30795
|
31181
|
33177
|
33407
|
33410
|
33425
|
33427
|
33540
|
33541