[Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.14,1.15

Paul POULAIN tipaul at users.sourceforge.net
Fri May 28 10:27:55 CEST 2004


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

Modified Files:
	SearchMarc.pm 
Log Message:
hidding hidden & isurl constraints into MARC subfield structure

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** SearchMarc.pm	10 May 2004 09:24:14 -0000	1.14
--- SearchMarc.pm	28 May 2004 08:27:53 -0000	1.15
***************
*** 220,225 ****
  	# we have bibid list. Now, loads title and author from [offset] to [offset]+[length]
  	my $counter = $offset;
! 	$sth = $dbh->prepare("SELECT biblio.biblionumber,author, title, items.holdingbranch, items.itemcallnumber, bibid
! 							FROM biblio, marc_biblio left join items on items.biblionumber = biblio.biblionumber
  							WHERE biblio.biblionumber = marc_biblio.biblionumber AND bibid = ?
  							GROUP BY items.biblionumber, items.holdingbranch, items.itemcallnumber");
--- 220,227 ----
  	# we have bibid list. Now, loads title and author from [offset] to [offset]+[length]
  	my $counter = $offset;
! 	$sth = $dbh->prepare("SELECT biblio.*, biblioitems.*, items.*
! 							FROM biblio, marc_biblio 
! 							LEFT JOIN items on items.biblionumber = biblio.biblionumber
! 							LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
  							WHERE biblio.biblionumber = marc_biblio.biblionumber AND bibid = ?
  							GROUP BY items.biblionumber, items.holdingbranch, items.itemcallnumber");
***************
*** 228,260 ****
  	my $oldbiblionumber=0;
  	my $totalitems=0;
! 	my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid);
  	my ($oldbibid, $oldauthor, $oldtitle,$oldbiblionumber);
  	while (($counter <= $#result) && ($counter <= ($offset + $length))) {
  		$sth->execute($result[$counter]);
! 		while (($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid) = $sth->fetchrow) {
! # 			warn "bibid : $oldbiblionumber ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid)";
  			# parse the result, putting holdingbranch & itemcallnumber in separate array
! 			# then author, title & 1st array in main array
! 			if ($oldbiblionumber && ($oldbiblionumber ne $biblionumber)) {
! 				my %line;
! 				$line{bibid}=$oldbibid;
! 				$line{author}=$oldauthor;
! 				$line{title}=$oldtitle;
! 				$line{totitem} = $totalitems;
! 				$line{biblionumber} = $oldbiblionumber;
  				my @CNresults2= @CNresults;
! 				$line{CN} = \@CNresults2;
  				@CNresults = ();
! 				push @finalresult, \%line;
  				$totalitems=0;
  			}
! 			$oldbibid = $bibid;
! 			$oldauthor = $author;
! 			$oldtitle = $title;
! 			$oldbiblionumber = $biblionumber;
! 			$totalitems++ if ($holdingbranch);
  			my %lineCN;
! 			$lineCN{holdingbranch} = $holdingbranch;
! 			$lineCN{itemcallnumber} = $itemcallnumber;
  			push @CNresults,\%lineCN;
  		}
--- 230,261 ----
  	my $oldbiblionumber=0;
  	my $totalitems=0;
! 	my $oldline;
! # 	my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid);
  	my ($oldbibid, $oldauthor, $oldtitle,$oldbiblionumber);
  	while (($counter <= $#result) && ($counter <= ($offset + $length))) {
  		$sth->execute($result[$counter]);
! 		while (my $line = $sth->fetchrow_hashref) {
  			# parse the result, putting holdingbranch & itemcallnumber in separate array
! 			# then all other fields in the main array
! 			if ($oldbiblionumber && ($oldbiblionumber ne $line->{biblionumber})) {
! 				my %newline;
! 				%newline = %$oldline;
! 				$newline{totitem} = $totalitems;
! 				$newline{biblionumber} = $oldbiblionumber;
  				my @CNresults2= @CNresults;
! 				$newline{CN} = \@CNresults2;
! 			    $newline{'even'} = 1 if $counter % 2 == 0;
! 				$newline{'odd'} = 1 if $counter % 2 == 1;
  				@CNresults = ();
! 				push @finalresult, \%newline;
  				$totalitems=0;
  			}
! 			$oldbiblionumber = $line->{biblionumber};
! 			$totalitems++ if ($line->{holdingbranch});
! 			$oldline = $line;
! 			# item callnumber & branch
  			my %lineCN;
! 			$lineCN{holdingbranch} = $line->{holdingbranch};
! 			$lineCN{itemcallnumber} = $line->{itemcallnumber};
  			push @CNresults,\%lineCN;
  		}
***************
*** 262,275 ****
  	}
  # add the last line, that is not reached byt the loop / if ($oldbiblionumber...)
! 	my %line;
! 	$line{bibid}=$oldbibid;
! 	$line{author}=$oldauthor;
! 	$line{title}=$oldtitle;
! 	$line{totitem} = $totalitems;
! 	$line{biblionumber} = $oldbiblionumber;
  	my @CNresults2= @CNresults;
! 	$line{CN} = \@CNresults2;
  	@CNresults = ();
! 	push @finalresult, \%line;
  	my $nbresults = $#result + 1;
  	return (\@finalresult, $nbresults);
--- 263,279 ----
  	}
  # add the last line, that is not reached byt the loop / if ($oldbiblionumber...)
! 	my %newline;
! 	%newline = %$oldline;
! 	$newline{totitem} = $totalitems;
! 	$newline{biblionumber} = $oldbiblionumber;
  	my @CNresults2= @CNresults;
! 	$newline{CN} = \@CNresults2;
! 	$newline{'even'} = 1 if $counter % 2 == 0;
! 	$newline{'odd'} = 1 if $counter % 2 == 1;
  	@CNresults = ();
! 	my @CNresults2= @CNresults;
! 	$newline{CN} = \@CNresults2;
! 	@CNresults = ();
! 	push @finalresult, \%newline;
  	my $nbresults = $#result + 1;
  	return (\@finalresult, $nbresults);





More information about the Koha-cvs mailing list