my $ctx = $self->ctx;
my $e = $self->editor;
+ # find the last record in the set, then redirect
+ my $find_last = $cgi->param('find_last');
+
$self->timelog("Loading results");
# load bookbag metadata, if requested.
if (my $bbag_err = $self->load_rresults_bookbag) {
$self->get_staff_search_settings;
- if ($ctx->{staff_saved_search_size}) {
+ if (!$find_last and $ctx->{staff_saved_search_size}) {
my ($key, $list) = $self->staff_save_search($query);
if ($key) {
$self->apache->headers_out->add(
$ctx->{hit_count} = $results->{count};
$ctx->{parsed_query} = $results->{parsed_query};
+ if ($find_last) {
+ # redirect to the record detail page for the last record in the results
+ my $rec_id = pop @$rec_ids;
+ $cgi->delete('find_last');
+ my $url = $cgi->url(-full => 1, -path => 1, -query => 1);
+ $url =~ s|/results|/record/$rec_id|;
+ return $self->generic_redirect($url);
+ }
+
return Apache2::Const::OK if @$rec_ids == 0 or $internal;
$self->load_rresults_bookbag_item_notes($rec_ids) if $ctx->{bookbag};
"[% ctx.prev_rec_url || '' %]",
"[% ctx.next_rec_url || '' %]",
"[% mkurl(ctx.first_search_record, {page => 0}) %]",
- "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
+ "[% mkurl(ctx.opac_root _ '/results', {find_last => 1, page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
"[% mkurl(ctx.opac_root _ '/results', {}, ['expand','cnoffset']) %]"
);
</script>