}
# &MARCdelbiblio( $dbh, $bibid, 0 );
# delete from zebra
-# my $record = get_record($bibid);
+ warn "heres the bibid $bibid";
+# my $record = C4::Search::get_record($bibid);
+ my $record = C4::Search::get_xml_record($bibid);
# z3950_extended_services('update',set_service_options('update'),$record);
warn "heres the record to delete $bibid";
- z3950_extended_services('update',set_service_options('update','recordDelete',$bibid));
+# my $Zconn = C4::Context->Zconn;
+# my $p = $Zconn->package();
+# $p->option(action => "recordDelete");
+# $p->option(record => $record);
+# $p->send("update");
+# $p->destroy();
+ z3950_extended_services('update',set_service_options('update','recordDelete',$record));
z3950_extended_services('commit');
}
# $Id$
# $Log$
+# Revision 1.163 2006/03/28 23:05:08 rangi
+# Delete working now
+#
# Revision 1.162 2006/03/13 23:12:44 rangi
# Adding commits, so that changes stick
#
=cut
@ISA = qw(Exporter);
-@EXPORT = qw(search get_record);
+@EXPORT = qw(search get_record get_xml_record);
# make all your functions, whether exported or not;
my $Zconn = C4::Context->Zconn;
my $raw;
my $string = "identifier=$id";
- warn $string;
+# my $string = "title=delete";
+# warn $string;
$q = new ZOOM::Query::CQL2RPN( $string, $Zconn);
eval {
};
if ($@) {
- print "Error ", $@->code(), ": ", $@->message(), "\n";
+ warn "Error ", $@->code(), ": ", $@->message(), "\n";
}
###$raw
my $record = MARC::Record->new_from_xml($raw, 'UTF-8');
return ($record);
}
+
+sub get_xml_record {
+ # pass in an id (biblionumber at this stage) and get back a MARC record
+ my ($id) = @_;
+ my $q;
+ my $Zconn = C4::Context->Zconn;
+ my $raw;
+ my $string = "identifier=$id";
+# my $string = "title=delete";
+# warn $string;
+
+ $q = new ZOOM::Query::CQL2RPN( $string, $Zconn);
+ eval {
+# my $rs = $Zconn->search_pqf("\@attr 1=12 $id");
+ my $rs = $Zconn->search($q);
+ my $n = $rs->size();
+ if ( $n > 0 ) {
+ $raw = $rs->record(0)->raw();
+ }
+ };
+ if ($@) {
+
+ warn "Error ", $@->code(), ": ", $@->message(), "\n";
+ }
+ ###$raw
+ my $record = $raw;
+ ###$record
+ return ($record);
+}
+
1;
__END__