__PACKAGE__->register_method(
- method => "get_user_profiles",
- api_name => "open-ils.actor.user.profiles.retrieve",
-);
-
-my $user_profiles;
-sub get_user_profiles {
- return $user_profiles if $user_profiles;
-
- return $user_profiles =
- $apputils->simple_scalar_request(
- "open-ils.cstore",
- "open-ils.cstore.direct.actor.profile.search.atomic", { id => { "!=" => undef }});
-}
-
-
-
-__PACKAGE__->register_method(
method => "get_user_ident_types",
api_name => "open-ils.actor.user.ident_types.retrieve",
);
my $holds = $apputils->simple_scalar_request(
"open-ils.cstore",
"open-ils.cstore.direct.action.hold_request.search.atomic",
- { usr => $userid,
- fulfillment_time => {"=" => undef } }
+ {
+ usr => $userid,
+ fulfillment_time => {"=" => undef },
+ cancel_time => undef,
+ }
);
my @ready;
usr => $recipient->id,
hold_type => $t,
fulfillment_time => undef,
- target => $hold->target
+ target => $hold->target,
+ cancel_time => undef,
};
$sargs->{holdable_formats} = $hold->holdable_formats if $t eq 'M';
my $holds = $apputils->simplereq(
'open-ils.cstore',
"open-ils.cstore.direct.action.hold_request.search.atomic",
- { usr => $user_id , fulfillment_time => undef }, { order_by => { ahr => "request_time" } });
+ {
+ usr => $user_id ,
+ fulfillment_time => undef,
+ cancel_time => undef,
+ },
+ { order_by => { ahr => "request_time" } }
+ );
for my $hold ( @$holds ) {
$hold->transit(
my $holds = $apputils->simplereq(
'open-ils.cstore',
"open-ils.cstore.direct.action.hold_request.search.atomic",
- { pickup_lib => $ou_id , fulfillment_time => undef }, { order_by => { ahr => "request_time" } });
+ {
+ pickup_lib => $ou_id ,
+ fulfillment_time => undef,
+ cancel_time => undef
+ },
+ { order_by => { ahr => "request_time" } });
for my $hold ( @$holds ) {
$hold->transit(
return $e->event unless $e->allowed('CANCEL_HOLDS');
}
+ return 1 if $hold->cancel_time;
+
# If the hold is captured, reset the copy status
if( $hold->capture_time and $hold->current_copy ) {
}
}
- $e->delete_action_hold_request($hold)
+ $hold->cancel_time('now');
+ $e->update_action_hold_request($hold)
or return $e->event;
$e->commit;
}
-=head deprecated
-sub _find_local_hold_for_copy {
-
- my $session = shift;
- my $copy = shift;
- my $user = shift;
- my $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND');
-
- # first see if this copy has already been selected to fulfill a hold
- my $hold = $session->request(
- "open-ils.storage.direct.action.hold_request.search_where",
- { current_copy => $copy->id, capture_time => undef } )->gather(1);
-
- if($hold) {return $hold;}
-
- $logger->debug("searching for local hold at org " .
- $user->ws_ou . " and copy " . $copy->id);
-
- my $holdid = $session->request(
- "open-ils.storage.action.hold_request.nearest_hold",
- $user->ws_ou, $copy->id )->gather(1);
-
- return (undef, $evt) unless defined $holdid;
-
- $logger->debug("Found hold id $holdid while ".
- "searching nearest hold to " .$user->ws_ou);
-
- return $apputils->fetch_hold($holdid);
-}
-=cut
-
-
-
-
my $hold = $apputils->simplereq(
'open-ils.cstore',
'open-ils.cstore.direct.action.hold_request.search.atomic',
- { current_copy => $copyid , fulfillment_time => undef });
+ { current_copy => $copyid , cancel_time => undef, fulfillment_time => undef });
return $hold->[0] if ref($hold);
return undef;
}
return $apputils->simplereq(
'open-ils.cstore',
'open-ils.cstore.direct.action.hold_request.search.atomic',
- { current_copy => $copyid , fulfillment_time => undef });
+ { current_copy => $copyid , cancel_time => undef, fulfillment_time => undef });
}
return $U->storagereq(
'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib.atomic',
- $org, $limit, $offset ); # XXX change to workstation
+ $org, $limit, $offset );
}
__PACKAGE__->register_method (
# XXX make me return IDs in the future ^--
return $e->search_action_hold_request(
- { target => $id, hold_type => $type, fulfillment_time => undef });
+ { target => $id, cancel_time => undef, hold_type => $type, fulfillment_time => undef });
}
capture_time => { "!=" => undef },
current_copy => { "!=" => undef },
fulfillment_time => undef,
- pickup_lib => $org
+ pickup_lib => $org,
+ cancel_time => undef,
}
);
# first see if this copy has already been selected to fulfill a hold
my $hold = $session->request(
"open-ils.storage.direct.action.hold_request.search_where",
- { current_copy => $copy->id, capture_time => undef } )->gather(1);
+ { current_copy => $copy->id, cancel_time => undef, capture_time => undef } )->gather(1);
if( $hold ) {
$logger->info("hold found which can be fulfilled by copy ".$copy->id);