#!/usr/bin/perl

BEGIN {
$ENV{KOHA_CONF} = "/usr/local/koha/etc/koha-conf.xml";
$ENV{DOCUMENT_ROOT} = "/usr/local/koha/intranet/htdocs";
push @INC, '/usr/local/koha/lib';
}

use C4::Biblio;
use C4::Items;
use C4::Context;

my $dbh = C4::Context->dbh;
$dbh->{AutoCommit} = 0;

my $barcodes_sth = $dbh->prepare( "SELECT itemnumber,biblionumber,barcode FROM items" );

$barcodes_sth->execute();
while ( my ( $itemnumber,$biblio,$barcode ) = $barcodes_sth->fetchrow ) {
	my $item = { 'barcode' => $barcode };
	ModItem( $item, $biblio, $itemnumber );
}
$barcodes_sth->finish;

$dbh->commit;
