[Koha-cvs] koha/C4 Biblio.pm Search.pm
Chris Cormack
chris at katipo.co.nz
Wed Mar 29 01:05:08 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch:
Changes by: Chris Cormack <rangi at savannah.gnu.org> 06/03/28 23:05:08
Modified files:
C4 : Biblio.pm Search.pm
Log message:
Delete working now
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Biblio.pm.diff?tr1=1.162&tr2=1.163&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Search.pm.diff?tr1=1.118&tr2=1.119&r1=text&r2=text
Patches:
Index: koha/C4/Biblio.pm
diff -u koha/C4/Biblio.pm:1.162 koha/C4/Biblio.pm:1.163
--- koha/C4/Biblio.pm:1.162 Mon Mar 13 23:12:44 2006
+++ koha/C4/Biblio.pm Tue Mar 28 23:05:08 2006
@@ -30,7 +30,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.162 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.163 $' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
@ISA = qw(Exporter);
@@ -994,10 +994,18 @@
}
# &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');
}
@@ -2994,8 +3002,11 @@
=cut
-# $Id: Biblio.pm,v 1.162 2006/03/13 23:12:44 rangi Exp $
+# $Id: Biblio.pm,v 1.163 2006/03/28 23:05:08 rangi Exp $
# $Log: Biblio.pm,v $
+# 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
#
Index: koha/C4/Search.pm
diff -u koha/C4/Search.pm:1.118 koha/C4/Search.pm:1.119
--- koha/C4/Search.pm:1.118 Wed Mar 8 18:12:42 2006
+++ koha/C4/Search.pm Tue Mar 28 23:05:08 2006
@@ -30,7 +30,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.118 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.119 $' =~ /\d+/g;
shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
};
@@ -54,7 +54,7 @@
=cut
@ISA = qw(Exporter);
- at EXPORT = qw(search get_record);
+ at EXPORT = qw(search get_record get_xml_record);
# make all your functions, whether exported or not;
@@ -108,7 +108,8 @@
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 @@
};
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 @@
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__
More information about the Koha-cvs
mailing list