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 <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Paul POULAIN 2007-11-16 18:48:32 +01:00 committed by Joshua Ferraro
parent de51553445
commit a9de732ebf
1 changed files with 10 additions and 4 deletions

View File

@ -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;
}