use C4::SearchMarc;
use C4::Acquisition;
use C4::Biblio;
+use C4::Koha;
+
my @spsuggest; # the array for holding suggestions
my $suggest; # a flag to be set (if there are suggestions it's 1)
my $firstbiblionumber; # needed for directly sending user to first item
my @excluding = $query->param('excluding');
my @operator = $query->param('operator');
my @value = $query->param('value');
-
+ my $orderby = $query->param('orderby');
+ my $desc_or_asc = $query->param('desc_or_asc');
+ my $exactsearch = $query->param('exact');
for (my $i=0;$i<=$#marclist;$i++) {
if ($searchdesc) { # don't put the and_or on the 1st search term
- $searchdesc .= $and_or[$i]." ".$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i]." " if ($value[$i]);
+ $searchdesc .= $and_or[$i].$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]);
} else {
- $searchdesc = $excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i]." " if ($value[$i]);
+ $searchdesc = $excluding[$i].($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]);
+ if ($marclist[$i] eq "biblioitems.isbn") {
+ $value[$i] =~ s/-//g;
+ }
}
}
if ($itemtypesstring ne ''){
}
$resultsperpage= $query->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
- my $orderby = $query->param('orderby');
- my $desc_or_asc = $query->param('desc_or_asc');
+
+ if ($exactsearch) {
+ foreach (@operator) {
+ $_='=';
+ }
+ }
# builds tag and subfield arrays
my @tags;
}
findseealso($dbh,\@tags);
my $sqlstring;
+ my $extratables;
if ($itemtypesstring ne ''){
$sqlstring = 'and (biblioitems.itemtype IN (';
my $itemtypeloop=0;
if ($branchesstring ne ''){
$sqlstring .= 'and biblio.biblionumber=items.biblionumber and (items.holdingbranch IN (';
my $branchesloop=0;
+ $extratables = ',items';
foreach my $branch (@branches){
if ($branch ne ''){
if ($branchesloop != 0){
$sqlstring .= '))'
}
if ($avail){
+ $extratables .= ',items,issues,reserves';
$sqlstring .= "and biblioitems.biblioitemnumber=items.biblioitemnumber and items.itemnumber !=issues.itemnumber and biblio.biblionumber !=reserves.biblionumber and (items.itemlost IS NULL or items.itemlost = 0) and (items.notforloan IS NULL or items.notforloan =0) and (items.wthdrawn IS NULL or items.wthdrawn =0) ";
}
my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
\@excluding, \@operator, \@value,
- $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc,$sqlstring);
+ $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc);
if ($total ==1) {
if (C4::Context->preference("BiblioDefaultView") eq "normal") {
print $query->redirect("/cgi-bin/koha/opac-detail.pl?bib=".@$results[0]->{biblionumber});
- } elsif (C4::Context->preference("BiblioDefaultView") eq "MARC") {
- print $query->redirect("/cgi-bin/koha/MARCdetail.pl?bib=".@$results[0]->{biblionumber});
+ } elsif (C4::Context->preference("BiblioDefaultView") eq "marc") {
+ print $query->redirect("/cgi-bin/koha/opac-MARCdetail.pl?bib=".@$results[0]->{biblionumber});
} else {
- print $query->redirect("/cgi-bin/koha/ISBDdetail.pl?bib=".@$results[0]->{biblionumber});
+ print $query->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?bib=".@$results[0]->{biblionumber});
}
exit;
}
push @field_data, { term => "operator", val=>$operator[$i] };
push @field_data, { term => "value", val=>$value[$i] };
}
-
+ push @field_data, {term => "desc_or_asc", val => $desc_or_asc} if $desc_or_asc;
+ push @field_data, {term => "orderby", val => $orderby} if $orderby;
my @numbers = ();
if ($total>$resultsperpage)
$defaultview => 1,
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
- itemtypelist => $itemtypelist,
- subcategorylist => $subcategorylist,
- brancheslist => $brancheslist,
- categorylist => $categorylist,
- mediatypelist => $mediatypelist,
- itemtypesstring => $itemtypesstring,
- avail => $avail,
);
} else {
});
- $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
+ my $query="Select itemtype,description from itemtypes order by description";
+ my $sth=$dbh->prepare($query);
$sth->execute;
- my @itemtype;
+ my @itemtypeloop;
my %itemtypes;
- push @itemtype, "";
- $itemtypes{''} = "";
while (my ($value,$lib) = $sth->fetchrow_array) {
- push @itemtype, $value;
- $itemtypes{$value}=$lib;
+ my %row =( value => $value,
+ description => $lib,
+ );
+ push @itemtypeloop, \%row;
}
-
- my $CGIitemtype=CGI::scrolling_list( -name => 'value',
- -values => \@itemtype,
- -labels => \%itemtypes,
+ $sth->finish;
+
+ my @oldbranches;
+ my @oldselect_branch;
+ my %oldselect_branches;
+ my ($oldcount2,@oldbranches)=branches();
+ push @oldselect_branch, "";
+ $oldselect_branches{''} = "";
+ for (my $i=0;$i<$oldcount2;$i++){
+ push @oldselect_branch, $oldbranches[$i]->{'branchcode'};#
+ $oldselect_branches{$oldbranches[$i]->{'branchcode'}} = $oldbranches[$i]->{'branchname'};
+ }
+ my $CGIbranch=CGI::scrolling_list( -name => 'value',
+ -values => \@oldselect_branch,
+ -labels => \%oldselect_branches,
-size => 1,
-multiple => 0 );
$sth->finish;
-
- my @branches;
my @select_branch;
my %select_branches;
- my ($count2,@branches)=branches();
+ my $branches=getbranches();
push @select_branch, "";
$select_branches{''} = "";
- for (my $i=0;$i<$count2;$i++){
- push @select_branch, $branches[$i]->{'branchcode'};#
- $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
+ foreach my $branch ( keys %$branches ){
+ push @select_branch, $branches->{$branch}->{'branchcode'};
+ $select_branches{$branches->{$branch}->{'branchcode'}} = $branches->{$branch}->{'branchname'};
}
my $CGIbranch=CGI::scrolling_list( -name => 'value',
-values => \@select_branch,
-multiple => 0 );
$sth->finish;
- $template->param(itemtypelist => $itemtypelist,
- CGIitemtype => $CGIitemtype,
+ $template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary")) if (C4::Context->preference("Disable_Dictionary"));
+ $template->param(
+
+# CHRIS : Whats this?
+# classlist => $classlist,
CGIbranch => $CGIbranch,
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
+ LibraryName => C4::Context->preference("LibraryName"),
+ OpacNav => C4::Context->preference("OpacNav"),
+ opaccredits => C4::Context->preference("opaccredits"),
+ AmazonContent => C4::Context->preference("AmazonContent"),
+ opacsmallimage => C4::Context->preference("opacsmallimage"),
+ opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
+ opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
);
}
# ADDED BY JF