[Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.36.2.13,1.36.2.14

Paul POULAIN tipaul at users.sourceforge.net
Wed Sep 14 18:00:18 CEST 2005


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

Modified Files:
      Tag: rel_2_2
	SearchMarc.pm 
Log Message:
improving getMARCSUBJECT sub :
* for builded authorities / subject, the subject is correctly rebuilded (for example, if you have a subject history -- europe -- world war II -- France, it is correctly rebuilded). This will be interesting only for libraries with complex MARC authorities/thesaurus.
* the link to find related subject is correctly written (using the $9 subfield)

Should change nothing if the subject is not builded through authority ($9)

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.36.2.13
retrieving revision 1.36.2.14
diff -C2 -r1.36.2.13 -r1.36.2.14
*** SearchMarc.pm	26 Jul 2005 08:38:25 -0000	1.36.2.13
--- SearchMarc.pm	14 Sep 2005 16:00:15 -0000	1.36.2.14
***************
*** 588,611 ****
  	} else {           # assume unimarc if not marc21
  		$mintag = "600";
! 		$maxtag = "619";
  	}
! 	my $sth=$dbh->prepare("SELECT subfieldvalue,subfieldcode FROM marc_subfield_table WHERE bibid=? AND tag BETWEEN ? AND ? ORDER BY tagorder");
  
  	$sth->execute($bibid,$mintag,$maxtag);
  
  	my @marcsubjcts;
! 	my $subjct = "";
! 	my $subfield = "";
  	my $marcsubjct;
! 
! 	while (my $data=$sth->fetchrow_arrayref) {
! 		my $value = $data->[0];
! 		my $subfield = $data->[1];
! 		if ($subfield eq "a" && $value ne $subjct) {
! 		        $marcsubjct = {MARCSUBJCT => $value,};
  			push @marcsubjcts, $marcsubjct;
! 			$subjct = $value;
  		}
  	}
  
  	$sth->finish;
--- 588,622 ----
  	} else {           # assume unimarc if not marc21
  		$mintag = "600";
! 		$maxtag = "699";
  	}
! 	my $sth=$dbh->prepare("SELECT subfieldvalue,subfieldcode,tagorder,tag FROM marc_subfield_table WHERE bibid=? AND tag BETWEEN ? AND ? ORDER BY tagorder,subfieldorder");
  
  	$sth->execute($bibid,$mintag,$maxtag);
  
  	my @marcsubjcts;
! 	my $subject = "";
! # 	my $subfield = "";
  	my $marcsubjct;
! 	my $field9;
! 	my $activetagorder=0;
! 	while (my ($subfieldvalue,$subfieldcode,$tagorder,$tag)=$sth->fetchrow) {
! 		if ($activetagorder && $tagorder != $activetagorder) {
! 			$subject=~ s/ -- $//;
! 			$marcsubjct = {MARCSUBJCT => $subject,
! 							link => $tag."9",
! 							linkvalue => $field9,
! 							};
  			push @marcsubjcts, $marcsubjct;
! 			$subject='';
! 		}
! 		if ($subfieldcode eq 9) {
! 			$field9=$subfieldvalue;
! 		} else {
! 			$subject .= $subfieldvalue." -- ";
  		}
+ 		$activetagorder=$tagorder;
  	}
+ 	$marcsubjct = {MARCSUBJCT => $subject,};
+ 	push @marcsubjcts, $marcsubjct;
  
  	$sth->finish;





More information about the Koha-cvs mailing list