Bugzilla – Attachment 4393 Details for
Bug 4518
Enhance 2.2 to 3.0 scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
(bug #4518) enhance 2.2 to 3.0 scripts
bug-4518-enhance-22-to-30-scripts.patch (text/plain), 3.65 KB, created by
Chris Cormack
on 2011-06-07 08:07:54 UTC
(
hide
)
Description:
(bug #4518) enhance 2.2 to 3.0 scripts
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-06-07 08:07:54 UTC
Size:
3.65 KB
patch
obsolete
>From 0bcfce9b1a0550a3342bc626b70ee83f98c6c4ba Mon Sep 17 00:00:00 2001 >From: Nahuel ANGELINETTI <nahuel.angelinetti@biblibre.com> >Date: Mon, 17 May 2010 15:43:37 +0200 >Subject: [PATCH] (bug #4518) enhance 2.2 to 3.0 scripts > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > misc/migration_tools/22_to_30/missing090field.pl | 4 ++- > .../22_to_30/move_marc_to_authheader.pl | 2 +- > misc/migration_tools/upgradeitems.pl | 23 ++++++++++++++++++- > 3 files changed, 25 insertions(+), 4 deletions(-) > >diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl >index aae8032..bfa8576 100755 >--- a/misc/migration_tools/22_to_30/missing090field.pl >+++ b/misc/migration_tools/22_to_30/missing090field.pl >@@ -21,7 +21,7 @@ use MARC::File::USMARC; > $|=1; > my $dbh = C4::Context->dbh; > >-my $sth=$dbh->prepare("select m.biblionumber,b.biblioitemnumber from biblio m left join biblioitems b on b.biblionumber=m.biblionumber"); >+my $sth=$dbh->prepare("SELECT biblionumber, biblioitemnumber FROM biblioitems"); > $sth->execute(); > > my $i=1; >@@ -35,6 +35,8 @@ while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){ > sub MARCmodbiblionumber{ > my ($biblionumber,$biblioitemnumber,$record)=@_; > >+ return unless $record; >+ > my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); > my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField("biblio.biblioitemnumber",""); > >diff --git a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl >index 2546da8..f5e4b43 100755 >--- a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl >+++ b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl >@@ -43,7 +43,7 @@ while ( my ( $authid,$authtypecode ) = $sth->fetchrow ) { > $string=~s/\-//g; > $string = sprintf("%-*s",26, $string); > substr($string,9,6,"frey50"); >- unless ($record->subfield(100,"a")){ >+ unless ($record->subfield(100,"a") and length($record->subfield(100,"a")) == 26 ){ > $record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>$string)); > } > if ($record->field(152)){ >diff --git a/misc/migration_tools/upgradeitems.pl b/misc/migration_tools/upgradeitems.pl >index 10c7544..c5469ee 100755 >--- a/misc/migration_tools/upgradeitems.pl >+++ b/misc/migration_tools/upgradeitems.pl >@@ -13,6 +13,8 @@ if (C4::Context->preference("marcflavour") ne "UNIMARC") { > exit; > } > my $rqbiblios=$dbh->prepare("SELECT biblionumber from biblioitems"); >+my $rqitemnumber=$dbh->prepare("SELECT itemnumber, biblionumber from items where itemnumber = ? and biblionumber = ?"); >+ > $rqbiblios->execute; > $|=1; > while (my ($biblionumber)= $rqbiblios->fetchrow_array){ >@@ -21,10 +23,27 @@ while (my ($biblionumber)= $rqbiblios->fetchrow_array){ > my $marcitem=MARC::Record->new(); > $marcitem->encoding('UTF-8'); > $marcitem->append_fields($itemfield); >- eval{ModItemFromMarc($marcitem,$biblionumber,$itemfield->subfield('9'));}; >+ >+ >+ my $itemnum; >+ my @itemnumbers = $itemfield->subfield('9'); >+ foreach my $itemnumber ( @itemnumbers ){ >+ $rqitemnumber->execute($itemnumber, $biblionumber); >+ if( my $row = $rqitemnumber->fetchrow_hashref ){ >+ $itemnum = $row->{itemnumber}; >+ } >+ } >+ >+ eval{ >+ if($itemnum){ >+ ModItemFromMarc($marcitem,$biblionumber,$itemnum) >+ }else{ >+ die("$biblionumber"); >+ } >+ }; > print "\r$biblionumber"; > if ($@){ >- warn "$biblionumber : $@"; >+ warn "Problem with : $biblionumber : $@"; > warn $record->as_formatted; > } > } >-- >1.7.4.1
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 4518
: 4393