sub noncat_due_date {
my($e, $circ) = @_;
- my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type)
- or return $e->die_event;
+ my $otype = ref $circ->item_type ? $circ->item_type :
+ $e->retrieve_config_non_cataloged_type($circ->item_type);
my $tz = $U->ou_ancestor_setting_value(
$circ->circ_lib,
);
}
+__PACKAGE__->register_method(
+ method => 'fetch_open_noncats_batch',
+ stream => 1,
+ authoritative => 1,
+ api_name => 'open-ils.circ.open_non_cataloged_circulation.user.batch',
+ signature => {
+ desc => q/Returns a stream of open non-cat circulations for a given user/,
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'UserID', type => 'number'}
+ ],
+ return => {
+ desc => 'Stream of ancc objects, Event on error'
+ },
+ }
+);
+
+sub fetch_open_noncats_batch {
+ my ($self, $client, $auth, $user_id) = @_;
+
+ my $e = new_editor(authtoken => $auth);
+ return $e->event unless $e->checkauth;
+
+ if ($e->requestor->id ne $user_id) {
+ return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
+ }
+
+ my $ids = $U->simplereq(
+ 'open-ils.storage',
+ 'open-ils.storage.action.open_non_cataloged_circulation.user',
+ $user_id
+ );
+
+ for my $id (@$ids) {
+ my $circ = $e->retrieve_action_non_cataloged_circulation([
+ $id, {flesh => 1, flesh_fields => {ancc => ['item_type', 'staff']}}
+ ]);
+
+ noncat_due_date($e, $circ);
+ $client->respond($circ);
+ }
+
+ return undef;
+}
+
__PACKAGE__->register_method(
method => 'delete_noncat',