[Koha-cvs] CVS: koha/C4 Biblio.pm,1.8,1.9

Paul POULAIN tipaul at users.sourceforge.net
Fri Sep 20 14:57:49 CEST 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv23418

Modified Files:
	Biblio.pm 
Log Message:
long is the road to 1.4.0
* MARCadditem and MARCmoditem now wroks
* various bugfixes in MARC management
!!! 1.3.0 should be released very soon now. Be careful !!!


Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Biblio.pm	10 Sep 2002 13:53:52 -0000	1.8
--- Biblio.pm	20 Sep 2002 12:57:46 -0000	1.9
***************
*** 2,5 ****
--- 2,11 ----
  # $Id$
  # $Log$
+ # Revision 1.9  2002/09/20 12:57:46  tipaul
+ # long is the road to 1.4.0
+ # * MARCadditem and MARCmoditem now wroks
+ # * various bugfixes in MARC management
+ # !!! 1.3.0 should be released very soon now. Be careful !!!
+ #
  # Revision 1.8  2002/09/10 13:53:52  tipaul
  # MARC API continued...
***************
*** 432,435 ****
--- 438,442 ----
  # Returns MARC::Record of the biblio passed in parameter.
      my ($dbh,$bibid,$itemnumber)=@_;
+     warn "MARCgetitem :   $bibid, $itemnumber\n";
      my $record = MARC::Record->new();
  # search MARC tagorder
***************
*** 529,538 ****
--- 536,548 ----
  	    if ($oldfield eq 0 or (! $oldfield->subfield(@$subfield[0])) ) {
  # just adding datas...
+ warn "ADD = $bibid,".$field->tag().",".$field->indicator(1).".".$field->indicator(2).", $tagorder,".@$subfield[0].",$subfieldorder,@$subfield[1])\n";
  		&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
  				 $tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
  	    } else {
  # modify he subfield if it's a different string
+ warn "MODIFY = $bibid,".$field->tag().",".$field->indicator(1).".".$field->indicator(2).", $tagorder,".@$subfield[0].",$subfieldorder,@$subfield[1])\n";
  		if ($oldfield->subfield(@$subfield[0]) ne @$subfield[1] ) {
  		    my $subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
+ warn "MODIFY2 = $bibid, $subfieldid, ".@$subfield[1]."\n";
  		    &MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
  		} else {
***************
*** 987,993 ****
    create a item. $item is a hash and $barcode the barcode.
  
! =head2 OLDmoditem($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement);
    modify item
-   NOTE : not standard API-style. Should be rewriten to be OLDmoditem($dbh,$item) where $item is a hash
  
  =head2 OLDdelitem($dbh,$itemnum);
--- 997,1002 ----
    create a item. $item is a hash and $barcode the barcode.
  
! =head2 OLDmoditem($dbh,$item);
    modify item
  
  =head2 OLDdelitem($dbh,$itemnum);
***************
*** 1377,1399 ****
  
  sub OLDmoditem {
!   my ($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
  #  my $dbh=C4Connect;
!   my $query="update items set biblioitemnumber=$bibitemnum,
!                               barcode='$barcode',itemnotes='$notes'
!                           where itemnumber=$itemnum";
!   if ($barcode eq ''){
!     $query="update items set biblioitemnumber=$bibitemnum,notforloan=$loan where itemnumber=$itemnum";
    }
!   if ($lost ne ''){
!     $query="update items set biblioitemnumber=$bibitemnum,
!                              barcode='$barcode',
!                              itemnotes='$notes',
!                              homebranch='$homebranch',
!                              itemlost='$lost',
!                              wthdrawn='$wthdrawn' 
!                           where itemnumber=$itemnum";
    }
!   if ($replacement ne ''){
!     $query=~ s/ where/,replacementprice='$replacement' where/;
    }
  
--- 1386,1409 ----
  
  sub OLDmoditem {
!     my ($dbh,$item) = @_;
! #  my ($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
  #  my $dbh=C4Connect;
!   my $query="update items set biblioitemnumber=$item->{'bibitemnum'},
!                               barcode='$item->{'barcode'}',itemnotes='$item->{'notes'}'
!                           where itemnumber=$item->{'itemnum'}";
!   if ($item->{'barcode'} eq ''){
!     $query="update items set biblioitemnumber=$item->{'bibitemnum'},notforloan=$item->{'loan'} where itemnumber=$item->{'itemnum'}";
    }
!   if ($item->{'lost'} ne ''){
!     $query="update items set biblioitemnumber=$item->{'bibitemnum'},
!                              barcode='$item->{'barcode'}',
!                              itemnotes='$item->{'notes'}',
!                              homebranch='$item->{'homebranch'}',
!                              itemlost='$item->{'lost'}',
!                              wthdrawn='$item->{'wthdrawn'}' 
!                           where itemnumber=$item->{'itemnum'}";
    }
!   if ($item->{'replacement'} ne ''){
!     $query=~ s/ where/,replacementprice='$item->{'replacement'}' where/;
    }
  
***************
*** 1651,1658 ****
  
  sub moditem {
!   my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
!   my $dbh=C4Connect;
!   &OLDmoditem($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement);
!   $dbh->disconnect;
  }
  
--- 1661,1676 ----
  
  sub moditem {
!     my ($item) = @_;
! #  my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
!     my $dbh=C4Connect;
!     &OLDmoditem($dbh,$item);
!     warn "biblionumber : $item->{'biblionumber'} / $item->{'itemnum'}\n";
!     my $MARCitem = &MARCkoha2marcItem($dbh,$item->{'biblionumber'},$item->{'itemnum'});
!     warn "before MARCmoditem : $item->{biblionumber}, $item->{'itemnum'}\n";
!     warn $MARCitem->as_formatted();
! #      print STDERR "MARCitem ".$MARCitem->as_formatted()."\n";
!     my $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$item->{biblionumber});
!     &MARCmoditem($dbh,$MARCitem,$bibid,$item->{itemnum},0);
!     $dbh->disconnect;
  }
  





More information about the Koha-cvs mailing list