3 # Copyright 2012 BibLibre
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it under the
7 # terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
11 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along with
16 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17 # Suite 330, Boston, MA 02111-1307 USA
19 =head1 batchdeletebiblios.pl
21 This script batch deletes biblios which contain a biblionumber present in file passed in parameter.
22 If one biblio has items, it is not deleted.
31 for my $file ( @ARGV ) {
32 say "Find biblionumber in file $file";
33 open(FD, $file) or say "Error: '$file' $!" and next;
36 my $biblionumber = $_;
37 $biblionumber =~ s/$1/\n/g if $biblionumber =~ m/(\r\n?|\n\r?)/;
39 my $dbh = C4::Context->dbh;
40 next if not $biblionumber =~ /^\d*$/;
41 print "Delete biblionumber $biblionumber ";
44 $error = DelBiblio $biblionumber;
47 say "KO $@ ($! | $error)";