From a9de732ebf3e0ba944df236ecb013380850c2edd Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Fri, 16 Nov 2007 18:48:32 +0100 Subject: [PATCH] fixing rebuildnonmarc.pl the API of TransformMarcToKoha has changed. + For a reason I don't understand (& appear a conception bug), the biblioitemnumber is not shipped in the hash and it's needed by the UPDATE. So it has to be reintroduced manually. That's how it's done in Biblio.pm/Sub ModItem. I think 3.2 will see the end of biblioitems (& it's replacement by something else) Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- misc/rebuildnonmarc.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/misc/rebuildnonmarc.pl b/misc/rebuildnonmarc.pl index fd2808189c..21063d2b16 100755 --- a/misc/rebuildnonmarc.pl +++ b/misc/rebuildnonmarc.pl @@ -45,7 +45,7 @@ my $starttime = gettimeofday; #1st of all, find item MARC tag. my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",''); # $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write, stopwords write"); -my $sth = $dbh->prepare("select biblionumber from biblio where biblionumber >54500"); +my $sth = $dbh->prepare("SELECT biblionumber FROM biblio"); $sth->execute; # my ($biblionumbermax) = $sth->fetchrow; # warn "$biblionumbermax <<=="; @@ -89,8 +89,7 @@ sub localNEWmodbiblio { $frameworkcode="" unless $frameworkcode; my $oldbiblio = TransformMarcToKoha($dbh,$record,$frameworkcode); C4::Biblio::_koha_modify_biblio( $dbh, $oldbiblio ); - C4::Biblio::_koha_modify_biblioitem( $dbh, $oldbiblio ); - + C4::Biblio::_koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio ); return 1; } @@ -98,6 +97,13 @@ sub localNEWmoditem { my ( $dbh, $record, $biblionumber, $itemnumber, $delete ) = @_; # warn "NEWmoditem $biblionumber / $itemnumber / $delete ".$record->as_formatted; my $frameworkcode=GetFrameworkCode($biblionumber); - my $olditem = TransformMarcToKoha( $dbh, $record,$frameworkcode ); + my $olditem = TransformMarcToKoha( $dbh, $record, $frameworkcode, 'items' ); +# warn "OLDITEM : ".Data::Dumper::Dumper( $olditem ); + my $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?"); + $sth->execute($biblionumber); + my ($biblioitemnumber) = $sth->fetchrow; + $sth->finish(); + $olditem->{'biblioitemnumber'} = $biblioitemnumber; C4::Biblio::_koha_modify_item( $dbh, $olditem ); +# die; } -- 2.39.5