koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/search.marc dictionary.pl,1.5,1.6


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/search.marc dictionary.pl,1.5,1.6
Date: Wed, 01 Jun 2005 05:51:04 -0700

Update of /cvsroot/koha/koha/search.marc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13572/search.marc

Modified Files:
        dictionary.pl 
Log Message:
some fixes & improvements for dictionnary search in librarian interface

Index: dictionary.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.marc/dictionary.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dictionary.pl       4 May 2005 12:46:27 -0000       1.5
--- dictionary.pl       1 Jun 2005 12:51:02 -0000       1.6
***************
*** 31,34 ****
--- 31,52 ----
  use HTML::Template;
  
+ =head1 NAME
+ 
+ dictionnary.pl : script to search in biblio & authority an existing value
+ 
+ =head1 SYNOPSIS
+ 
+ useful when the user want to search a term before running a query. For 
example, to see if "computer" is used in the database
+ 
+ The parameter "marclist" tells which field is searched (title, author, 
subject, but could be anything else)
+ 
+ This script searches in both biblios & authority
+ * in biblio, the script search in all marc fields related to what the user is 
looking for (for example, if the dictionnary is used on "author", the script 
searches in biblio.author, but also in additional authors & any MARC field 
related to author (through the "seealso" MARC constraint)
+ * in authority, the script search everywhere. Thus, the accepted & rejected 
forms are found.
+ 
+ The script shows all results & the user can choose what he want, that is 
copied into search form.
+ 
+ =cut
+ 
  my $input = new CGI;
  my $field =$input->param('marclist');
***************
*** 39,45 ****
  #my $kohafield = $input->param('kohafield');
  my @search = $input->param('search');
! warn " ".$search[0];
  my $index = $input->param('index');
! warn " index: ".$index;
  my $op=$input->param('op');
  if (($search[0]) and not ($op eq 'do_search')){
--- 57,63 ----
  #my $kohafield = $input->param('kohafield');
  my @search = $input->param('search');
! # warn " ".$search[0];
  my $index = $input->param('index');
! # warn " index: ".$index;
  my $op=$input->param('op');
  if (($search[0]) and not ($op eq 'do_search')){
***************
*** 64,75 ****
  
  if ($op eq "do_search") {
!       ($template, $loggedinuser, $cookie)
!                       = get_template_and_user({template_name => 
"search.marc/dictionary.tmpl",
!                                       query => $input,
!                                       type => $type,
!                                       authnotrequired => 0,
!                                       flagsrequired => {catalogue => 1},
!                                       debug => 1,
!                                       });
        my $sth=$dbh->prepare("Select distinct tagfield,tagsubfield from 
marc_subfield_structure where kohafield = ?");
        $sth->execute("$field");
--- 82,88 ----
  
  if ($op eq "do_search") {
!       #
!       # searching in biblio
!       #
        my $sth=$dbh->prepare("Select distinct tagfield,tagsubfield from 
marc_subfield_structure where kohafield = ?");
        $sth->execute("$field");
***************
*** 85,96 ****
  
        findseealso($dbh,address@hidden);
- #     select distinct m1.bibid from biblio,biblioitems,marc_biblio,marc_word 
as m1 where biblio.biblionumber=marc_biblio.biblionumber and 
biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and 
(m1.word  like 'Paul' and m1.tagsubfield in 
('200f','710a','711a','712a','701a','702a','700a')) order by biblio.title
- 
  
        my @results, my $total;
! #     my ($results,$total) = catalogsearch($dbh,address@hidden 
,address@hidden,
! #                                                                             
address@hidden, address@hidden,  address@hidden,
! #                                                                             
$startfrom*$resultsperpage, $resultsperpage,$orderby);
!       my $strsth="select distinct subfieldvalue, 
count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where 
marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and 
marc_word.tagsubfield in ";
        my $listtags="(";
        foreach my $tag (@tags){
--- 98,104 ----
  
        findseealso($dbh,address@hidden);
  
        my @results, my $total;
!       my $strsth="select distinct subfieldvalue, 
count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where 
marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and 
marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in ";
        my $listtags="(";
        foreach my $tag (@tags){
***************
*** 99,107 ****
        $listtags =~s/,$/)/;
        $strsth .= $listtags." and 
marc_word.tagsubfield=marc_subfield_table.tag+marc_subfield_table.subfieldcode 
group by subfieldvalue ";
!       warn "".$strsth;
        my $value = uc($search[0]);
        $value=~s/\*/%/g;
        $value.= "%" if not($value=~m/%/);
!       warn " texte : ".$value;
  
        $sth=$dbh->prepare($strsth);
--- 107,115 ----
        $listtags =~s/,$/)/;
        $strsth .= $listtags." and 
marc_word.tagsubfield=marc_subfield_table.tag+marc_subfield_table.subfieldcode 
group by subfieldvalue ";
! #     warn "search in biblio : ".$strsth;
        my $value = uc($search[0]);
        $value=~s/\*/%/g;
        $value.= "%" if not($value=~m/%/);
! #     warn " texte : ".$value;
  
        $sth=$dbh->prepare($strsth);
***************
*** 110,114 ****
        my @catresults;
        while (my ($value,$ctresults)=$sth->fetchrow) {
!               warn "countresults : ".$ctresults;
                push @catresults,{value=> $value, 
                                                  
even=>($total-$startfrom*$resultsperpage)%2,
--- 118,122 ----
        my @catresults;
        while (my ($value,$ctresults)=$sth->fetchrow) {
! #             warn "countresults : ".$ctresults;
                push @catresults,{value=> $value, 
                                                  
even=>($total-$startfrom*$resultsperpage)%2,
***************
*** 129,136 ****
        $strsth=~s/ OR$/)/;
        my $strsth = $strsth." and authtypecode is not NULL";
!       warn $strsth;
        my $sth=$dbh->prepare($strsth);
        $sth->execute;
        
        my @authresults;
        my $authnbresults;
--- 137,147 ----
        $strsth=~s/ OR$/)/;
        my $strsth = $strsth." and authtypecode is not NULL";
! #     warn $strsth;
        my $sth=$dbh->prepare($strsth);
        $sth->execute;
        
+       #
+       # searching in authorities
+       #
        my @authresults;
        my $authnbresults;
***************
*** 142,146 ****
  #             warn "auth : $authtypecode nbauthresults : $nbresults";
        }
!       
        ($template, $loggedinuser, $cookie)
                = get_template_and_user({template_name => 
"search.marc/dictionary.tmpl",
--- 153,160 ----
  #             warn "auth : $authtypecode nbauthresults : $nbresults";
        }
!       
!       # 
!       # OK, filling the template with authorities & biblio entries found.
!       #
        ($template, $loggedinuser, $cookie)
                = get_template_and_user({template_name => 
"search.marc/dictionary.tmpl",
***************
*** 148,152 ****
                                type => $type,
                                authnotrequired => 0,
-                               flagsrequired => {borrowers => 1},
                                flagsrequired => {catalogue => 1},
                                debug => 1,
--- 162,165 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]