[Koha-cvs] koha/C4 Biblio.pm

Joshua Ferraro jmf at kados.org
Sat Feb 25 21:49:16 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/02/25 20:49:16

Modified files:
	C4             : Biblio.pm 

Log message:
	Better documentation, added warning if serviceType is 'drop' since it's
	not supported in Zebra.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Biblio.pm.diff?tr1=1.149&tr2=1.150&r1=text&r2=text

Patches:
Index: koha/C4/Biblio.pm
diff -u koha/C4/Biblio.pm:1.149 koha/C4/Biblio.pm:1.150
--- koha/C4/Biblio.pm:1.149	Sat Feb 25 20:30:32 2006
+++ koha/C4/Biblio.pm	Sat Feb 25 20:49:15 2006
@@ -30,7 +30,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.149 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.150 $' =~ /\d+/g;
                 shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 @ISA = qw(Exporter);
@@ -145,13 +145,9 @@
 
 =head1 API
 
-=cut
-
-=head ZEBRA
-
-=cut
+=head2 ZEBRA
 
-=head2 z3950_extended_services
+=head3 z3950_extended_services
 
 z3950_extended_services($Zconn,$serviceType,$serviceOptions,$record);
 
@@ -223,38 +219,65 @@
         $Zpackage->destroy();
 }
 
-=head2 marc2xml
+=head2 set_service_options
+
+my $serviceOptions = set_service_options($serviceType);
+
+C<$serviceType> itemorder,create,drop,commit,update,xmlupdate
 
-C<$Zconn>
+Currently, we only support 'create', 'commit', and 'update'. 'drop' support will be added as soon as Zebra supports it.
 
 =cut
 
-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 ($serviceType) = @_;
 	my $serviceOptions;
-	if ($option eq 'update') {
+
+	if ($serviceType eq 'update') {
 		$serviceOptions->{ 'action' } = 'specialUpdate';
-		$serviceOptions->{ 'syntax' } = 'xml'; #zebra doesn't support others
+
+	# FIXME: This needs to be an OID ... if we ever need 'syntax' this sub will need to change
+	#	$serviceOptions->{ 'syntax' } = ''; #zebra doesn't support syntaxes other than xml
 	}
-	if ($option eq 'commit') {
+
+	if ($serviceType eq 'commit') {
+	# nothing to do
 
 	}
+	
+        if ($serviceType eq 'create') {
+        # nothing to do
 
+        }
+	
+	if (serviceType eq 'drop') {
+		die "ERROR: 'drop' not currently supported (by Zebra)";
+	}
 	return $serviceOptions;
 }
 
+=head2 marc2xml
+
+my $xmlrecord = marc2xml($record);
+
+Convert from MARC to XML. Note that MARC::File::XML will automatically encode from MARC-8 to UTF-8 as of version .8
+
+C<$record> a MARC record
+
+=cut
+
+sub marc2xml {
+        my ($record) = @_;
+        my $xmlrecord;
+        eval {
+                $xmlrecord=$record->as_xml();
+        };
+        #TODO: better error handling here
+        if ($@){
+                warn "ERROR: I suspect a badly formatted MARC record";
+        }
+        return $xmlrecord;
+}
 
 =head2 @tagslib = &MARCgettagslib($dbh,1|0,$frameworkcode);
 
@@ -2889,8 +2912,12 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.149 2006/02/25 20:30:32 kados Exp $
+# $Id: Biblio.pm,v 1.150 2006/02/25 20:49:15 kados Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.150  2006/02/25 20:49:15  kados
+# Better documentation, added warning if serviceType is 'drop' since it's
+# not supported in Zebra.
+#
 # Revision 1.149  2006/02/25 20:30:32  kados
 # IMPORTANT: Paul, I've removed the decode_char routine because it's no
 # longer necessary. If we need to convert from MARC-8 for display, we should:





More information about the Koha-cvs mailing list