$results = [map {[$_->{id}]} @$results];
}
- tag_circulated_records($search_hash->{authtoken}, $results, $IAmMetabib)
- if $search_hash->{tag_circulated_records} and $search_hash->{authtoken};
-
push @$new_ids, grep {defined($_)} map {$_->[0]} @$results;
$results = [grep {defined $_->[0]} @$results];
cache_staged_search_page($key, $page, $summary, $results) if $docache;
}
+ tag_circulated_records($search_hash->{authtoken}, $results, $IAmMetabib)
+ if $search_hash->{tag_circulated_records} and $search_hash->{authtoken};
+
$current_page_summary = $summary;
# add the new set of results to the set under construction
return 10; # default
}
+sub tag_circed_items {
+ my $self = shift;
+ my $e = $self->editor;
+
+ return 0 unless $e->requestor;
+ return 0 unless $self->ctx->{get_org_setting}->(
+ $e->requestor->home_ou,
+ 'opac.search.tag_circulated_items');
+
+ # user has to be opted-in to circ history in some capacity
+ my $sets = $e->search_actor_user_setting({
+ usr => $e->requestor->id,
+ name => [
+ 'history.circ.retention_age',
+ 'history.circ.retention_start'
+ ]
+ });
+
+ return 0 unless @$sets;
+ return 1;
+}
+
# context additions:
# page_size
# hit_count
my $offset = $page * $limit;
my $metarecord = $cgi->param('metarecord');
my $results;
+ my $tag_circs = $self->tag_circed_items;
$ctx->{page_size} = $limit;
$ctx->{search_page} = $page;
# the query string, not special args.
my $args = {'limit' => $limit, 'offset' => $offset};
+ if ($tag_circs) {
+ $args->{tag_circulated_records} = 1;
+ $args->{authtoken} = $self->editor->authtoken;
+ }
+
# Stuff these into the TT context so that templates can use them in redrawing forms
$ctx->{processed_search_query} = $query;
);
}
+ if ($tag_circs) {
+ for my $rec (@{$ctx->{records}}) {
+ my ($res_rec) = grep { $_->[0] == $rec->{id} } @{$results->{ids}};
+ # index 1 in the per-record result array is a boolean which
+ # indicates whether the record in question is in the users
+ # accessible circ history list
+ $rec->{user_circulated} = 1 if $res_rec->[1];
+ }
+ }
+
$ctx->{search_facets} = $facets;
return Apache2::Const::OK;
'coust', 'description'),
'bool', null)
+,( 'opac.search.tag_circulated_items', 'opac',
+ oils_i18n_gettext(
+ 'opac.search.tag_circulated_items',
+ 'Tag Circulated Items in Results',
+ 'coust', 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.search.tag_circulated_items',
+ 'When a user is both logged in and has opted in to circ history tracking, turning on this setting will cause previous (or currenlty) circulated items to be highlighted in search results',
+ 'coust', 'description'
+ ),
+ 'bool', null)
+
;
UPDATE config.org_unit_setting_type
--- /dev/null
+-- Evergreen DB patch XXXX.data.yaous-opac-tag-circed-items.sql
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'opac.search.tag_circulated_items',
+ 'opac',
+ oils_i18n_gettext(
+ 'opac.search.tag_circulated_items',
+ 'Tag Circulated Items in Results',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.search.tag_circulated_items',
+ 'When a user is both logged in and has opted in to circ history tracking, turning on this setting will cause previous (or currenlty) circulated items to be highlighted in search results',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+
+COMMIT;
src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' /></a><br />
[% END %]
</td>
- <td class='result_table_title_cell'
- name='result_table_title_cell'
- valign="top">
+ <td class='result_table_title_cell' name='result_table_title_cell' valign="top">
<div class="bold">
<a name='record_[% rec.id %]' name='item_title'
href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
[% END %] <!-- END detail_record_view -->
</table>
[% PROCESS "opac/parts/result/copy_counts.tt2" %]
+ [% IF rec.user_circulated %]
+ <div class="result_item_circulated">
+ <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
+ <span>[% l('I have checked this item out before') %]</span>
+ </div>
+ [% END %]
</div>
</td>
class='classic_link hide_me'
name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
</span>
-
</td>
<td nowrap='nowrap' width="1" align="right">
<div class="result_table_utils_cont">
#staff-saved-search { /* wraps .saved-searches-header and .saved-searches on the record page */
border-right: 1px solid #333;
}
+.result_item_circulated {
+ padding-top: 4px;
+}
+
+.result_item_circulated span {
+ position: relative;
+ top:-3px;
+ left:3px;
+}