my $e = $self->editor;
$ctx->{page} = 'rresult';
+
+ return $self->item_barcode_shortcut if $cgi->param("qtype") eq "item_barcode";
+
my $page = $cgi->param('page') || 0;
my $facet = $cgi->param('facet');
my $limit = $self->_get_search_limit;
return Apache2::Const::OK;
}
+# Searching by barcode is a special search that does /not/ respect any other
+# of the usual search parameters, not even the ones for sorting and paging!
+sub item_barcode_shortcut {
+ my ($self) = @_;
+
+ my $method = "open-ils.search.multi_home.bib_ids.by_barcode";
+ if (my $search = create OpenSRF::AppSession("open-ils.search")) {
+ my $rec_ids = $search->request(
+ $method, $self->cgi->param("query")
+ )->gather(1);
+
+ if (ref $rec_ids ne 'ARRAY') {
+ if (defined $U->event_code($rec_ids)) {
+ $self->apache->log->warn(
+ "$method returned event: " . $U->event_code($rec_ids)
+ );
+ } else {
+ $self->apache->log->warn(
+ "$method returned something unexpected: $rec_ids"
+ );
+ }
+ return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ my ($facets, @data) = $self->get_records_and_facets(
+ $rec_ids, undef, {flesh => "{holdings_xml,mra}"}
+ );
+
+ $self->ctx->{records} = [@data];
+ $self->ctx->{search_facets} = {};
+ $self->ctx->{hit_count} = scalar @data;
+ $self->ctx->{page_size} = $self->ctx->{hit_count};
+
+ return Apache2::Const::OK;
+ } {
+ $self->apache->log->warn("couldn't connect to open-ils.search");
+ return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
+}
1;
<form id="adv_search_form" action="[% ctx.opac_root %]/results" method="GET">
<div class="header_middle">[% l("Numeric Search") %]</div>
<input type="hidden" name="contains" value="contains" />
+ <input type="hidden" name="_special" value="1" />
<table>
<tr>
<td>
<option value="identifier|bib_cn">[% l('Call Number') %]</option>
<option value="identifier|lccn">[% l('LCCN') %]</option>
<option value="identifier|tcn">[% l('TCN') %]</option>
- <option disabled="disabled" value="item_barcode">[% l('Item Barcode') %]</option>[%# XXX have to implement special logic for this later %]
+ <option value="item_barcode">[% l('Item Barcode') %]</option>
</select>
</td>
<td>
propagator = '?' _ query_string;
is_advanced = CGI.param("_adv").size;
+ is_special = CGI.param("_special").size;
%]
</td>
</tr>
<tr>
- [% IF is_advanced %]
+ [% IF is_advanced || is_special %]
<td colspan="2">
<input type="hidden" name="_adv" value="1" />
[% ELSE %]
[% INCLUDE "default/opac/parts/qtype_selector.tt2" %]
</td>
[% END %]
- [% IF ctx.processed_search_query OR NOT is_advanced %]
+ [% IF ctx.processed_search_query OR (NOT is_advanced AND NOT is_special) %]
<td>
<div id="search_box_wrapper">
<!-- Note: when common browsers support HTML5 placeholder text, we can remove the JS -->
</td>
[% END %]
</tr>
- [% UNLESS is_advanced %]
+ [% UNLESS is_advanced OR is_special %]
<tr>
<td>
[% INCLUDE "default/opac/parts/coded_value_selector.tt2" attr=["mattype", "item_type"] none_ok=1 %]
[% END %]
</table>
[% UNLESS took_care_of_form %]</form>[% END %]
- [% IF is_advanced AND CGI.param('qtype') %]
+ [% IF (is_advanced AND NOT is_special) AND CGI.param('qtype') %]
<div class="opac-auto-102">
[ <a href="[% ctx.opac_root %]/advanced?[% query_string %]">[%
l('Click to Refine Your Original Search')
WRAPPER "default/opac/parts/base.tt2";
INCLUDE "default/opac/parts/topnav.tt2";
- IF is_advanced;
+ IF is_advanced || is_special;
ctx.page_title = l("Search Results");
ELSE;
ctx.page_title = l("Search Results: ") _ CGI.param('query') | html_entity;
</div>
[% END %]
<div class="results_header_div"></div>
- [% UNLESS is_advanced %]
+ [% UNLESS is_advanced || is_special %]
<div class="results_header_lbl">Sort by</div>
[% INCLUDE "default/opac/parts/filtersort.tt2" value=CGI.param('sort') %]
<div class="results_header_div"></div>