From 40cd0883f2a7c31d9dd55f5dd188c52a85e6267a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 29 Nov 2011 16:54:52 -0500 Subject: [PATCH] TPac; indicate search results previously checked out When a user is logged in to the tpac and performs a search, indicate in the results set when any of the result items were ever checked out by the logged in user. TODO: UI description Only items that are within the user's visible circulation history will be tagged. These include items currently checked out for all users. TODO: org setting info Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/Application/Search/Biblio.pm | 6 +++--- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 17 +++++++++++++++++ Open-ILS/src/templates/opac/parts/result/table.tt2 | 11 +++++++---- Open-ILS/web/css/skin/default/opac/style.css | 3 +++ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index dc45d3b43a..eb166a6318 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1292,14 +1292,14 @@ sub staged_search { $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 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 93f90b68a6..bb9d6bac40 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -174,6 +174,8 @@ sub load_rresults { my $offset = $page * $limit; my $metarecord = $cgi->param('metarecord'); my $results; + my $tag_circs = 0; + $tag_circs = 1 if $e->requestor; # TODO: org setting $ctx->{page_size} = $limit; $ctx->{search_page} = $page; @@ -226,6 +228,11 @@ sub load_rresults { # 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; @@ -276,6 +283,16 @@ sub load_rresults { ); } + 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; diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 422a378a52..0858a3dc58 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -50,9 +50,7 @@ src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' />
[% END %] - +
@@ -202,7 +206,6 @@ class='classic_link hide_me' name="googleBooks-link">[% l("Browse in Google Books Search") %] -
diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index e81b9d6900..15c3baf7cb 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -1175,3 +1175,6 @@ table.bookbag-specific { #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; +} -- 2.11.0