Bugzilla – Attachment 11780 Details for
Bug 8674
Need a delete biblios script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8674: Adds script batchdeletebiblios
Bug-8674-Adds-script-batchdeletebiblios.patch (text/plain), 2.39 KB, created by
Jonathan Druart
on 2012-08-23 12:31:53 UTC
(
hide
)
Description:
Bug 8674: Adds script batchdeletebiblios
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-08-23 12:31:53 UTC
Size:
2.39 KB
patch
obsolete
>From 507dc05abc709e7b26bd5bfce88fbc211a66aacf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 23 Aug 2012 14:28:42 +0200 >Subject: [PATCH] Bug 8674: Adds script batchdeletebiblios > >This script batch deletes biblios which contain a biblionumber >present in file passed in parameter. >If one biblio has items, it is not deleted. > >http://bugs.koha-community.org/show_bug.cgi?id=8674 >--- > misc/batchdeletebiblios.pl | 53 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > create mode 100755 misc/batchdeletebiblios.pl > >diff --git a/misc/batchdeletebiblios.pl b/misc/batchdeletebiblios.pl >new file mode 100755 >index 0000000..a6ac693 >--- /dev/null >+++ b/misc/batchdeletebiblios.pl >@@ -0,0 +1,53 @@ >+#!/usr/bin/perl >+ >+# Copyright 2012 BibLibre >+# This file is part of Koha. >+# >+# Koha 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 2 of the License, or (at your option) any later >+# version. >+# >+# Koha 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 >+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA >+ >+=head1 batchdeletebiblios.pl >+ >+ This script batch deletes biblios which contain a biblionumber present in file passed in parameter. >+ If one biblio has items, it is not deleted. >+ >+=cut >+ >+use Modern::Perl; >+use C4::Biblio; >+ >+use IO::File; >+ >+for my $file ( @ARGV ) { >+ say "Find biblionumber in file $file"; >+ open(FD, $file) or say "Error: '$file' $!" and next; >+ >+ while ( <FD> ) { >+ my $biblionumber = $_; >+ $biblionumber =~ s/$1/\n/g if $biblionumber =~ m/(\r\n?|\n\r?)/; >+ chomp $biblionumber; >+ my $dbh = C4::Context->dbh; >+ next if not $biblionumber =~ /^\d*$/; >+ print "Delete biblionumber $biblionumber "; >+ my $error; >+ eval { >+ $error = DelBiblio $biblionumber; >+ }; >+ if ( $@ or $error) { >+ say "KO $@ ($! | $error)"; >+ } else { >+ say "OK"; >+ } >+ } >+} >+ >-- >1.7.10.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 8674
:
11779
|
11780
|
11887
|
11919
|
11920
|
12647