From a1120eaed85ed29f055cd4612a3bd47166e7076a Mon Sep 17 00:00:00 2001 From: Jake Litrell Date: Tue, 1 Mar 2016 17:22:28 -0500 Subject: [PATCH] LP#1312699: Minor modifications to patron checkout history deletions Minor modifications to make patron checkout history deletions work with the new table. open-ils.actor.history.circ.clear extended to take an optional list of circ_ids, to limit what's deleted from the history. Signed-off-by: Jake Litrell Signed-off-by: Kathy Lussier --- .../src/perlmods/lib/OpenILS/Application/Actor.pm | 7 ++++- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 34 +++++++++------------- .../src/templates/opac/myopac/circ_history.tt2 | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 2bb874b473..873ad3ba65 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -4217,6 +4217,7 @@ __PACKAGE__->register_method( desc => 'Delete all user circ history entries for the calling user', params => [ { desc => 'Authentication token', type => 'string'}, + { desc => "Options hash. 'circ_ids' is an arrayref of circulation IDs to delete", type => 'object' }, ], return => { desc => q/1 on success, event on error/, @@ -4278,8 +4279,12 @@ sub user_circ_history { $limits{limit} = $options->{limit} if defined $options->{limit}; } + my $circ_id_list = $options->{circ_ids} ? $options->{circ_ids} : undef; + my $circs = $e->search_action_user_circ_history([ - {usr => $e->requestor->id}, + { usr => $e->requestor->id, + id => {'in' => $circ_id_list}, + }, { # order newest to oldest by default order_by => {auch => 'xact_start DESC'}, %limits 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 9de2eec352..945c9f228e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1544,7 +1544,6 @@ sub handle_circ_renew { return @responses; } - sub load_myopac_circs { my $self = shift; my $e = $self->editor; @@ -1652,31 +1651,26 @@ sub fetch_user_circ_history { } sub handle_circ_update { - my $self = shift; - my $action = shift; + 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 $circ_ids //= [$self->cgi->param('circ_id')]; - 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/) { + my $options = { + circ_ids => $circ_ids, + }; - 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); - } + $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.history.circ.clear', + $self->editor->authtoken, + $options + ); } - $cstore_ses->request('open-ils.cstore.transaction.commit')->gather(1); - $cstore_ses->disconnect(); - return undef; + return; } # TODO: action.usr_visible_holds does not return cancelled holds. Should it? diff --git a/Open-ILS/src/templates/opac/myopac/circ_history.tt2 b/Open-ILS/src/templates/opac/myopac/circ_history.tt2 index abe007d6d4..675dff91c6 100644 --- a/Open-ILS/src/templates/opac/myopac/circ_history.tt2 +++ b/Open-ILS/src/templates/opac/myopac/circ_history.tt2 @@ -193,12 +193,12 @@ [% circ.circ.target_copy.barcode | html %] [% circ.circ.target_copy.call_number.label | html %] - [% END %] + [% END %] [% END %] -- 2.11.0