Delete working now

This commit is contained in:
rangi 2006-03-28 23:05:08 +00:00
parent c1752f381e
commit eeb654d21d
2 changed files with 47 additions and 5 deletions

View file

@ -994,10 +994,18 @@ sub NEWdelbiblio {
}
# &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');
}
@ -2996,6 +3004,9 @@ Paul POULAIN paul.poulain@free.fr
# $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
#

View file

@ -54,7 +54,7 @@ other databases.
=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;
@ -108,7 +108,8 @@ sub get_record {
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 {
@ -121,7 +122,7 @@ sub get_record {
};
if ($@) {
print "Error ", $@->code(), ": ", $@->message(), "\n";
warn "Error ", $@->code(), ": ", $@->message(), "\n";
}
###$raw
my $record = MARC::Record->new_from_xml($raw, 'UTF-8');
@ -129,6 +130,36 @@ sub get_record {
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__