[Koha-cvs] CVS: koha/C4 Authorities.pm,1.4,1.5

Paul POULAIN tipaul at users.sourceforge.net
Fri Nov 14 23:00:48 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv26385/C4

Modified Files:
	Authorities.pm 
Log Message:
minor fixes in thesaurus_popup & authorities.pm
NEW plugin : the plugin that manages 60X field in UNIMARC (i think it's the same in marc21). Used to search a thesaurus entry & parse bibliothesaurus table for category NC (Common Name in french).
The user can enter a search term, and see entries corresponding. If the search is a real entry in the thesaurus, and this entry has dependencies, they are shown too.
For example, if the thesaurus contains :
Geo -- Europe -- France -- Marseille
Geo -- Europe -- France -- Paris
Hist -- Europe -- France -- Revolution

A search on "France"
shows
Geo --Europe --France and Hist -- Europe -- France on the left panel
When the user clic on Geo -- Europe -- France,
Marseille & Paris are shown on the right panel.

When the user selects a value, it's reported to the MARC editor.

NOTE : template ONLY IN FRENCH (but it's 11PM for instance, & i plan to go to bed :-) )

Index: Authorities.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Authorities.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Authorities.pm	3 Sep 2003 15:01:50 -0000	1.4
--- Authorities.pm	14 Nov 2003 22:00:46 -0000	1.5
***************
*** 53,56 ****
--- 53,57 ----
  						&delauthority
  						&modauthority
+ 						&SearchDeeper
  					);
  
***************
*** 110,113 ****
--- 111,116 ----
  	if ($#Thierarchy >=0) {
  		# free form
+ 		$level='' unless $level;
+ 		$hierarchy='' unless $hierarchy;
  		$sth1b->execute($freelib,$hierarchy,$category);
  		($id) = $sth1b->fetchrow;
***************
*** 153,157 ****
  =item SearchAuthority
  
!   $id = &SearchAuthority($dbh,$category,$branch,$searchstring,$type,$offset,$pagesize);
  
    searches for an authority
--- 156,160 ----
  =item SearchAuthority
  
!   ($count, \@array) = &SearchAuthority($dbh,$category,$branch,$searchstring,$type,$offset,$pagesize);
  
    searches for an authority
***************
*** 166,169 ****
--- 169,175 ----
  C<$searchstring> contains a string. Only entries beginning by C<$searchstring> are returned
  
+ return :
+ C<$count> : the number of authorities found
+ C<\@array> : the authorities found. The array contains stdlib,freelib,father,id,hierarchy and level
  
  =cut
***************
*** 197,200 ****
--- 203,245 ----
  	$cnt = $pagesize+1 if ($cnt>$pagesize);
  	return ($cnt,\@results);
+ }
+ 
+ =item SearchDeeper
+ 
+  @array = &SearchAuthority($dbh,$category,$father);
+ 
+   Finds everything depending on the parameter.
+ 
+ C<$dbh> is a DBI::db handle for the Koha database.
+ 
+ C<$category> is the category of the authority
+ 
+ C<$father> Is the string "father".
+ 
+ return :
+ @array : the authorities found. The array contains stdlib,freelib,father,id,hierarchy and level
+ 
+ For example :
+ Geography -- Europe is the father and the result is : France and Germany if there is
+ Geography -- Europe -- France and Geography -- Europe -- Germany in the thesaurus
+ 
+ 
+ =cut
+ sub SearchDeeper  {
+ 	my ($category,$father)=@_;
+ 	my $dbh = C4::Context->dbh;
+ 	my $query="Select distinct level,stdlib,father from bibliothesaurus where category =? and father =? order by category,stdlib";
+ 	my $sth=$dbh->prepare($query);
+ 	$sth->execute($category,"$father --");
+ 	my @results;
+ 	while (my ($level,$stdlib,$father)=$sth->fetchrow){
+ 			my %line;
+ 			$line{level} = $level;
+ 			$line{stdlib}= $stdlib;
+ 			$line{father} = $father;
+ 			push(@results,\%line);
+ 	}
+ 	$sth->finish;
+ 	return (@results);
  }
  





More information about the Koha-cvs mailing list