From 6987fc32ef72a641d24922850e603b156ff06f64 Mon Sep 17 00:00:00 2001 From: Dan Pearl Date: Tue, 20 Oct 2015 17:05:07 -0400 Subject: [PATCH] LP#1312699 - Add feature to allow user to edit their checkout history. In the checkout history page, a new column and action selector is provided to allow the paton to indicate items they would just as soon not want to see again in the history list for whatever reason. NOTE: This is not a PURGE function; it simply suppresses display of items in the history list (and exported history files). Internally, the circulations are kept by Evergreen for several reasons which are not affected by this functionality. Signed-off-by: Dan Pearl Signed-off-by: Josh Stompro Signed-off-by: Jake Litrell Signed-off-by: Kathy Lussier --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 32 ++++++++++++++++++++++ .../src/templates/opac/myopac/circ_history.tt2 | 30 ++++++++++++++++++++ docs/RELEASE_NOTES_NEXT/OPAC/edit_circ_history | 10 +++++++ 3 files changed, 72 insertions(+) create mode 100644 docs/RELEASE_NOTES_NEXT/OPAC/edit_circ_history diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index ec0badac79..5ae325ce53 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1585,6 +1585,10 @@ sub load_myopac_circ_history { my $ctx = $self->ctx; my $limit = $self->cgi->param('limit') || 15; my $offset = $self->cgi->param('offset') || 0; + my $action = $self->cgi->param('action') || ''; + + my $circ_handle_result; + $circ_handle_result = $self->handle_circ_update($action) if $action; $ctx->{circ_history_limit} = $limit; $ctx->{circ_history_offset} = $offset; @@ -1647,6 +1651,34 @@ sub fetch_user_circ_history { return \@circs; } +sub handle_circ_update { + my $self = shift; + my $action = shift; + my $circ_ids = shift; + my $e = $self->editor; + my $url; + + my @circ_ids = ($circ_ids) ? @$circ_ids : $self->cgi->param('circ_id'); # for non-_all actions + + my $cstore_ses = OpenSRF::AppSession->create('open-ils.cstore'); + $cstore_ses->connect(); + $cstore_ses->request('open-ils.cstore.transaction.begin')->gather(1); + + if($action =~ /delete/) { + for my $circ_id (@circ_ids) { + my $circ = $cstore_ses->request( + 'open-ils.cstore.direct.action.circulation.retrieve', $circ_id)->gather(1); + $circ->hide_from_usr_history(1); + my $resp = $cstore_ses->request( + 'open-ils.cstore.direct.action.circulation.update', $circ)->gather(1); + } + } + + $cstore_ses->request('open-ils.cstore.transaction.commit')->gather(1); + $cstore_ses->disconnect(); + return undef; +} + # TODO: action.usr_visible_holds does not return cancelled holds. Should it? sub load_myopac_hold_history { my $self = shift; diff --git a/Open-ILS/src/templates/opac/myopac/circ_history.tt2 b/Open-ILS/src/templates/opac/myopac/circ_history.tt2 index 5339b25551..e686b8038f 100644 --- a/Open-ILS/src/templates/opac/myopac/circ_history.tt2 +++ b/Open-ILS/src/templates/opac/myopac/circ_history.tt2 @@ -58,11 +58,37 @@
[% l('There are no items in your circulation history.') %]
[% ELSE %] +
+ + + + + + +
+ + + +
+ @@ -136,6 +162,9 @@ FOR circ IN circ_items; %] + + [% END %] diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/edit_circ_history b/docs/RELEASE_NOTES_NEXT/OPAC/edit_circ_history new file mode 100644 index 0000000000..ea4c60cd93 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/OPAC/edit_circ_history @@ -0,0 +1,10 @@ +Editable Borrowing History +^^^^^^^^^^^^^^^^^^^^^^^^^^ +You can delete titles that you do not wish to appear in your Check Out History. + + * In "My Account", click on the "Items Checked Out" tab, then the "Check Out History" sub-tab. + * Check off the items you wish to conceal. + * Click the Go button next to the "Delete Selected Titles" drop-down box. + * Click OK in the pop-up to confirm your deletion. Choose carefully, as there is no "undo". + +Deleted titles will also not appear in the downloaded CSV file. -- 2.11.0
+ + [% sort_head("sort_title", l("Title")) %] [% sort_head("author", l("Author")) %] [% sort_head("checkout", l("Checkout Date")) %]
+ + [% circ.circ.target_copy.barcode | html %] [% circ.circ.target_copy.call_number.label | html %]