[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/opac opac-search.pl,1.24,1.25
From: |
Waylon Robertson |
Subject: |
[Koha-cvs] CVS: koha/opac opac-search.pl,1.24,1.25 |
Date: |
Wed, 01 Jun 2005 16:07:19 -0700 |
Update of /cvsroot/koha/koha/opac
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16344
Modified Files:
opac-search.pl
Log Message:
Addition of new table lists: Categorylist, Subcategorylist and Mediatypelist.
Renamed classlist to itemtypelist.
Index: opac-search.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-search.pl,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** opac-search.pl 4 May 2005 09:02:38 -0000 1.24
--- opac-search.pl 1 Jun 2005 23:07:17 -0000 1.25
***************
*** 17,34 ****
# use C4::Search;
- my $classlist='';
my $dbh=C4::Context->dbh;
my $sth=$dbh->prepare("select description,itemtype from itemtypes order by
description");
$sth->execute;
while (my ($description,$itemtype) = $sth->fetchrow) {
! $classlist.="<option value=\"$itemtype\">$description</option>\n";
}
!
my $query = new CGI;
my $op = $query->param("op");
my $type=$query->param('type');
my $startfrom=$query->param('startfrom');
$startfrom=0 if(!defined $startfrom);
--- 17,64 ----
# use C4::Search;
+ my $itemtypelist;
+ my $brancheslist;
+ my $categorylist;
+ my $subcategorylist;
+ my $mediatypelist;
my $dbh=C4::Context->dbh;
my $sth=$dbh->prepare("select description,itemtype from itemtypes order by
description");
$sth->execute;
while (my ($description,$itemtype) = $sth->fetchrow) {
! $itemtypelist.="<option value=\"$itemtype\">$description</option>\n";
}
+ my $sth=$dbh->prepare("select description,subcategorycode from
subcategorytable order by description");
+ $sth->execute;
+ while (my ($description,$subcategorycode) = $sth->fetchrow) {
+ $subcategorylist.="<option
value=\"$subcategorycode\">$description</option>\n";
+ }
+ my $sth=$dbh->prepare("select description,mediatypecode from mediatypetable
order by description");
+ $sth->execute;
+ while (my ($description,$mediatypecode) = $sth->fetchrow) {
+ $mediatypelist.="<option
value=\"$mediatypecode\">$description</option>\n";
+ }
+ my $sth=$dbh->prepare("select description,categorycode from categorytable
order by description");
+ $sth->execute;
+ while (my ($description,$categorycode) = $sth->fetchrow) {
+ $categorylist .= '<input type="radio" name="categorylist"
value="'.$categorycode.'">'.$description.'<br>';
+ }
+ my $sth=$dbh->prepare("select branchname,branchcode from branches order by
branchname");
+ $sth->execute;
! while (my ($branchname,$branchcode) = $sth->fetchrow) {
! $brancheslist.="<option value=\"$branchcode\">$branchname</option>\n";
! }
my $query = new CGI;
my $op = $query->param("op");
my $type=$query->param('type');
+ my $itemtypesstring=$query->param("itemtypesstring");
+ $itemtypesstring =~s/"//g;
+ my @itemtypes = split ( /\|/, $itemtypesstring);
+ my $branchesstring=$query->param("branchesstring");
+ $branchesstring =~s/"//g;
+ my @branches = split (/\|/, $branchesstring);
+
my $startfrom=$query->param('startfrom');
$startfrom=0 if(!defined $startfrom);
***************
*** 51,54 ****
--- 81,92 ----
}
}
+ if ($itemtypesstring ne ''){
+ $searchdesc .= 'filtered by itemtypes ';
+ $searchdesc .= join(" ",@itemtypes)
+ }
+ if ($branchesstring ne ''){
+ $searchdesc .= ' in branches ';
+ $searchdesc .= join(" ",@branches)
+ }
$resultsperpage= $query->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
***************
*** 71,77 ****
}
findseealso($dbh,address@hidden);
my ($results,$total) = catalogsearch($dbh,
address@hidden,address@hidden,
address@hidden, address@hidden, address@hidden,
!
$startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc);
if ($total ==1) {
if (C4::Context->preference("BiblioDefaultView") eq "normal") {
--- 109,145 ----
}
findseealso($dbh,address@hidden);
+ my $sqlstring;
+ if ($itemtypesstring ne ''){
+ $sqlstring = 'and (biblioitems.itemtype IN (';
+ my $itemtypeloop=0;
+ foreach my $itemtype (@itemtypes){
+ if ($itemtype ne ''){
+ if ($itemtypeloop != 0){
+ $sqlstring .=','
+ }
+ $sqlstring .= '"'.$itemtype.'"';
+ $itemtypeloop++;
+ }
+ }
+ $sqlstring .= '))'
+ }
+ if ($branchesstring ne ''){
+ $sqlstring .= 'and biblio.biblionumber=items.biblionumber and
(items.holdingbranch IN (';
+ my $branchesloop=0;
+ foreach my $branch (@branches){
+ if ($branch ne ''){
+ if ($branchesloop != 0){
+ $sqlstring .=','
+ }
+ $sqlstring .= '"'.$branch.'"';
+ $branchesloop++;
+ }
+ }
+ $sqlstring .= '))'
+ }
+
my ($results,$total) = catalogsearch($dbh,
address@hidden,address@hidden,
address@hidden, address@hidden, address@hidden,
!
$startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc,$sqlstring);
if ($total ==1) {
if (C4::Context->preference("BiblioDefaultView") eq "normal") {
***************
*** 273,276 ****
--- 341,350 ----
suggestion =>
C4::Context->preference("suggestion"),
virtualshelves =>
C4::Context->preference("virtualshelves"),
+ itemtypelist => $itemtypelist,
+ subcategorylist => $subcategorylist,
+ brancheslist => $brancheslist,
+ categorylist => $categorylist,
+ mediatypelist => $mediatypelist,
+ itemtypesstring => $itemtypesstring,
);
***************
*** 319,323 ****
$sth->finish;
! $template->param(classlist => $classlist,
CGIitemtype => $CGIitemtype,
CGIbranch => $CGIbranch,
--- 393,397 ----
$sth->finish;
! $template->param(itemtypelist => $itemtypelist,
CGIitemtype => $CGIitemtype,
CGIbranch => $CGIbranch,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/opac opac-search.pl,1.24,1.25,
Waylon Robertson <=