parent
a21293a475
commit
ec64f1fcd8
|
|
@ -219,19 +219,58 @@ sub catalogsearch {
|
|||
|
||||
# we have bibid list. Now, loads title and author from [offset] to [offset]+[length]
|
||||
my $counter = $offset;
|
||||
$sth = $dbh->prepare("select author,title from biblio,marc_biblio where biblio.biblionumber=marc_biblio.biblionumber and bibid=?");
|
||||
$sth = $dbh->prepare("SELECT biblio.biblionumber,author, title, items.holdingbranch, items.itemcallnumber, bibid
|
||||
FROM biblio, marc_biblio left join items on items.biblionumber = biblio.biblionumber
|
||||
WHERE biblio.biblionumber = marc_biblio.biblionumber AND bibid = ?
|
||||
GROUP BY items.biblionumber, items.holdingbranch, items.itemcallnumber");
|
||||
my @finalresult = ();
|
||||
my @CNresults=();
|
||||
my $oldbiblionumber=0;
|
||||
my $totalitems=0;
|
||||
my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid);
|
||||
my ($oldbibid, $oldauthor, $oldtitle,$oldbiblionumber);
|
||||
while (($counter <= $#result) && ($counter <= ($offset + $length))) {
|
||||
$sth->execute($result[$counter]);
|
||||
my ($author,$title) = $sth->fetchrow;
|
||||
my %line;
|
||||
$line{bibid}=$result[$counter];
|
||||
$line{author}=$author;
|
||||
$line{title}=$title;
|
||||
push @finalresult, \%line;
|
||||
while (($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid) = $sth->fetchrow) {
|
||||
# warn "bibid : $oldbiblionumber ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid)";
|
||||
# parse the result, putting holdingbranch & itemcallnumber in separate array
|
||||
# then author, title & 1st array in main array
|
||||
if ($oldbiblionumber && ($oldbiblionumber ne $biblionumber)) {
|
||||
my %line;
|
||||
$line{bibid}=$oldbibid;
|
||||
$line{author}=$oldauthor;
|
||||
$line{title}=$oldtitle;
|
||||
$line{totitem} = $totalitems;
|
||||
$line{biblionumber} = $oldbiblionumber;
|
||||
my @CNresults2= @CNresults;
|
||||
$line{CN} = \@CNresults2;
|
||||
@CNresults = ();
|
||||
push @finalresult, \%line;
|
||||
$totalitems=0;
|
||||
}
|
||||
$oldbibid = $bibid;
|
||||
$oldauthor = $author;
|
||||
$oldtitle = $title;
|
||||
$oldbiblionumber = $biblionumber;
|
||||
$totalitems++ if ($holdingbranch);
|
||||
my %lineCN;
|
||||
$lineCN{holdingbranch} = $holdingbranch;
|
||||
$lineCN{itemcallnumber} = $itemcallnumber;
|
||||
push @CNresults,\%lineCN;
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
# add the last line, that is not reached byt the loop / if ($oldbiblionumber...)
|
||||
my %line;
|
||||
$line{bibid}=$oldbibid;
|
||||
$line{author}=$oldauthor;
|
||||
$line{title}=$oldtitle;
|
||||
$line{totitem} = $totalitems;
|
||||
$line{biblionumber} = $oldbiblionumber;
|
||||
my @CNresults2= @CNresults;
|
||||
$line{CN} = \@CNresults2;
|
||||
@CNresults = ();
|
||||
push @finalresult, \%line;
|
||||
my $nbresults = $#result + 1;
|
||||
return (\@finalresult, $nbresults);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,15 @@
|
|||
<div id="homebloc">
|
||||
<h1 class="LibraryName"><TMPL_VAR name="LibraryName"></h1>
|
||||
<h2>Search the catalogue</h2>
|
||||
<form action="/cgi-bin/koha/opac-searchresults.pl">
|
||||
<form action="/cgi-bin/koha/opac-search.pl">
|
||||
<p>
|
||||
<input type="hidden" name="op" value="do_search">
|
||||
<input type="hidden" name="type" value="opac" />
|
||||
<input type="text" size="27" name="keyword" tabindex="1" /> <input type="submit" value="OK" class="button" /><br />
|
||||
<input type="hidden" name="marclist" value="">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" size="27" name="value" tabindex="1" /> <input type="submit" value="OK" class="button" /><br />
|
||||
</p>
|
||||
<p>
|
||||
<a href="/cgi-bin/koha/opac-search.pl">Advanced Search, More Options </a>
|
||||
|
|
|
|||
|
|
@ -1,35 +1,129 @@
|
|||
<!-- TMPL_INCLUDE name="opac-top.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="opac-top.inc" -->
|
||||
<div id="mainbloc">
|
||||
<h1>Advanced search</h1>
|
||||
<form action="/cgi-bin/koha/opac-searchresults.pl" method="get">
|
||||
<ul>
|
||||
<li><label>keyword</label><input type="text" size="25" name="keyword" /></li>
|
||||
</ul>
|
||||
<p><b>OR :</b></p>
|
||||
<ul>
|
||||
<li><label>subject</label><input type="text" size="25" name="subject" /></li>
|
||||
</ul>
|
||||
<p><b>OR one or more from :</b></p>
|
||||
<ul>
|
||||
<li><label>Title</label><input type="text" size="25" name="title" /></li>
|
||||
<li><label>Author</label><input type="text" size="25" name="author" /></li>
|
||||
<li><label>Illustrator</label><input type="text" size="25" name="illustrator" /></li>
|
||||
<li><label>Item type</label>
|
||||
<select size="1" name="class">
|
||||
<option value="">Any</option>
|
||||
<!-- TMPL_VAR name="classlist" -->
|
||||
</select>
|
||||
</li>
|
||||
<li><label>Barcode</label><input type="text" size="25" name="itemnumber" /></li>
|
||||
</ul>
|
||||
<p>using <input type="radio" name="ttype" value="normal" />Normal or <input type="radio" name="ttype" value="exact" />Exact search</p>
|
||||
|
||||
<p>
|
||||
<input type="submit" value="OK Start Search" class="button" />
|
||||
<input type="reset" value="Clear All Fields" class="button" />
|
||||
</p>
|
||||
<p>Note that if you enter a value in Keyword and a value somewhere else, only keyword will be used</p>
|
||||
</form>
|
||||
<h1 class="catalogue">Catalogue search</h1>
|
||||
|
||||
<form name="f" method="post">
|
||||
<input type="hidden" name="op" value="do_search">
|
||||
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
|
||||
<div id="bloc25">
|
||||
<h2 class="catalogue">Search on</h2>
|
||||
<p>
|
||||
<label class="label20">Keyword</label>
|
||||
<input type="hidden" name="marclist" value="">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">Title</label>
|
||||
<input type="hidden" name="marclist" value="biblio.title">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">author</label> <input type="hidden" name="marclist" value="biblio.author">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">barcode</label>
|
||||
<input type="hidden" name="marclist" value="items.barcode">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">Illustrator</label>
|
||||
<input type="hidden" name="marclist" value="biblioitems.illus">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">Dewey</label><input type="hidden" name="marclist" value="biblioitems.dewey">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="contains">
|
||||
<input type="text" name="value" onchange="sql_update()">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">Item Type</label> <input type="hidden" name="marclist" value="biblioitems.itemtype">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="=">
|
||||
<!-- TMPL_VAR name="CGIitemtype" -->
|
||||
</p>
|
||||
<p>
|
||||
<label class="label20">branch</label>
|
||||
<input type="hidden" name="marclist" value="items.holdingbranch">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
<input type="hidden" name="operator" value="=">
|
||||
<!-- TMPL_VAR name="CGIbranch" -->
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div id="bloc25">
|
||||
<p>Results per page :
|
||||
<select align="right" name="resultsperpage" size="1">
|
||||
<option value="20">20</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
Ordered by
|
||||
<select name="orderby" size="1">
|
||||
<option value="biblio.title">Title</option>
|
||||
<option value="biblio.author">Author</option>
|
||||
<option value="biblioitems.dewey">Dewey</option>
|
||||
<option value="biblioitems.publicationyear">Publication Year</option>
|
||||
<option value="biblioitems.publishercode">Publisher</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Start search" class="button catalogue">
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function sql_update() {
|
||||
document.f.sql.value="";
|
||||
for (i=0 ; i<document.f.marclist.length ; i++) {
|
||||
if (document.f.value[i].value.length>0) {
|
||||
document.f.sql.value = document.f.sql.value+
|
||||
document.f.and_or[i].value + ' (' +
|
||||
document.f.excluding[i].value + ' ' +
|
||||
document.f.marclist[i].value + ' ' +
|
||||
document.f.operator[i].value + ' ' +
|
||||
'\''+document.f.value[i].value + '\') ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AddStatement() {
|
||||
|
||||
document.forms[0].op.value="AddStatement";
|
||||
document.f.submit();
|
||||
}
|
||||
|
||||
function PopupSuggestion() {
|
||||
var strQuery="";
|
||||
for (i=0 ; i<document.f.marclist.length ; i++) {
|
||||
if (document.f.value[i].value.length>0) {
|
||||
strQuery += " "+document.f.value[i].value;
|
||||
}
|
||||
}
|
||||
newin=window.open("suggest.pl?Q="+strQuery,"Suggestions",'width=500,height=400,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
</script>
|
||||
</div>
|
||||
<!-- TMPL_INCLUDE name="opac-bottom.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
|
||||
|
|
|
|||
|
|
@ -4,143 +4,131 @@
|
|||
<p class="center">You searched on <b><!-- TMPL_VAR NAME="searchdesc" --></b></p>
|
||||
<!-- TMPL_ELSE -->
|
||||
<!-- TMPL_IF name="searchnew" -->
|
||||
<p><!-- TMPL_VAR name=itemtype --> acquired in the last <i><!-- TMPL_VAR name="duration" --></i> days</p>
|
||||
<p class="center"><!-- TMPL_VAR name=itemtype --> acquired in the last <i><!-- TMPL_VAR name="duration" --></i> days</p>
|
||||
<!-- TMPL_ELSE -->
|
||||
<p>You did not specify any search criteria</p>
|
||||
<p class="center">You did not specify any search criteria</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<p class="center"><!-- TMPL_VAR NAME="numrecords" --> results found</p>
|
||||
<p class="center">
|
||||
<!-- Row of numbers corresponding to search result pages -->
|
||||
<!-- TMPL_IF NAME="displayprev" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME='prevstartfrom' --><!-- TMPL_LOOP NAME='FORMINPUTS' -->&<!-- TMPL_VAR NAME='field' -->=<!-- TMPL_VAR NAME='value' ESCAPE=URL --><!-- /TMPL_LOOP -->"><<</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_LOOP NAME="numbers" -->
|
||||
<!-- TMPL_IF NAME="highlight" -->
|
||||
<span class="smallnumberactive"><!--TMPL_VAR name="number" --></span>
|
||||
<!-- TMPL_ELSE -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->" class="smallnumber">
|
||||
<!--TMPL_VAR name="number" -->
|
||||
</a>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
<!-- TMPL_IF NAME="displaynext" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="nextstartfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->">>></a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
<p> </p>
|
||||
<!-- Search Results Table -->
|
||||
<!-- TMPL_IF NAME="numrecords" -->
|
||||
<!-- If we have a subject table -->
|
||||
<!-- TMPL_IF NAME="subjectsearch" -->
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr bgcolor="#99cccc" background="<!-- TMPL_VAR NAME="themelang" -->/images/background-opac.gif">
|
||||
<th>Subject</th>
|
||||
</tr>
|
||||
<!-- TMPL_LOOP NAME=SEARCH_RESULTS -->
|
||||
<tr>
|
||||
<td><a href="/cgi-bin/koha/opac-searchresults.pl?&subjectitems=<!-- TMPL_VAR NAME=subject ESCAPE=URL -->"><!-- TMPL_VAR NAME=subject --></a></td>
|
||||
</tr>
|
||||
<p class="center"><!-- TMPL_VAR NAME="total" --> results found</p>
|
||||
<div id="resultnumber">
|
||||
<p class="center">
|
||||
<!-- TMPL_IF NAME=displayprev -->
|
||||
<a href=opac-search.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search>
|
||||
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border=0>
|
||||
</a>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_LOOP NAME=numbers -->
|
||||
<!-- TMPL_IF NAME=highlight -->
|
||||
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME=number -->-highlight.gif">
|
||||
<!-- TMPL_ELSE -->
|
||||
<a href=opac-search.pl?startfrom=<!-- TMPL_VAR NAME=startfrom -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search><img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME=number -->.gif" border=0></a>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
<tr bgcolor="#99cccc" background="<!-- TMPL_VAR NAME="themelang" -->/images/background-opac.gif">
|
||||
<td colspan="4">
|
||||
|
||||
<!-- TMPL_IF NAME=displaynext -->
|
||||
<a href=opac-search.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->&resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search><img src="/intranet-tmpl/default/images/numbers/next.gif" border=0></a>
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
<p class="center">
|
||||
<!-- TMPL_IF name=total -->
|
||||
 <b>Results <!-- TMPL_VAR name="from" --> to <!-- TMPL_VAR name="to" --> of <!-- TMPL_VAR name="total" --></b><br><br>
|
||||
<!-- TMPL_ELSE -->
|
||||
  No results found.<br>
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
</div>
|
||||
<!-- Search Results Table -->
|
||||
<!-- TMPL_IF NAME="total" -->
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Author</th>
|
||||
<th>©</th>
|
||||
<th>Item Count</th>
|
||||
<th>Location</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<!-- Actual Search Results -->
|
||||
<!-- TMPL_LOOP NAME="results" -->
|
||||
<tr>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE=URL -->"><!-- TMPL_VAR NAME="title" --></a>
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-searchresults.pl?author=<!-- TMPL_VAR NAME="author" ESCAPE=URL -->"><!-- TMPL_VAR NAME="author" --></a>
|
||||
</td>
|
||||
<td align="center"<!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR NAME="copyrightdate" -->
|
||||
</td>
|
||||
<td align="center" <!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR name="totitem" -->
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_LOOP name="CN" -->
|
||||
<!-- TMPL_VAR name="holdingbranch" --> <!-- TMPL_IF name="itemcallnumber" -->(<!-- TMPL_VAR name="itemcallnumber" -->)<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_UNLESS NAME="norequests" -->
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-reserve.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE=URL -->">Request</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
Not Reservable
|
||||
<!-- /TMPL_UNLESS -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- /TMPL_LOOP -->
|
||||
<tr>
|
||||
<th align="left">
|
||||
<!-- TMPL_IF NAME="displayprev" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="prevstartfrom" --><!-- TMPL_LOOP NAME=FORMINPUTS -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->"><<< Previous</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
</th>
|
||||
<th colspan="3"> </th>
|
||||
<th colspan="2" align="right">
|
||||
<!-- TMPL_IF NAME="displaynext" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="nextstartfrom" --><!-- TMPL_LOOP NAME=FORMINPUTS -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->">Next >>></a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Else we have a list of items -->
|
||||
<!-- TMPL_ELSE -->
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Author</th>
|
||||
<th>©</th>
|
||||
<th>Item Count</th>
|
||||
<th>Location</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<!-- Actual Search Results -->
|
||||
<!-- TMPL_LOOP NAME="SEARCH_RESULTS" -->
|
||||
<tr>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE=URL -->"><!-- TMPL_VAR NAME="title" --></a>
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-searchresults.pl?author=<!-- TMPL_VAR NAME="author" ESCAPE=URL -->"><!-- TMPL_VAR NAME="author" --></a>
|
||||
</td>
|
||||
<td align="center"<!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR NAME="copyrightdate" -->
|
||||
</td>
|
||||
<td align="center" <!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR NAME="itemcount" -->
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR NAME="location" -->
|
||||
</td>
|
||||
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_UNLESS NAME="norequests" -->
|
||||
<a class="transparent" href="/cgi-bin/koha/opac-reserve.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE=URL -->">Request</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
Not Reservable
|
||||
<!-- /TMPL_UNLESS -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
<tr>
|
||||
<th align="left">
|
||||
<!-- TMPL_IF NAME="displayprev" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="prevstartfrom" --><!-- TMPL_LOOP NAME=FORMINPUTS -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->"><<< Previous</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<p class="center">
|
||||
Results <i><!-- TMPL_VAR NAME="from" --></i> through <i><!-- TMPL_VAR NAME="to" --></i> of <i><!-- TMPL_VAR NAME="total" --></i> records.
|
||||
</p>
|
||||
|
||||
<div id="resultnumber">
|
||||
<p class="center">
|
||||
<!-- TMPL_IF NAME=displayprev -->
|
||||
<a href=search.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search>
|
||||
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border=0>
|
||||
</a>
|
||||
<!-- /TMPL_IF -->
|
||||
</th>
|
||||
<th colspan="3"> </th>
|
||||
<th colspan="2" align="right">
|
||||
<!-- TMPL_IF NAME="displaynext" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="nextstartfrom" --><!-- TMPL_LOOP NAME=FORMINPUTS -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->">Next >>></a>
|
||||
<!-- TMPL_LOOP NAME=numbers -->
|
||||
<!-- TMPL_IF NAME=highlight -->
|
||||
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME=number -->-highlight.gif">
|
||||
<!-- TMPL_ELSE -->
|
||||
<a href=search.pl?startfrom=<!-- TMPL_VAR NAME=startfrom -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search><img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME=number -->.gif" border=0></a>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
<!-- TMPL_IF NAME=displaynext -->
|
||||
<a href=search.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&<!-- TMPL_LOOP NAME=searchdata --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR name="val" ESCAPE=URL -->&<!-- /TMPL_LOOP -->&resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&type=intranet&op=do_search><img src="/intranet-tmpl/default/images/numbers/next.gif" border=0></a>
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
<p class="center">
|
||||
<!-- TMPL_IF name=total -->
|
||||
 <b>Results <!-- TMPL_VAR name="from" --> to <!-- TMPL_VAR name="to" --> of <!-- TMPL_VAR name="total" --></b><br><br>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
  No results found.<br>
|
||||
<!-- /TMPL_IF -->
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<p class="center">
|
||||
Results <i><!-- TMPL_VAR NAME="startfrom" --></i> through <i><!-- TMPL_VAR NAME="endat" --></i> of <i><!-- TMPL_VAR NAME="numrecords" --></i> records.
|
||||
</p>
|
||||
|
||||
<p class="center">
|
||||
<!-- Row of numbers corresponding to search result pages -->
|
||||
<!-- TMPL_IF NAME="displayprev" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME='prevstartfrom' --><!-- TMPL_LOOP NAME='FORMINPUTS' -->&<!-- TMPL_VAR NAME='field' -->=<!-- TMPL_VAR NAME='value' ESCAPE=URL --><!-- /TMPL_LOOP -->"><<</a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_LOOP NAME="numbers" -->
|
||||
<!-- TMPL_IF NAME="highlight" -->
|
||||
<span class="smallnumberactive"><!--TMPL_VAR name="number" --></span>
|
||||
<!-- TMPL_ELSE -->
|
||||
<a class="smallnumber" href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->">
|
||||
<!--TMPL_VAR name="number" -->
|
||||
</a>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
<!-- TMPL_IF NAME="displaynext" -->
|
||||
<a href="/cgi-bin/koha/opac-searchresults.pl?startfrom=<!-- TMPL_VAR NAME="nextstartfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE=URL --><!-- /TMPL_LOOP -->">>></a>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- TMPL_ELSE -->
|
||||
<p class="center"> Sorry, there were no results </p>
|
||||
<p class="center"> Sorry, there were no results </p>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<p class="center">
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ $template->param(BIBLIO_RESULTS => $resultsarray);
|
|||
$template->param(ITEM_RESULTS => $itemsarray);
|
||||
$template->param(WEB_RESULTS => $webarray);
|
||||
$template->param(SITE_RESULTS => $sitearray,
|
||||
LibraryName => C4::Context->preference("LibraryName"),
|
||||
);
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,5 @@ my ($template, $borrowernumber, $cookie)
|
|||
});
|
||||
|
||||
$template->param(CGIitemtype => $CGIitemtype,
|
||||
LibraryName => C4::Context->preference("LibraryName"),
|
||||
);
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ use C4::Context;
|
|||
use CGI;
|
||||
use C4::Database;
|
||||
use HTML::Template;
|
||||
use C4::SearchMarc;
|
||||
use C4::Catalogue;
|
||||
use C4::Biblio;
|
||||
|
||||
my $classlist='';
|
||||
|
||||
|
|
@ -20,18 +23,162 @@ while (my ($description,$itemtype) = $sth->fetchrow) {
|
|||
|
||||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param("op");
|
||||
my $type=$query->param('type');
|
||||
|
||||
my ($template, $borrowernumber, $cookie)
|
||||
= get_template_and_user({template_name => "opac-search.tmpl",
|
||||
query => $query,
|
||||
type => "opac",
|
||||
authnotrequired => 1,
|
||||
flagsrequired => {borrow => 1},
|
||||
});
|
||||
my $startfrom=$query->param('startfrom');
|
||||
$startfrom=0 if(!defined $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');
|
||||
|
||||
$resultsperpage= $query->param('resultsperpage');
|
||||
$resultsperpage = 19 if(!defined $resultsperpage);
|
||||
my $orderby = $query->param('orderby');
|
||||
|
||||
# builds tag and subfield arrays
|
||||
my @tags;
|
||||
|
||||
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, "";
|
||||
}
|
||||
}
|
||||
findseealso($dbh,\@tags);
|
||||
warn "IN THERE";
|
||||
my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
|
||||
\@excluding, \@operator, \@value,
|
||||
$startfrom*$resultsperpage, $resultsperpage,$orderby);
|
||||
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "opac-searchresults.tmpl",
|
||||
query => $query,
|
||||
type => 'opac',
|
||||
authnotrequired => 1,
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
# multi page display gestion
|
||||
my $displaynext=0;
|
||||
my $displayprev=$startfrom;
|
||||
if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
|
||||
$displaynext = 1;
|
||||
}
|
||||
|
||||
my @field_data = ();
|
||||
|
||||
|
||||
$template->param(classlist => $classlist,
|
||||
LibraryName => C4::Context->preference("LibraryName"),
|
||||
);
|
||||
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 = ();
|
||||
|
||||
if ($total>$resultsperpage)
|
||||
{
|
||||
for (my $i=1; $i<$total/$resultsperpage+1; $i++)
|
||||
{
|
||||
if ($i<16)
|
||||
{
|
||||
my $highlight=0;
|
||||
($startfrom==($i-1)) && ($highlight=1);
|
||||
push @numbers, { number => $i,
|
||||
highlight => $highlight ,
|
||||
searchdata=> \@field_data,
|
||||
startfrom => ($i-1)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $from = $startfrom*$resultsperpage+1;
|
||||
my $to;
|
||||
|
||||
if($total < (($startfrom+1)*$resultsperpage))
|
||||
{
|
||||
$to = $total;
|
||||
} else {
|
||||
$to = (($startfrom+1)*$resultsperpage);
|
||||
}
|
||||
$template->param(results => $results,
|
||||
startfrom=> $startfrom,
|
||||
displaynext=> $displaynext,
|
||||
displayprev=> $displayprev,
|
||||
resultsperpage => $resultsperpage,
|
||||
startfromnext => $startfrom+1,
|
||||
startfromprev => $startfrom-1,
|
||||
searchdata=>\@field_data,
|
||||
total=>$total,
|
||||
from=>$from,
|
||||
to=>$to,
|
||||
numbers=>\@numbers,
|
||||
);
|
||||
|
||||
} else {
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "opac-search.tmpl",
|
||||
query => $query,
|
||||
type => "opac",
|
||||
authnotrequired => 1,
|
||||
});
|
||||
|
||||
|
||||
$sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
|
||||
$sth->execute;
|
||||
my @itemtype;
|
||||
my %itemtypes;
|
||||
push @itemtype, "";
|
||||
$itemtypes{''} = "";
|
||||
while (my ($value,$lib) = $sth->fetchrow_array) {
|
||||
push @itemtype, $value;
|
||||
$itemtypes{$value}=$lib;
|
||||
}
|
||||
|
||||
my $CGIitemtype=CGI::scrolling_list( -name => 'value',
|
||||
-values => \@itemtype,
|
||||
-labels => \%itemtypes,
|
||||
-size => 1,
|
||||
-multiple => 0 );
|
||||
$sth->finish;
|
||||
|
||||
my @branches;
|
||||
my @select_branch;
|
||||
my %select_branches;
|
||||
my ($count2,@branches)=branches();
|
||||
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'};
|
||||
}
|
||||
my $CGIbranch=CGI::scrolling_list( -name => 'value',
|
||||
-values => \@select_branch,
|
||||
-labels => \%select_branches,
|
||||
-size => 1,
|
||||
-multiple => 0 );
|
||||
$sth->finish;
|
||||
|
||||
$template->param(classlist => $classlist,
|
||||
CGIitemtype => $CGIitemtype,
|
||||
CGIbranch => $CGIbranch,
|
||||
);
|
||||
}
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
Loading…
Reference in New Issue