[Koha-cvs] CVS: koha/C4 Biblio.pm,1.99,1.100

Paul POULAIN tipaul at users.sourceforge.net
Fri Aug 13 18:37:50 CEST 2004


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29442/C4

Modified Files:
	Biblio.pm 
Log Message:
adding frameworkcode to API in some subs

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.99
retrieving revision 1.100
diff -C2 -r1.99 -r1.100
*** Biblio.pm	30 Jul 2004 13:54:50 -0000	1.99
--- Biblio.pm	13 Aug 2004 16:37:25 -0000	1.100
***************
*** 289,299 ****
  
  sub MARCfind_marc_from_kohafield {
!     my ( $dbh, $kohafield ) = @_;
      return 0, 0 unless $kohafield;
      my $sth =
        $dbh->prepare(
! "select tagfield,tagsubfield from marc_subfield_structure where kohafield=?"
      );
!     $sth->execute($kohafield);
      my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
      return ( $tagfield, $tagsubfield );
--- 289,299 ----
  
  sub MARCfind_marc_from_kohafield {
!     my ( $dbh, $kohafield,$frameworkcode ) = @_;
      return 0, 0 unless $kohafield;
      my $sth =
        $dbh->prepare(
! "select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
      );
!     $sth->execute($frameworkcode,$kohafield);
      my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
      return ( $tagfield, $tagsubfield );
***************
*** 1072,1077 ****
  
  sub MARCmarc2koha {
! 	my ($dbh,$record) = @_;
! 	my $sth=$dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where kohafield=?");
  	my $result;
  	my $sth2=$dbh->prepare("SHOW COLUMNS from biblio");
--- 1072,1077 ----
  
  sub MARCmarc2koha {
! 	my ($dbh,$record,$frameworkcode) = @_;
! 	my $sth=$dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?");
  	my $result;
  	my $sth2=$dbh->prepare("SHOW COLUMNS from biblio");
***************
*** 1079,1083 ****
  	my $field;
  	while (($field)=$sth2->fetchrow) {
! 		$result=&MARCmarc2kohaOneField($sth,"biblio",$field,$record,$result);
  	}
  	$sth2=$dbh->prepare("SHOW COLUMNS from biblioitems");
--- 1079,1083 ----
  	my $field;
  	while (($field)=$sth2->fetchrow) {
! 		$result=&MARCmarc2kohaOneField($sth,"biblio",$field,$record,$result,$frameworkcode);
  	}
  	$sth2=$dbh->prepare("SHOW COLUMNS from biblioitems");
***************
*** 1085,1098 ****
  	while (($field)=$sth2->fetchrow) {
  		if ($field eq 'notes') { $field = 'bnotes'; }
! 		$result=&MARCmarc2kohaOneField($sth,"biblioitems",$field,$record,$result);
  	}
  	$sth2=$dbh->prepare("SHOW COLUMNS from items");
  	$sth2->execute;
  	while (($field)=$sth2->fetchrow) {
! 		$result = &MARCmarc2kohaOneField($sth,"items",$field,$record,$result);
  	}
  	# additional authors : specific
! 	$result = &MARCmarc2kohaOneField($sth,"bibliosubtitle","subtitle",$record,$result);
! 	$result = &MARCmarc2kohaOneField($sth,"additionalauthors","additionalauthors",$record,$result);
  # modify copyrightdate to keep only the 1st year found
  	my $temp = $result->{'copyrightdate'};
--- 1085,1098 ----
  	while (($field)=$sth2->fetchrow) {
  		if ($field eq 'notes') { $field = 'bnotes'; }
! 		$result=&MARCmarc2kohaOneField($sth,"biblioitems",$field,$record,$result,$frameworkcode);
  	}
  	$sth2=$dbh->prepare("SHOW COLUMNS from items");
  	$sth2->execute;
  	while (($field)=$sth2->fetchrow) {
! 		$result = &MARCmarc2kohaOneField($sth,"items",$field,$record,$result,$frameworkcode);
  	}
  	# additional authors : specific
! 	$result = &MARCmarc2kohaOneField($sth,"bibliosubtitle","subtitle",$record,$result,$frameworkcode);
! 	$result = &MARCmarc2kohaOneField($sth,"additionalauthors","additionalauthors",$record,$result,$frameworkcode);
  # modify copyrightdate to keep only the 1st year found
  	my $temp = $result->{'copyrightdate'};
***************
*** 1119,1123 ****
  
  # FIXME ? if a field has a repeatable subfield that is used in old-db, only the 1st will be retrieved...
!     my ( $sth, $kohatable, $kohafield, $record, $result ) = @_;
  
      #    warn "kohatable / $kohafield / $result / ";
--- 1119,1123 ----
  
  # FIXME ? if a field has a repeatable subfield that is used in old-db, only the 1st will be retrieved...
!     my ( $sth, $kohatable, $kohafield, $record, $result,$frameworkcode ) = @_;
  
      #    warn "kohatable / $kohafield / $result / ";
***************
*** 1125,1129 ****
      my $tagfield;
      my $subfield;
!     $sth->execute( $kohatable . "." . $kohafield );
      ( $tagfield, $subfield ) = $sth->fetchrow;
      foreach my $field ( $record->field($tagfield) ) {
--- 1125,1129 ----
      my $tagfield;
      my $subfield;
!     $sth->execute( $frameworkcode,$kohatable . "." . $kohafield );
      ( $tagfield, $subfield ) = $sth->fetchrow;
      foreach my $field ( $record->field($tagfield) ) {
***************
*** 1203,1207 ****
      my $oldbibnum;
      my $oldbibitemnum;
!     my $olddata = MARCmarc2koha( $dbh, $record );
      $oldbibnum = OLDnewbiblio( $dbh, $olddata );
      $olddata->{'biblionumber'} = $oldbibnum;
--- 1203,1207 ----
      my $oldbibnum;
      my $oldbibitemnum;
!     my $olddata = MARCmarc2koha( $dbh, $record,$frameworkcode );
      $oldbibnum = OLDnewbiblio( $dbh, $olddata );
      $olddata->{'biblionumber'} = $oldbibnum;
***************
*** 1210,1214 ****
      # search subtiles, addiauthors and subjects
      my ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "additionalauthors.author" );
      my @addiauthfields = $record->field($tagfield);
      foreach my $addiauthfield (@addiauthfields) {
--- 1210,1214 ----
      # search subtiles, addiauthors and subjects
      my ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "additionalauthors.author",$frameworkcode );
      my @addiauthfields = $record->field($tagfield);
      foreach my $addiauthfield (@addiauthfields) {
***************
*** 1220,1224 ****
      }
      ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "bibliosubtitle.title" );
      my @subtitlefields = $record->field($tagfield);
      foreach my $subtitlefield (@subtitlefields) {
--- 1220,1224 ----
      }
      ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "bibliosubtitle.title",$frameworkcode );
      my @subtitlefields = $record->field($tagfield);
      foreach my $subtitlefield (@subtitlefields) {
***************
*** 1230,1234 ****
      }
      ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "bibliosubject.subject" );
      my @subj = $record->field($tagfield);
      my @subjects;
--- 1230,1234 ----
      }
      ( $tagfield, $tagsubfield ) =
!       MARCfind_marc_from_kohafield( $dbh, "bibliosubject.subject",$frameworkcode );
      my @subj = $record->field($tagfield);
      my @subjects;
***************
*** 1279,1287 ****
  	$frameworkcode="" unless $frameworkcode;
  	&MARCmodbiblio($dbh,$bibid,$record,$frameworkcode,0);
! 	my $oldbiblio = MARCmarc2koha($dbh,$record);
  	my $oldbiblionumber = OLDmodbiblio($dbh,$oldbiblio);
  	OLDmodbibitem($dbh,$oldbiblio);
  	# now, modify addi authors, subject, addititles.
! 	my ($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"additionalauthors.author");
  	my @addiauthfields = $record->field($tagfield);
  	foreach my $addiauthfield (@addiauthfields) {
--- 1279,1287 ----
  	$frameworkcode="" unless $frameworkcode;
  	&MARCmodbiblio($dbh,$bibid,$record,$frameworkcode,0);
! 	my $oldbiblio = MARCmarc2koha($dbh,$record,$frameworkcode);
  	my $oldbiblionumber = OLDmodbiblio($dbh,$oldbiblio);
  	OLDmodbibitem($dbh,$oldbiblio);
  	# now, modify addi authors, subject, addititles.
! 	my ($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"additionalauthors.author",$frameworkcode);
  	my @addiauthfields = $record->field($tagfield);
  	foreach my $addiauthfield (@addiauthfields) {
***************
*** 1291,1295 ****
  		}
  	}
! 	($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubtitle.subtitle");
  	my @subtitlefields = $record->field($tagfield);
  	foreach my $subtitlefield (@subtitlefields) {
--- 1291,1295 ----
  		}
  	}
! 	($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubtitle.subtitle",$frameworkcode);
  	my @subtitlefields = $record->field($tagfield);
  	foreach my $subtitlefield (@subtitlefields) {
***************
*** 1299,1303 ****
  		}
  	}
! 	($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject");
  	my @subj = $record->field($tagfield);
  	my @subjects;
--- 1299,1303 ----
  		}
  	}
! 	($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject",$frameworkcode);
  	my @subj = $record->field($tagfield);
  	my @subjects;
***************
*** 1330,1334 ****
  
      # add item in old-DB
!     my $item = &MARCmarc2koha( $dbh, $record );
  
      # needs old biblionumber and biblioitemnumber
--- 1330,1336 ----
  
      # add item in old-DB
! 	my $frameworkcode=MARCfind_frameworkcode($dbh,$bibid);
! 	
!     my $item = &MARCmarc2koha( $dbh, $record,$frameworkcode );
  
      # needs old biblionumber and biblioitemnumber
***************
*** 1356,1360 ****
      my ( $dbh, $record, $bibid, $itemnumber, $delete ) = @_;
      &MARCmoditem( $dbh, $record, $bibid, $itemnumber, $delete );
!     my $olditem = MARCmarc2koha( $dbh, $record );
      OLDmoditem( $dbh, $olditem );
  }
--- 1358,1363 ----
      my ( $dbh, $record, $bibid, $itemnumber, $delete ) = @_;
      &MARCmoditem( $dbh, $record, $bibid, $itemnumber, $delete );
! 	my $frameworkcode=MARCfind_frameworkcode($dbh,$bibid);
!     my $olditem = MARCmarc2koha( $dbh, $record,$frameworkcode );
      OLDmoditem( $dbh, $olditem );
  }
***************
*** 2532,2535 ****
--- 2535,2541 ----
  # $Id$
  # $Log$
+ # Revision 1.100  2004/08/13 16:37:25  tipaul
+ # adding frameworkcode to API in some subs
+ #
  # Revision 1.99  2004/07/30 13:54:50  doxulting
  # Beginning of serial commit





More information about the Koha-cvs mailing list