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/,
$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
return @responses;
}
-
sub load_myopac_circs {
my $self = shift;
my $e = $self->editor;
}
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?