X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Fmigration_tools%2F22_to_30%2Fmove_marc_to_biblioitems.pl;h=e4429a7d9e62aaaebdaa54a44fe69693f774cb72;hb=9d6d641d1f8b77271800f43bc027b651f9aea52b;hp=d55d48b02e8b334a0c6a9cc1efab48b899cb3d50;hpb=bdade9bc9d2aff6a59ccabfb07d54117169ef19c;p=srvgit diff --git a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl index d55d48b02e..e4429a7d9e 100755 --- a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl +++ b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl @@ -1,15 +1,14 @@ #!/usr/bin/perl - +use Modern::Perl; # script to shift marc to biblioitems # scraped from updatedatabase for dev week by chris@katipo.co.nz BEGIN { # find Koha's Perl modules # test carefully before changing this - use FindBin; + use FindBin (); eval { require "$FindBin::Bin/../../kohalib.pl" }; } use C4::Context; -use C4::Biblio; use MARC::Record; use MARC::File::XML ( BinaryEncoding => 'utf8' ); @@ -22,11 +21,11 @@ my $dbh = C4::Context->dbh(); # # changing marc field type -$dbh->do('ALTER TABLE `biblioitems` CHANGE `marc` `marc` BLOB NULL DEFAULT NULL '); +$dbh->do('ALTER TABLE `biblioitems` CHANGE `marc` `marc` LONGBLOB NULL DEFAULT NULL '); # adding marc xml, just for convenience $dbh->do('ALTER TABLE `biblioitems` ADD `marcxml` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL '); # moving data from marc_subfield_value to biblio -$sth = $dbh->prepare('select bibid,biblionumber from marc_biblio'); +my $sth = $dbh->prepare('select bibid,biblionumber from marc_biblio'); $sth->execute; my $sth_update = $dbh->prepare('update biblioitems set marc=?, marcxml=? where biblionumber=?'); my $totaldone=0; @@ -46,7 +45,7 @@ while (my ($bibid,$biblionumber) = $sth->fetchrow) { $sth_update->execute($record->as_usmarc(),$record->as_xml_record($marcflavour),$biblionumber); $totaldone++; print "."; - print "\r$totaldone / $totaltodo" unless ($totaldone % 100); + print "\r$totaldone" unless ($totaldone % 100); } print "\rdone\n"; @@ -149,7 +148,6 @@ sub LocalMARCgetbiblio { } if (C4::Context->preference('marcflavour')=~/unimarc/i){ $record->leader(' nac 22 1u 4500'); - $update=1; my $string; if ($record->field(100)) { $string = substr($record->subfield(100,"a")." ",0,35);