use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = 0.01;
+$VERSION = do { my @v = '$Revision$' =~ /\d+/g;
+ shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
@ISA = qw(Exporter);
# unlink($filename);
my $Zconn;
my $xmlrecord;
-# warn "zebra_create : $biblionumber =".$record->as_formatted;
+ warn "zebra_create : $biblionumber =".$record->as_formatted;
eval {
$xmlrecord=$record->as_xml();
};
}
if ($record) {
- $Zpackage->option(record => $record);
+ my $xmlrecord = marc2xml($record);
+ $Zpackage->option(record => $xmlrecord);
if ($serviceOptions->{'syntax'}) {
$Zpackage->option(syntax => $serviceOptions->{'syntax'});
}
$Zpackage->destroy();
}
+sub marc2xml {
+ my ($record) = @_;
+ my $xmlrecord;
+ eval {
+ $xmlrecord=$record->as_xml();
+ };
+ if ($@){
+ warn "ERROR badly formatted marc record";
+ warn "Skipping record";
+ }
+ return $xmlrecord;
+}
+sub set_service_options {
+ my ($option) = @_;
+ my $serviceOptions;
+ if ($option eq 'update') {
+ $serviceOptions->{ 'action' } = 'specialUpdate';
+ $serviceOptions->{ 'syntax' } = 'xml'; #zebra doesn't support others
+ }
+
+ return $serviceOptions;
+}
+
+
=head2 @tagslib = &MARCgettagslib($dbh,1|0,$frameworkcode);
=over 4
$biblioitem->{bnotes}, $biblioitem->{size}, $biblioitem->{place}, $biblioitem->{marc},
$biblioitem->{marcxml}, $biblioitem->{biblioitemnumber});
my $record = MARC::File::USMARC::decode($biblioitem->{marc});
- zebra_create($biblioitem->{biblionumber}, $record);
+
+ my $Zconn = C4::Context->Zconn or die "unable to set Zconn";
+ z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+
+
# warn "MOD : $biblioitem->{biblioitemnumber} = ".$biblioitem->{marc};
} # sub modbibitem
$biblioitem->{marcxml},
);
$dbh->do("unlock tables");
- zebra_create($biblioitem->{biblionumber}, $record);
+ my $Zconn = C4::Context->Zconn or die "unable to set Zconn";
+ z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+ #zebra_create($biblioitem->{biblionumber}, $record);
return ($biblioitemnumber);
}
if ( defined $sth->errstr ) {
$error .= $sth->errstr;
}
- zebra_create($item->{biblionumber},$record);
+ my $Zconn = C4::Context->Zconn or die "unable to set Zconn";
+ z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+ #zebra_create($item->{biblionumber},$record);
$dbh->do('unlock tables');
return ( $itemnumber, $error );
}
# save the record into biblioitem
$sth=$dbh->prepare("update biblioitems set marc=?,marcxml=? where biblionumber=? and biblioitemnumber=?");
$sth->execute($record->as_usmarc(),$record->as_xml(),$item->{biblionumber},$item->{biblioitemnumber});
- zebra_create($item->biblionumber,$record);
+ my $Zconn = C4::Context->Zconn or die "unable to set Zconn";
+ z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+ #zebra_create($item->biblionumber,$record);
if ( defined $sth->errstr ) {
$error .= $sth->errstr;
}
# $Id$
# $Log$
+# Revision 1.145 2006/02/22 01:02:39 kados
+# Replacing all calls to zebra_update with calls to
+# z3950_extended_services. More work coming, but it's
+# working now.
+#
# Revision 1.144 2006/02/20 14:22:38 kados
# typo
#