[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/serials subscription-bib-search.pl [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/serials subscription-bib-search.pl [rel_3_0] |
Date: |
Mon, 30 Oct 2006 15:16:06 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/10/30 15:16:06
Modified files:
serials : subscription-bib-search.pl
Log message:
now use zebra to search the catalog.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-bib-search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.1&r2=1.3.2.2
Patches:
Index: subscription-bib-search.pl
===================================================================
RCS file: /sources/koha/koha/serials/subscription-bib-search.pl,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -b -r1.3.2.1 -r1.3.2.2
--- subscription-bib-search.pl 6 Sep 2006 12:57:42 -0000 1.3.2.1
+++ subscription-bib-search.pl 30 Oct 2006 15:16:06 -0000 1.3.2.2
@@ -57,50 +57,58 @@
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Search;
+use C4::Biblio;
-my $query=new CGI;
+my $input=new CGI;
# my $type=$query->param('type');
-my $op = $query->param('op');
+my $op = $input->param('op');
my $dbh = C4::Context->dbh;
-my $startfrom=$query->param('startfrom');
+my $startfrom=$input->param('startfrom');
$startfrom=0 unless $startfrom;
my ($template, $loggedinuser, $cookie);
my $resultsperpage;
if ($op eq "do_search") {
- my @marclist = $query->param('marclist');
- my @and_or = $query->param('and_or');
- my @excluding = $query->param('excluding');
- my @operator = $query->param('operator');
- my @value = $query->param('value');
+ my $query = $input->param('q');
- $resultsperpage= $query->param('resultsperpage');
+ $resultsperpage= $input->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
- my $orderby = $query->param('orderby');
- # builds tag and subfield arrays
- my @tags;
+ my ($error,$marcrecords) = SimpleSearch($query);
+ my $total = scalar @$marcrecords;
- foreach my $marc (@marclist) {
- if ($marc) {
- my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc);
- if ($tag) {
- push @tags,$dbh->quote("$tag$subfield");
- } else {
- push @tags, $dbh->quote(substr($marc,0,4));
- }
- } else {
- push @tags, "";
- }
+ if (defined $error) {
+ $template->param(query_error => $error);
+ warn "error: ".$error;
+ output_html_with_http_headers $input, $cookie, $template->output;
+ exit;
+ }
+ my @results;
+ warn "total=".$total;
+
+ for(my $i=0;$i<$total;$i++) {
+ my %resultsloop;
+ my $marcrecord = MARC::File::USMARC::decode($marcrecords->[$i]);
+ my $biblio = MARCmarc2koha(C4::Context->dbh,$marcrecord,'');
+
+ #build the hash for the template.
+ $resultsloop{highlight} = ($i % 2)?(1):(0);
+ $resultsloop{title} = $biblio->{'title'};
+ $resultsloop{subtitle} = $biblio->{'subtitle'};
+ $resultsloop{biblionumber} = $biblio->{'biblionumber'};
+ $resultsloop{author} = $biblio->{'author'};
+ $resultsloop{publishercode} = $biblio->{'publishercode'};
+ $resultsloop{publicationyear} = $biblio->{'publicationyear'};
+
+ push @results, \%resultsloop;
}
- my ($results,$total) = catalogsearch($dbh, address@hidden,address@hidden,
- address@hidden, address@hidden, address@hidden,
- $startfrom*$resultsperpage,
$resultsperpage,$orderby);
+ use Data::Dumper;
+ warn "results==>".Dumper(@results);
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "serials/result.tmpl",
- query => $query,
+ query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
@@ -115,17 +123,6 @@
$displaynext = 1;
}
- my @field_data = ();
-
-
- for(my $i = 0 ; $i <= $#marclist ; $i++)
- {
- push @field_data, { term => "marclist", val=>$marclist[$i] };
- push @field_data, { term => "and_or", val=>$and_or[$i] };
- push @field_data, { term => "excluding", val=>$excluding[$i] };
- push @field_data, { term => "operator", val=>$operator[$i] };
- push @field_data, { term => "value", val=>$value[$i] };
- }
my @numbers = ();
@@ -139,7 +136,7 @@
($startfrom==($i-1)) && ($highlight=1);
push @numbers, { number => $i,
highlight => $highlight ,
- searchdata=> address@hidden,
+ searchdata=> address@hidden,
startfrom => ($i-1)};
}
}
@@ -154,23 +151,25 @@
} else {
$to = (($startfrom+1)*$resultsperpage);
}
- $template->param(result => $results,
+ $template->param(
+ query => $query,
+ resultsloop => address@hidden,
startfrom=> $startfrom,
displaynext=> $displaynext,
displayprev=> $displayprev,
resultsperpage => $resultsperpage,
startfromnext => $startfrom+1,
startfromprev => $startfrom-1,
- searchdata=>address@hidden,
total=>$total,
from=>$from,
to=>$to,
numbers=>address@hidden,
);
-} else {
+} # end of if ($op eq "do_search")
+ else {
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name =>
"serials/subscription-bib-search.tmpl",
- query => $query,
+ query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {catalogue => 1},
@@ -193,7 +192,7 @@
}
# Print the page
-output_html_with_http_headers $query, $cookie, $template->output;
+output_html_with_http_headers $input, $cookie, $template->output;
# Local Variables:
# tab-width: 4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/serials subscription-bib-search.pl [rel_3_0],
Antoine Farnault <=