[Koha-cvs] CVS: koha/C4 Biblio.pm,1.16,1.17

Paul POULAIN tipaul at users.sourceforge.net
Thu Oct 10 16:48:30 CEST 2002


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

Modified Files:
	Biblio.pm 
Log Message:
bugfixes

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Biblio.pm	7 Oct 2002 14:04:26 -0000	1.16
--- Biblio.pm	10 Oct 2002 14:48:25 -0000	1.17
***************
*** 2,5 ****
--- 2,8 ----
  # $Id$
  # $Log$
+ # Revision 1.17  2002/10/10 14:48:25  tipaul
+ # bugfixes
+ #
  # Revision 1.16  2002/10/07 14:04:26  tipaul
  # road to 1.3.1 : viewing MARC biblio
***************
*** 291,297 ****
  
      if ($forlibrarian eq 1) {
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,tab as lib from marc_subfield_structure");
      } else {
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,libopac,tab as lib from marc_subfield_structure");
      }
      $sth->execute;
--- 294,300 ----
  
      if ($forlibrarian eq 1) {
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib,tab from marc_subfield_structure");
      } else {
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib,tab from marc_subfield_structure");
      }
      $sth->execute;
***************
*** 301,305 ****
  	$res->{$tag}->{$subfield}->{lib}=$lib;
  	$res->{$tag}->{$subfield}->{tab}=$tab;
- 
      }
      return $res;
--- 304,307 ----
***************
*** 435,474 ****
      my $record = MARC::Record->new();
  #---- TODO : the leader is missing
!     my $sth=$dbh->prepare("select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink 
! 		 		 from marc_subfield_table 
  		 		 where bibid=? order by tagorder,subfieldorder
  		 	 ");
      my $sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield where blobidlink=?");
      $sth->execute($bibid);
      while (my $row=$sth->fetchrow_hashref) {
! 	if ($row->{'valuebloblink'}) { #---- search blob if there is one
! 	    $sth2->execute($row->{'valuebloblink'});
! 	    my $row2=$sth2->fetchrow_hashref;
! 	    $sth2->finish;
! 	    $row->{'subfieldvalue'}=$row2->{'subfieldvalue'};
! 	}
! 	if ($record->field($row->{'tag'})) {
! 	    my $field;
! #--- this test must stay as this, because of strange behaviour of mySQL/Perl DBI with char var containing a number...
! #--- sometimes, eliminates 0 at beginning, sometimes no ;-\\\
! 	    if (length($row->{'tag'}) <3) {
! 		$row->{'tag'} = "0".$row->{'tag'};
! 	    }
! 	    $field =$record->field($row->{'tag'});
! 	    if ($field) {
! 		my $x = $field->add_subfields($row->{'subfieldcode'},$row->{'subfieldvalue'});
! 		$record->delete_field($field);
! 		$record->add_fields($field);
! 	    }
! 	} else {
! 	    if (length($row->{'tag'}) < 3) {
! 		$row->{'tag'} = "0".$row->{'tag'};
! 	    }
! 	    my $temp = MARC::Field->new($row->{'tag'}," "," ", $row->{'subfieldcode'} => $row->{'subfieldvalue'});
! 	    $record->add_fields($temp);
  	}
! 
!     }
!     return $record;
  }
  sub MARCgetitem {
--- 437,472 ----
      my $record = MARC::Record->new();
  #---- TODO : the leader is missing
!     my $sth=$dbh->prepare("select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
! 		 		 from marc_subfield_table
  		 		 where bibid=? order by tagorder,subfieldorder
  		 	 ");
      my $sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield where blobidlink=?");
      $sth->execute($bibid);
+     my $prevtagorder=1;
+     my $prevtag;
+     my %subfieldlist={};
      while (my $row=$sth->fetchrow_hashref) {
! 		if ($row->{'valuebloblink'}) { #---- search blob if there is one
! 			$sth2->execute($row->{'valuebloblink'});
! 			my $row2=$sth2->fetchrow_hashref;
! 			$sth2->finish;
! 			$row->{'subfieldvalue'}=$row2->{'subfieldvalue'};
! 		}
! 		if ($row->{tagorder} ne $prevtagorder) {
! 			my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist);
! 			$record->add_fields($field);
! 			$prevtagorder=$row->{tagorder};
! 			$prevtag = $row->{tag};
! 			%subfieldlist={};
! 			%subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'};
! 		} else {
! 			%subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'};
! 			$prevtag= $row->{tag};
! 		}
  	}
! 	# the last has not been included inside the loop... do it now !
! 	my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist);
! 	$record->add_fields($field);
! 	return $record;
  }
  sub MARCgetitem {





More information about the Koha-cvs mailing list