Bugzilla – Attachment 6929 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]
Corrected patch, ported to Koha 3.6
0001-Remove-Koha-specific-fields-from-records-imported-vi.patch (text/plain), 2.91 KB, created by
Frédérick Capovilla
on 2011-12-23 15:34:08 UTC
(
hide
)
Description:
Corrected patch, ported to Koha 3.6
Filename:
MIME Type:
Creator:
Frédérick Capovilla
Created:
2011-12-23 15:34:08 UTC
Size:
2.91 KB
patch
obsolete
>From 56ebede0065542a738753208731db6a27f87bdf5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Capovilla?= <frederick.capovilla@libeo.com> >Date: Fri, 23 Dec 2011 10:38:50 -0500 >Subject: [PATCH] Remove Koha-specific fields from records imported via Z39.50 > >Removes all items (952) and authids ($9 in headings) in the record. >Patch modified for Koha version 3.6 >--- > C4/Biblio.pm | 29 +++++++++++++++++++++++++++++ > acqui/neworderempty.pl | 6 ++---- > cataloguing/addbiblio.pl | 1 + > 3 files changed, 32 insertions(+), 4 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 4a9735f..8424663 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -133,6 +133,7 @@ BEGIN { > &TransformHtmlToXml > &PrepareItemrecordDisplay > &GetNoZebraIndexes >+ &RemoveItemsAndAuthidsFromRecord > ); > } > >@@ -2831,6 +2832,34 @@ sub GetNoZebraIndexes { > return %indexes; > } > >+=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; >+ >+ # Remove all the items (952) from the record >+ foreach my $item ($record->field('952')) { >+ $record->delete_field($item); >+ } >+ >+ # Remove all authid links ($9) in the record >+ foreach 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 my $field ($record->field($heading)) { >+ $field->delete_subfield(code => '9'); >+ unless($field->subfields()) { >+ $record->delete_field($field); >+ } >+ } >+ } >+} >+ > =head2 EmbedItemsInMarcBiblio > > EmbedItemsInMarcBiblio($marc, $biblionumber); >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 6361125..7504c3e 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -132,10 +132,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); > > my $duplicatetitle; > #look for duplicates >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 1a82989..8ee43c3 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -909,6 +909,7 @@ if (($biblionumber) && !($breedingid)){ > } > if ($breedingid) { > ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; >+ RemoveItemsAndAuthidsFromRecord($record) if $record; > } > #populate hostfield if hostbiblionumber is available > if ($hostbiblionumber){ >-- >1.7.2.5 >
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