3 # Copyright 2010 BibLibre
4 # Copyright 2011 Equinox Software, Inc.
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 my ($wherestring, $run, $silent, $want_help);
30 my $result = GetOptions(
31 'where:s' => \$wherestring,
33 '--silent' => \$silent,
34 'help|h' => \$want_help,
37 if ( not $result or not $run or $want_help ) {
42 my $dbh = C4::Context->dbh;
44 my $querysth = qq{SELECT biblionumber from biblioitems };
45 $querysth .= " WHERE $wherestring " if ($wherestring);
46 my $query = $dbh->prepare($querysth);
48 while (my $biblionumber = $query->fetchrow){
50 print "." unless $silent;
51 print "\r$count" unless ($silent or ($count % 100));
52 my $record = GetMarcBiblio($biblionumber);
55 ModBiblio($record, $biblionumber, GetFrameworkCode($biblionumber)) ;
58 print "error in $biblionumber : can't parse biblio";
62 print "\n\n$count records processed.\n" unless $silent;
66 $0: removes items from selected biblios
68 This utility is meant to be run as part of the upgrade to
69 Koha 3.4. It removes the 9XX fields in the bib records that
70 store a (now) duplicate copy of the item record information. After
71 running this utility, a full reindexing of the bibliographic records
72 should be run using rebuild_zebra.pl -b -r.
75 -where use this to limit modifications to selected biblios
76 --run perform the update
78 --help or -h show this message