[Koha] How do I bulk delete bibliographic records (of one given item type)?

Paul Poulain paul.poulain at biblibre.com
Thu Jan 7 20:54:01 NZDT 2010


Ricardo Dias Marques a écrit :
> Hi again Nicole and list,
> mysql> select barcode from biblioitems, items where itemtype=2 and
> biblioitems.biblionumber = items.biblionumber and
> biblioitems.biblioitemnumber = items.biblioitemnumber;
>   
that's exactly the best option !
> By doing some research, I see that I would need (at least) to change
> the "Items.pm" file, in the "C4" Koha 3.0.5 directory, with code that
> was added in the "master" branch (and that contains that new
> "Item2Marc" function / subroutine). I wish to avoid that, if possible
> (because that seems to be touching a more "essential" part of my Koha
> installation, and I'm afraid that could cause other problems).
>   
wise decision. I can guarantee that the "at least" on 1st line would in 
fact be "first", and have many others after !
> So, let me rephrase my initial question: how do people *currently* do
> batch deletions / bulk deletions of bibliographic records (and
> associated items), for a given / specific item type, in Koha 3.0.x
> (e.g. 3.0.5)?
>   
I think they don't, that's why we added this feature.
A small Perl script could do the job you want though. Something like :

use C4::Context;
use C4::Items;
use C4::Koha;

my $dbh=C4::Context->dbh;
my $sth=$dbh->prepare("

select biblio.biblionumber,itemnumber from biblioitems, items where itemtype=2 and
biblioitems.biblionumber = items.biblionumber and
biblioitems.biblioitemnumber = items.biblioitemnumber;

");
$sth->execute
while (my ($biblionmber,$itemnumber) = $sth->fetchrow) {
    DelItem($dbh,$biblionumber,$itemnumber);
}

WARNING : untested script !

-- 
Paul POULAIN
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
Tel : (33) 4 91 81 35 08



More information about the Koha mailing list