[Koha-cvs] CVS: koha/C4 AuthoritiesMarc.pm,1.9.2.5,1.9.2.6

Paul POULAIN tipaul at users.sourceforge.net
Tue Jun 7 12:02:03 CEST 2005


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

Modified Files:
      Tag: rel_2_2
	AuthoritiesMarc.pm 
Log Message:
porting dictionnary search from head to 2.2. there is now a ... facing titles, author & subject, to search in biblio & authorities existing values.

Index: AuthoritiesMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -C2 -r1.9.2.5 -r1.9.2.6
*** AuthoritiesMarc.pm	31 May 2005 14:50:46 -0000	1.9.2.5
--- AuthoritiesMarc.pm	7 Jun 2005 10:02:00 -0000	1.9.2.6
***************
*** 65,73 ****
  	# the marclist may contain "mainentry". In this case, search the tag_to_report, that depends on
  	# the authtypecode. Then, search on $a of this tag_to_report
  	for (my $i=0;$i<$#{$tags};$i++) {
  		if (@$tags[$i] eq "mainentry") {
- 			my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
- 			$sth->execute($authtypecode);
- 			my ($tag_to_report) = $sth->fetchrow;
  			@$tags[$i] = $tag_to_report."a";
  		}
--- 65,76 ----
  	# the marclist may contain "mainentry". In this case, search the tag_to_report, that depends on
  	# the authtypecode. Then, search on $a of this tag_to_report
+ 	# also store main entry MARC tag, to extract it at end of search
+ 	my $mainentrytag;
+ 	my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
+ 	$sth->execute($authtypecode);
+ 	my ($tag_to_report) = $sth->fetchrow;
+ 	$mainentrytag = $tag_to_report;
  	for (my $i=0;$i<$#{$tags};$i++) {
  		if (@$tags[$i] eq "mainentry") {
  			@$tags[$i] = $tag_to_report."a";
  		}
***************
*** 88,91 ****
--- 91,99 ----
  	for(my $i = 0 ; $i <= $#{$value} ; $i++)
  	{
+ 		# replace * by %
+ 		@$value[$i] =~ s/\*/%/g;
+ 		# remove % at the beginning
+ 		@$value[$i] =~ s/^%//g;
+ 	    @$value[$i] =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/)/ /g if @$operator[$i] eq "contains";
  		if(@$operator[$i] eq "contains") # if operator is contains, splits the words in separate requests
  		{
***************
*** 175,178 ****
--- 183,188 ----
  		$newline{used} = &AUTHcount_usage($result[$counter]);
  		$newline{biblio_fields} = $tags_using_authtype;
+ 		$newline{even} = $counter % 2;
+ 		$newline{mainentry} = $record->field($mainentrytag)->subfield('a')." ".$record->field($mainentrytag)->subfield('b') if $record->field($mainentrytag);
  		$counter++;
  		push @finalresult, \%newline;
***************
*** 917,920 ****
--- 927,933 ----
  # $Id$
  # $Log$
+ # Revision 1.9.2.6  2005/06/07 10:02:00  tipaul
+ # porting dictionnary search from head to 2.2. there is now a ... facing titles, author & subject, to search in biblio & authorities existing values.
+ #
  # Revision 1.9.2.5  2005/05/31 14:50:46  tipaul
  # fix for authority merging. There was a bug on official installs





More information about the Koha-cvs mailing list