Bugzilla – Attachment 11919 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.60 KB, created by
Kyle M Hall (khall)
on 2012-08-31 14:44:23 UTC
(
hide
)
Description:
Bug 8674: Adds script batchdeletebiblios
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-08-31 14:44:23 UTC
Size:
2.60 KB
patch
obsolete
>From 4e93dc18ae4eb1b5b6092095de766c31408f4485 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 >Content-Type: text/plain; charset="utf-8" > >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 > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Created file with biblionumbers for bibs with and without items. >Only the bibs without items were deleted. >--- > misc/batchdeletebiblios.pl | 52 ++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 52 insertions(+), 0 deletions(-) > create mode 100755 misc/batchdeletebiblios.pl > >diff --git a/misc/batchdeletebiblios.pl b/misc/batchdeletebiblios.pl >new file mode 100755 >index 0000000..52170f6 >--- /dev/null >+++ b/misc/batchdeletebiblios.pl >@@ -0,0 +1,52 @@ >+#!/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.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 8674
:
11779
|
11780
|
11887
| 11919 |
11920
|
12647