[Koha-cvs] koha/C4 Biblio.pm

Joshua Ferraro jmf at kados.org
Sun Feb 26 01:08:20 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/02/26 00:08:20

Modified files:
	C4             : Biblio.pm 

Log message:
	moving all $Zconn s to z3950_extended_services (currently, nothing
	works).

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

Patches:
Index: koha/C4/Biblio.pm
diff -u koha/C4/Biblio.pm:1.153 koha/C4/Biblio.pm:1.154
--- koha/C4/Biblio.pm:1.153	Sat Feb 25 22:39:10 2006
+++ koha/C4/Biblio.pm	Sun Feb 26 00:08:20 2006
@@ -26,11 +26,11 @@
 use MARC::File::USMARC;
 use MARC::File::XML;
 use ZOOM;
-
+our $Zconn=C4::Context->Zconn;
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.153 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.154 $' =~ /\d+/g;
                 shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 @ISA = qw(Exporter);
@@ -147,12 +147,10 @@
 
 =head2 z3950_extended_services
 
-z3950_extended_services($Zconn,$serviceType,$serviceOptions,$record);
+z3950_extended_services($serviceType,$serviceOptions,$record);
 
 	z3950_extended_services is used to handle all interactions with Zebra's extended serices package.
 
-C<$Zconn> a connection object to the Zebra server
-
 C<$serviceType> one of: itemorder,create,drop,commit,update,xmlupdate
 
 C<$serviceOptions> a has of key/value pairs. For instance, if service_type is 'update', $service_options should contain:
@@ -173,8 +171,9 @@
 
 =cut
 sub z3950_extended_services {
-	my ($Zconn,$serviceType,$serviceOptions,$record) = @_;
-        
+	my ($serviceType,$serviceOptions,$record) = @_;
+
+    my $Zconn = C4::Context->Zconn; 
 	# create a new package object
 	my $Zpackage = $Zconn->package();
 
@@ -807,7 +806,7 @@
 =cut
 
 sub NEWnewbiblio {
-    my ( $dbh,$Zconn,$record,$frameworkcode ) = @_;
+    my ( $dbh,$record,$frameworkcode ) = @_;
     my $biblionumber;
     my $biblioitemnumber;
     my $olddata = MARCmarc2koha( $dbh, $record,$frameworkcode );
@@ -837,7 +836,7 @@
 	$olddata->{marc} = $record->as_usmarc();
 	$olddata->{marcxml} = $record->as_xml();
 	# and create biblioitem, that's all folks !
-    $biblioitemnumber = REALnewbiblioitem( $dbh, $Zconn, $olddata );
+    $biblioitemnumber = REALnewbiblioitem( $dbh, $olddata );
 
     # search subtiles, addiauthors and subjects
     ( $tagfield, $tagsubfield ) =
@@ -895,7 +894,7 @@
 
 =head2 NEWmodbiblio
 
-NEWmodbiblio($dbh,$Zconn,$MARCrecord,$biblionumber,$frameworkcode);
+NEWmodbiblio($dbh,$MARCrecord,$biblionumber,$frameworkcode);
 
 =over 4
 
@@ -906,7 +905,7 @@
 =cut
 
 sub NEWmodbiblio {
-	my ($dbh,$Zconn,$record,$biblionumber,$frameworkcode) =@_;
+	my ($dbh,$record,$biblionumber,$frameworkcode) =@_;
 	$frameworkcode="" unless $frameworkcode;
 # 	&MARCmodbiblio($dbh,$bibid,$record,$frameworkcode,0);
 	my $oldbiblio = MARCmarc2koha($dbh,$record,$frameworkcode);
@@ -918,7 +917,7 @@
 	$oldbiblio->{marcxml} = $record->as_xml();
 	warn "dans NEWmodbiblio $biblionumber = ".$oldbiblio->{biblionumber}." = ".$oldbiblio->{marcxml};
 	REALmodbiblio($dbh,$oldbiblio);
-	REALmodbiblioitem($dbh,$Zconn,$oldbiblio);
+	REALmodbiblioitem($dbh,$oldbiblio);
 	# now, modify addi authors, subject, addititles.
 	my ($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"additionalauthors.author",$frameworkcode);
 	my @addiauthfields = $record->field($tagfield);
@@ -983,7 +982,7 @@
 
 =head2 NEWnewitem
 
-$itemnumber = NEWnewitem($dbh, $Zconn, $record, $biblionumber, $biblioitemnumber);
+$itemnumber = NEWnewitem($dbh, $record, $biblionumber, $biblioitemnumber);
 
 =over 4
 
@@ -994,7 +993,7 @@
 =cut
 
 sub NEWnewitem {
-    my ( $dbh,$Zconn,$record,$biblionumber,$biblioitemnumber ) = @_;
+    my ( $dbh,$record,$biblionumber,$biblioitemnumber ) = @_;
 
     # add item in old-DB
 	my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
@@ -1003,15 +1002,15 @@
     $item->{'biblionumber'} = $biblionumber;
     $item->{'biblioitemnumber'}=$biblioitemnumber;
     $item->{marc} = $record->as_usmarc();
-    warn $item->{marc};
-    my ( $itemnumber, $error ) = &REALnewitems( $dbh, $Zconn, $item, $item->{barcode} );
+    #warn $item->{marc};
+    my ( $itemnumber, $error ) = &REALnewitems( $dbh, $item, $item->{barcode} );
 	return $itemnumber;
 }
 
 
 =head2 NEWmoditem
 
-$itemnumber = NEWmoditem($dbh, $Zconn, $record, $biblionumber, $biblioitemnumber,$itemnumber);
+$itemnumber = NEWmoditem($dbh, $record, $biblionumber, $biblioitemnumber,$itemnumber);
 
 =over 4
 
@@ -1022,7 +1021,7 @@
 =cut
 
 sub NEWmoditem {
-    my ( $dbh, $Zconn, $record, $biblionumber, $biblioitemnumber, $itemnumber) = @_;
+    my ( $dbh, $record, $biblionumber, $biblioitemnumber, $itemnumber) = @_;
     
 	my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
     my $olditem = MARCmarc2koha( $dbh, $record,$frameworkcode );
@@ -1031,7 +1030,7 @@
 	$olditem->{biblionumber} = $biblionumber;
 	$olditem->{biblioitemnumber} = $biblioitemnumber;
 	# and modify item
-    REALmoditem( $dbh, $Zconn, $olditem );
+    REALmoditem( $dbh, $olditem );
 }
 
 
@@ -1273,7 +1272,7 @@
 
 =cut
 sub REALmodbiblioitem {
-    my ( $dbh, $Zconn, $biblioitem ) = @_;
+    my ( $dbh, $biblioitem ) = @_;
     my $query;
 
     my $sth = $dbh->prepare("update biblioitems set number=?,volume=?,			volumedate=?,		lccn=?,
@@ -1292,7 +1291,7 @@
 
 	my $record = MARC::File::USMARC::decode($biblioitem->{marc});
 
-	z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+	z3950_extended_services('update',set_service_options('update'),$record);
 
 
 # 	warn "MOD : $biblioitem->{biblioitemnumber} = ".$biblioitem->{marc};
@@ -1300,7 +1299,7 @@
 
 =head2 REALnewbiblioitem
 
-REALnewbiblioitem($dbh,$Zconn,$biblioitem);
+REALnewbiblioitem($dbh,$biblioitem);
 
 =over 4
 
@@ -1311,7 +1310,7 @@
 =cut
 
 sub REALnewbiblioitem {
-	my ( $dbh, $Zconn, $biblioitem ) = @_;
+	my ( $dbh, $biblioitem ) = @_;
 
 	$dbh->do("lock tables biblioitems WRITE, biblio WRITE, marc_subfield_structure READ");
 	my $sth = $dbh->prepare("Select max(biblioitemnumber) from biblioitems");
@@ -1360,7 +1359,7 @@
 		$biblioitem->{marcxml},
 	);
 	$dbh->do("unlock tables");
-	z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+	z3950_extended_services('update',set_service_options('update'),$record);
 	return ($biblioitemnumber);
 }
 
@@ -1386,7 +1385,7 @@
 
 =head2 REALnewitems
 
-($itemnumber,$errors)= REALnewitems($dbh,$Zconn,$item,$barcode);
+($itemnumber,$errors)= REALnewitems($dbh,$item,$barcode);
 
 =over 4
 
@@ -1397,7 +1396,7 @@
 =cut
 
 sub REALnewitems {
-    my ( $dbh, $Zconn, $item, $barcode ) = @_;
+    my ( $dbh, $item, $barcode ) = @_;
 
 # 	warn "OLDNEWITEMS";
 	
@@ -1496,9 +1495,9 @@
 	# ok, we have the marc record, add item number to the item field (in {marc}, and add the field to the record)
 	my ($itemnumberfield,$itemnumbersubfield) = MARCfind_marc_from_kohafield($dbh,'items.itemnumber',$frameworkcode);
 	my $itemrecord = MARC::Record->new_from_usmarc($item->{marc});
-        warn $itemrecord;
-        warn $itemnumberfield;
-        warn $itemrecord->field($itemnumberfield);
+        #warn $itemrecord;
+        #warn $itemnumberfield;
+        #warn $itemrecord->field($itemnumberfield);
 	my $itemfield = $itemrecord->field($itemnumberfield);
 	$itemfield->add_subfields($itemnumbersubfield => "$itemnumber");
 	$record->insert_grouped_field($itemfield);
@@ -1508,12 +1507,12 @@
     if ( defined $sth->errstr ) {
         $error .= $sth->errstr;
     }
-	z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+	z3950_extended_services('update',set_service_options('update'),$record);
 	$dbh->do('unlock tables');
     return ( $itemnumber, $error );
 }
 
-=head2 REALmoditem($dbh,$Zconn,$item);
+=head2 REALmoditem($dbh,$item);
 
 =over 4
 
@@ -1524,7 +1523,7 @@
 =cut
 
 sub REALmoditem {
-    my ( $dbh, $Zconn, $item ) = @_;
+    my ( $dbh, $item ) = @_;
     $item->{'bibitemnum'} = 1;
 	my $error;
 	$dbh->do('lock tables items WRITE, biblio WRITE,biblioitems WRITE');
@@ -1596,7 +1595,7 @@
 	# save the record into biblioitem
 	$sth=$dbh->prepare("update biblioitems set marc=?,marcxml=? where biblionumber=? and biblioitemnumber=?");
 	$sth->execute($record->as_usmarc(),$record->as_xml(),$item->{biblionumber},$item->{biblioitemnumber});
-	z3950_extended_services($Zconn,'update',set_service_options('update'),$record);
+	z3950_extended_services('update',set_service_options('update'),$record);
     if ( defined $sth->errstr ) {
         $error .= $sth->errstr;
     }
@@ -1899,7 +1898,7 @@
 	return ($error);
 }    # sub modsubject
 
-=head2 modbibitem($dbh, $Zconn,$biblioitem);
+=head2 modbibitem($dbh, $biblioitem);
 
 =over 4
 
@@ -1910,9 +1909,9 @@
 =cut
 
 sub modbibitem {
-    my ($dbh, $Zconn, $biblioitem) = @_;
+    my ($dbh, $biblioitem) = @_;
     #my $dbh = C4::Context->dbh;
-    &REALmodbiblioitem( $dbh, $Zconn, $biblioitem );
+    &REALmodbiblioitem( $dbh, $biblioitem );
 }    # sub modbibitem
 
 =head2 newbiblioitem
@@ -1928,12 +1927,12 @@
 =cut
 
 sub newbiblioitem {
-    my ($dbh, $Zconn, $biblioitem) = @_;
+    my ($dbh, $biblioitem) = @_;
     #my $dbh        = C4::Context->dbh;
 	# add biblio information to the hash
     my $MARCbiblio = MARCkoha2marcBiblio( $dbh, $biblioitem );
 	$biblioitem->{marc} = $MARCbiblio->as_usmarc();
-    my $bibitemnum = &REALnewbiblioitem( $dbh, $Zconn, $biblioitem );
+    my $bibitemnum = &REALnewbiblioitem( $dbh, $biblioitem );
     return ($bibitemnum);
 }
 
@@ -1956,7 +1955,7 @@
 
 =head2 newitems
 
-$errors = newitems($dbh, $Zconn, $item, @barcodes);
+$errors = newitems($dbh, $item, @barcodes);
 
 =over 4
 
@@ -1968,7 +1967,7 @@
 
 
 sub newitems {
-    my ( $dbh, $Zconn, $item, @barcodes ) = @_;
+    my ( $dbh, $item, @barcodes ) = @_;
     #my $dbh = C4::Context->dbh;
     my $errors;
     my $itemnumber;
@@ -1979,14 +1978,14 @@
 		$oneitem->{barcode}= $barcode;
         my $MARCitem = &MARCkoha2marcItem( $dbh, $oneitem);
 		$oneitem->{marc} = $MARCitem->as_usmarc;
-        ( $itemnumber, $error ) = &REALnewitems( $dbh,$Zconn,$oneitem);
+        ( $itemnumber, $error ) = &REALnewitems( $dbh, $oneitem);
 #         $errors .= $error;
 #         &MARCadditem( $dbh, $MARCitem, $item->{biblionumber} );
     }
     return ($errors);
 }
 
-=head2 moditem($dbh,$Zconn,$item);
+=head2 moditem($dbh,$item);
 
 =over 4
 
@@ -1998,9 +1997,9 @@
 
 
 sub moditem {
-    my ($dbh,$Zconn,$item) = @_;
+    my ($dbh, $item) = @_;
     #my $dbh = C4::Context->dbh;
-    &REALmoditem( $dbh, $Zconn, $item );
+    &REALmoditem( $dbh, $item );
     my $MARCitem =
       &MARCkoha2marcItem( $dbh, $item->{'biblionumber'}, $item->{'itemnum'} );
     my $bibid =
@@ -2970,8 +2969,12 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.153 2006/02/25 22:39:10 kados Exp $
+# $Id: Biblio.pm,v 1.154 2006/02/26 00:08:20 kados Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.154  2006/02/26 00:08:20  kados
+# moving all $Zconn s to z3950_extended_services (currently, nothing
+# works).
+#
 # Revision 1.153  2006/02/25 22:39:10  kados
 # Another purely documentation commit. Just changing formatting to ease
 # readability.





More information about the Koha-cvs mailing list