Bugzilla – Attachment 74122 Details for
Bug 20577
Script to go through catalogue removing the 998 MARC tag data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
WR: 289187 - Script to loop through catalog removing 998 tag data
WR-289187---Script-to-loop-through-catalog-removin.patch (text/plain), 2.74 KB, created by
Alex Buckley
on 2018-04-13 02:33:44 UTC
(
hide
)
Description:
WR: 289187 - Script to loop through catalog removing 998 tag data
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-04-13 02:33:44 UTC
Size:
2.74 KB
patch
obsolete
>From 250f8232dd051a65fa66e8d51ae3fd4de8190ea4 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Fri, 13 Apr 2018 02:24:08 +0000 >Subject: [PATCH] WR: 289187 - Script to loop through catalog removing 998 tag > data > >https://bugs.koha-community.org/show_bug.cgi?id=20577 >--- > remove_998_datafield.pl | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 70 insertions(+) > create mode 100755 remove_998_datafield.pl > >diff --git a/remove_998_datafield.pl b/remove_998_datafield.pl >new file mode 100755 >index 0000000..11745bb >--- /dev/null >+++ b/remove_998_datafield.pl >@@ -0,0 +1,70 @@ >+#!/usr/bin/perl >+ >+# Loop through all of the biblio records in the biblioitems database table and remove the 998 subfield to prevent indexer bugs. >+# >+# Copyright (C) 2018 Catalyst IT Ltd. >+# >+# This program is free software: you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation, either version 3 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+=head1 NAME >+ >+remove_998_subfield.pl - Remove 998$a subfield of all biblios in the catalog >+ >+=head1 SYNOPSIS >+ >+B<remove_998_subfield.pl> >+ >+=head1 DESCRIPTION >+ >+B<csv_to_sql.pl> will loop through all of the biblio records in the biblioitems database table and remove the 998 subfield to prevent indexer bugs. >+ >+=back >+ >+=head1 AUTHOR >+ >+Alex Buckley <alexbuckley@catalyst.net.nz> >+ >+=cut >+ >+use Data::Dumper; >+ >+use autodie; >+use Getopt::Long; >+use Modern::Perl; >+use Pod::Usage; >+use Text::CSV_XS; >+use C4::Context; >+use C4::Biblio; >+ >+my $dbh = C4::Context->dbh; >+ >+my $sth = $dbh->prepare("SELECT biblionumber FROM biblioitem WHERE ExtractValue(marcxml, '//datafield[\@tag=\"440\"]/subfield[\@code>=\"a\"]') != '';"); >+$sth->execute(); >+my $biblio_records = $sth->fetchall_arrayref({ }); >+ >+foreach my $biblio_record ( @$biblio_records ) { >+ my $bibnum = $biblio_record->{'biblionumber'}; >+ my $record = GetMarcBiblio({biblionumber => $bibnum}); >+ my $framework = $record->{'framework'}; >+ foreach my $field ($record->field('998')) { >+ $record->delete_field($field); >+ } >+ ModBiblioMarc($record, $bibnum, $framework); >+ ModZebra( $biblio_record, "specialUpdate", "biblioserver", $record); >+ warn "Updated biblio $biblio_record->{'biblionumber'}"; >+} >+ >+1; >+ >+ >-- >2.1.4
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 20577
: 74122