From eeb654d21d616abaca3134a39fc3461dc0fbdfb8 Mon Sep 17 00:00:00 2001 From: rangi Date: Tue, 28 Mar 2006 23:05:08 +0000 Subject: [PATCH] Delete working now --- C4/Biblio.pm | 15 +++++++++++++-- C4/Search.pm | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 05c4988d74..6a6d96cbc7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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 # diff --git a/C4/Search.pm b/C4/Search.pm index ffb59382b4..f75c016e70 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -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__ -- 2.39.5