1 # ---------------------------------------------------------------
2 # Copyright (C) 2006 Georgia Public Library Service
3 # Bill Erickson <billserickson@gmail.com>
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 # ---------------------------------------------------------------
16 package OpenILS::Application::Circ::StatCat;
17 use base qw/OpenILS::Application/;
18 use strict; use warnings;
20 use OpenSRF::Utils::Logger qw($logger);
21 use OpenSRF::EX qw/:try/;
22 use OpenILS::Application::AppUtils;
23 my $apputils = "OpenILS::Application::AppUtils";
28 __PACKAGE__->register_method(
29 method => "retrieve_stat_cat_list",
31 api_name => "open-ils.circ.stat_cat.actor.retrieve.batch");
33 __PACKAGE__->register_method(
34 method => "retrieve_stat_cat_list",
36 api_name => "open-ils.circ.stat_cat.asset.retrieve.batch");
38 # retrieves all of the stat cats for a given org unit
39 # if no orgid, user_session->home_ou is used
41 sub retrieve_stat_cat_list {
42 my( $self, $client, $user_session, @sc ) = @_;
48 my $method = "open-ils.storage.fleshed.actor.stat_cat.retrieve.batch.atomic";
49 if( $self->api_name =~ /asset/ ) {
50 $method = "open-ils.storage.fleshed.asset.stat_cat.retrieve.batch.atomic";
53 my($user_obj, $evt) = $apputils->checkses($user_session);
56 my $cats = $apputils->simple_scalar_request(
57 "open-ils.storage", $method, @sc);
59 return [ sort { $a->name cmp $b->name } @$cats ];
62 __PACKAGE__->register_method(
63 method => "retrieve_stat_cats",
64 api_name => "open-ils.circ.stat_cat.actor.retrieve.all");
66 __PACKAGE__->register_method(
67 method => "retrieve_stat_cats",
68 api_name => "open-ils.circ.stat_cat.asset.retrieve.all");
70 # retrieves all of the stat cats for a given org unit
71 # if no orgid, user_session->home_ou is used
73 sub retrieve_stat_cats {
74 my( $self, $client, $user_session, $orgid ) = @_;
76 my $method = "open-ils.storage.ranged.fleshed.actor.stat_cat.all.atomic";
77 if( $self->api_name =~ /asset/ ) {
78 $method = "open-ils.storage.ranged.fleshed.asset.stat_cat.all.atomic";
81 my($user_obj, $evt) = $apputils->checkses($user_session);
84 if(!$orgid) { $orgid = $user_obj->home_ou; }
85 my $cats = $apputils->simple_scalar_request(
86 "open-ils.storage", $method, $orgid );
88 return [ sort { $a->name cmp $b->name } @$cats ];
92 __PACKAGE__->register_method(
93 method => "retrieve_ranged_intersect_stat_cats",
94 api_name => "open-ils.circ.stat_cat.asset.multirange.intersect.retrieve");
96 sub retrieve_ranged_intersect_stat_cats {
97 my( $self, $client, $user_session, $orglist ) = @_;
99 my($user_obj, $evt) = $apputils->checkses($user_session);
102 if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
105 my %hash = map { ($_ => 1) } @$orglist;
106 $orglist = [ keys %hash ];
108 warn "range: @$orglist\n";
110 my $method = "open-ils.storage.multiranged.intersect.fleshed.asset.stat_cat.all.atomic";
111 return $apputils->simple_scalar_request(
112 "open-ils.storage", $method, $orglist );
116 __PACKAGE__->register_method(
117 method => "retrieve_ranged_union_stat_cats",
118 api_name => "open-ils.circ.stat_cat.asset.multirange.union.retrieve");
120 sub retrieve_ranged_union_stat_cats {
121 my( $self, $client, $user_session, $orglist ) = @_;
123 my $method = "open-ils.storage.multiranged.union.fleshed.asset.stat_cat.all.atomic";
125 warn "Retrieving stat_cats with method $method and orgs " . Dumper($orglist) . "\n";
127 my($user_obj, $evt) = $apputils->checkses($user_session);
130 if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
133 my %hash = map { ($_ => 1) } @$orglist;
134 $orglist = [ keys %hash ];
136 warn "range: @$orglist\n";
138 return $apputils->simple_scalar_request(
139 "open-ils.storage", $method, $orglist );
144 __PACKAGE__->register_method(
145 method => "stat_cat_create",
146 api_name => "open-ils.circ.stat_cat.asset.create");
148 __PACKAGE__->register_method(
149 method => "stat_cat_create",
150 api_name => "open-ils.circ.stat_cat.actor.create");
152 sub stat_cat_create {
153 my( $self, $client, $user_session, $stat_cat ) = @_;
155 my $method = "open-ils.storage.direct.actor.stat_cat.create";
156 my $entry_create = "open-ils.storage.direct.actor.stat_cat_entry.create";
157 my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
158 my $perm = 'CREATE_PATRON_STAT_CAT';
159 my $eperm = 'CREATE_PATRON_STAT_CAT_ENTRY';
160 my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
162 if($self->api_name =~ /asset/) {
163 $method = "open-ils.storage.direct.asset.stat_cat.create";
164 $entry_create = "open-ils.storage.direct.asset.stat_cat_entry.create";
165 $perm = 'CREATE_COPY_STAT_CAT_ENTRY';
168 #my $user_obj = $apputils->check_user_session($user_session);
169 #my $orgid = $user_obj->home_ou();
170 my( $user_obj, $evt ) = $apputils->checkses($user_session);
172 $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $perm);
175 if($stat_cat->entries) {
176 $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $eperm);
181 my $session = $apputils->start_db_session();
182 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
183 my $newid = _create_stat_cat($session, $stat_cat, $method);
185 if( ref($stat_cat->entries) ) {
186 for my $entry (@{$stat_cat->entries}) {
187 $entry->stat_cat($newid);
188 my $entry_id = _create_stat_entry($session, $entry, $entry_create);
189 if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
190 $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $edperm);
193 for my $default_entry (@{$entry->default_entries}) {
194 $default_entry->stat_cat_entry($entry_id);
195 _create_stat_entry_default($session, $default_entry, $default_entry_create);
201 $apputils->commit_db_session($session);
203 $logger->debug("Stat cat creation successful with id $newid");
205 my $orgid = $user_obj->home_ou;
206 if( $self->api_name =~ /asset/ ) {
207 return _flesh_asset_cat($newid, $orgid);
209 return _flesh_user_cat($newid, $orgid);
214 sub _flesh_user_cat {
218 my $session = OpenSRF::AppSession->create("open-ils.storage");
219 my $cat = $session->request(
220 "open-ils.storage.direct.actor.stat_cat.retrieve",
225 "open-ils.storage.ranged.actor.stat_cat_entry.search.stat_cat.atomic",
226 $orgid, $id )->gather(1) );
232 sub _flesh_asset_cat {
236 my $session = OpenSRF::AppSession->create("open-ils.storage");
237 my $cat = $session->request(
238 "open-ils.storage.direct.asset.stat_cat.retrieve",
243 "open-ils.storage.ranged.asset.stat_cat_entry.search.stat_cat.atomic",
244 $orgid, $id )->gather(1) );
251 sub _create_stat_cat {
252 my( $session, $stat_cat, $method) = @_;
253 warn "Creating new stat cat with name " . $stat_cat->name . "\n";
254 $stat_cat->clear_id();
255 my $req = $session->request( $method, $stat_cat );
256 my $id = $req->gather(1);
258 throw OpenSRF::EX::ERROR
259 ("Error creating new statistical category"); }
261 warn "Stat cat create returned id $id\n";
266 sub _create_stat_entry {
267 my( $session, $stat_entry, $method) = @_;
269 warn "Creating new stat entry with value " . $stat_entry->value . "\n";
270 $stat_entry->clear_id();
272 my $req = $session->request($method, $stat_entry);
273 my $id = $req->gather(1);
275 warn "Stat entry " . Dumper($stat_entry) . "\n";
278 throw OpenSRF::EX::ERROR
279 ("Error creating new stat cat entry"); }
281 warn "Stat cat entry create returned id $id\n";
286 __PACKAGE__->register_method(
287 method => "update_stat_entry",
288 api_name => "open-ils.circ.stat_cat.actor.entry.update");
290 __PACKAGE__->register_method(
291 method => "update_stat_entry",
292 api_name => "open-ils.circ.stat_cat.asset.entry.update");
294 sub update_stat_entry {
295 my( $self, $client, $user_session, $entry ) = @_;
298 my $method = "open-ils.storage.direct.actor.stat_cat_entry.update";
299 my $perm = 'UPDATE_PATRON_STAT_CAT_ENTRY';
300 if($self->api_name =~ /asset/) {
301 $method = "open-ils.storage.direct.asset.stat_cat_entry.update";
302 $perm = 'UPDATE_COPY_STAT_CAT_ENTRY';
305 my( $user_obj, $evt ) = $apputils->checkses($user_session);
307 $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
310 my $session = $apputils->start_db_session();
311 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
312 my $req = $session->request($method, $entry);
313 my $status = $req->gather(1);
314 $apputils->commit_db_session($session);
315 warn "stat cat entry with value " . $entry->value . " updated with status $status\n";
319 sub _update_stat_entry_default {
320 my( $session, $default_entry, $method) = @_;
322 warn "Updating new default stat entry for stat_cat " . $default_entry->stat_cat .
323 " for org unit " . $default_entry->owner .
324 " with new entry id " . $default_entry->stat_cat_entry . "\n";
326 my $req = $session->request($method, $default_entry);
327 my $status = $req->gather(1);
329 warn "Default stat entry " . Dumper($default_entry) . "\n";
332 throw OpenSRF::EX::ERROR
333 ("Error updating default stat cat entry"); }
335 warn "Default stat cat entry update returned status $status\n";
339 __PACKAGE__->register_method(
340 method => "update_stat",
341 api_name => "open-ils.circ.stat_cat.actor.update");
343 __PACKAGE__->register_method(
344 method => "update_stat",
345 api_name => "open-ils.circ.stat_cat.asset.update");
348 my( $self, $client, $user_session, $cat ) = @_;
350 my $method = "open-ils.storage.direct.actor.stat_cat.update";
351 my $perm = 'UPDATE_PATRON_STAT_CAT';
352 if($self->api_name =~ /asset/) {
353 $method = "open-ils.storage.direct.asset.stat_cat.update";
354 $perm = 'UPDATE_COPY_STAT_CAT';
357 my( $user_obj, $evt ) = $apputils->checkses($user_session);
359 $evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
362 my $session = $apputils->start_db_session();
363 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
364 my $req = $session->request($method, $cat);
365 my $status = $req->gather(1);
366 $apputils->commit_db_session($session);
367 warn "stat cat with id " . $cat->id . " updated with status $status\n";
372 __PACKAGE__->register_method(
373 method => "create_stat_entry",
374 api_name => "open-ils.circ.stat_cat.actor.entry.create");
376 __PACKAGE__->register_method(
377 method => "create_stat_entry",
378 api_name => "open-ils.circ.stat_cat.asset.entry.create");
380 sub create_stat_entry {
381 my( $self, $client, $user_session, $entry ) = @_;
383 my $method = "open-ils.storage.direct.actor.stat_cat_entry.create";
384 my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
385 my $default_entry_update = "open-ils.storage.direct.actor.stat_cat_entry_default.update";
386 my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY';
387 my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
388 my $edperm_update = 'UPDATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
390 if($self->api_name =~ /asset/) {
391 $method = "open-ils.storage.direct.asset.stat_cat_entry.create";
392 $perm = 'CREATE_COPY_STAT_CAT_ENTRY';
396 my( $user_obj, $evt ) = $apputils->checkses($user_session);
398 $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
401 my $session = $apputils->start_db_session();
402 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
403 my $newid = _create_stat_entry($session, $entry, $method);
405 if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
406 $evt = $apputils->check_perms($user_obj->id, $entry->owner, $edperm);
409 for my $default_entry (@{$entry->default_entries}) {
410 $default_entry->stat_cat_entry($newid);
412 ($target, $evt) = $apputils->fetch_stat_cat_entry_default_by_stat_cat_and_org($type,
413 $default_entry->stat_cat,
414 $default_entry->owner);
416 $evt = $apputils->check_perms($user_obj->id, $default_entry->owner, $edperm_update);
418 $target->stat_cat_entry($newid);
419 _update_stat_entry_default($session, $target, $default_entry_update);
421 _create_stat_entry_default($session, $default_entry, $default_entry_create);
426 $apputils->commit_db_session($session);
428 $logger->info("created stat cat entry $newid");
433 __PACKAGE__->register_method(
434 method => "create_stat_entry_default",
435 api_name => "open-ils.circ.stat_cat.actor.entry.default.create");
438 sub create_stat_entry_default {
439 my( $self, $client, $user_session, $default_entry ) = @_;
441 my $create_method = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
442 my $update_method = "open-ils.storage.direct.actor.stat_cat_entry_default.update";
443 my $create_perm = 'UPDATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
444 my $update_perm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
448 my( $user_obj, $evt ) = $apputils->checkses($user_session);
451 my $session = $apputils->start_db_session();
453 ($target, $evt) = $apputils->fetch_stat_cat_entry_default_by_stat_cat_and_org(
455 $default_entry->stat_cat,
456 $default_entry->owner);
458 $evt = $apputils->check_perms($user_obj->id, $default_entry->owner, $update_perm);
461 $default_entry->id($id);
462 _update_stat_entry_default($session, $default_entry, $update_method);
463 $logger->info("updated stat cat default entry $id");
465 $evt = $apputils->check_perms($user_obj->id, $default_entry->owner, $create_perm);
467 $id = _create_stat_entry_default($session, $default_entry, $create_method);
468 $logger->info("created stat cat default entry $id");
471 $apputils->commit_db_session($session);
476 sub _create_stat_entry_default {
477 my( $session, $stat_entry_default, $method) = @_;
479 warn "Creating new default stat entry for stat_cat " . $stat_entry_default->stat_cat . "\n";
480 $stat_entry_default->clear_id();
482 my $req = $session->request($method, $stat_entry_default);
483 my $id = $req->gather(1);
485 warn "Default stat entry " . Dumper($stat_entry_default) . "\n";
488 throw OpenSRF::EX::ERROR
489 ("Error creating new default stat cat entry"); }
491 warn "Default stat cat entry create returned id $id\n";
495 __PACKAGE__->register_method(
496 method => "create_stat_map",
497 api_name => "open-ils.circ.stat_cat.actor.user_map.create");
499 __PACKAGE__->register_method(
500 method => "create_stat_map",
501 api_name => "open-ils.circ.stat_cat.asset.copy_map.create");
503 sub create_stat_map {
504 my( $self, $client, $user_session, $map ) = @_;
507 my ( $evt, $copy, $volume, $patron, $user_obj );
509 my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
510 my $ret = "open-ils.storage.direct.actor.stat_cat_entry_user_map.retrieve";
511 my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY_MAP';
514 if($self->api_name =~ /asset/) {
515 $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.create";
516 $ret = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.retrieve";
517 $perm = 'CREATE_COPY_STAT_CAT_ENTRY_MAP';
518 ( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
520 ( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
522 $perm_org = $volume->owning_lib;
525 ($patron, $evt) = $apputils->fetch_user($map->target_usr);
527 $perm_org = $patron->home_ou;
530 ( $user_obj, $evt ) = $apputils->checkses($user_session);
532 $evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
535 $logger->debug( $user_obj->id . " creating new stat cat map" );
539 my $session = $apputils->start_db_session();
540 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
541 my $req = $session->request($method, $map);
542 my $newid = $req->gather(1);
543 warn "Created new stat cat map with id $newid\n";
544 $apputils->commit_db_session($session);
546 return $apputils->simple_scalar_request( "open-ils.storage", $ret, $newid );
551 __PACKAGE__->register_method(
552 method => "update_stat_map",
553 api_name => "open-ils.circ.stat_cat.actor.user_map.update");
555 __PACKAGE__->register_method(
556 method => "update_stat_map",
557 api_name => "open-ils.circ.stat_cat.asset.copy_map.update");
559 sub update_stat_map {
560 my( $self, $client, $user_session, $map ) = @_;
562 my ( $evt, $copy, $volume, $patron, $user_obj );
564 my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
565 my $perm = 'UPDATE_PATRON_STAT_ENTRY_MAP';
568 if($self->api_name =~ /asset/) {
569 $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.update";
570 $perm = 'UPDATE_COPY_STAT_ENTRY_MAP';
571 ( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
573 ( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
575 $perm_org = $volume->owning_lib;
578 ($patron, $evt) = $apputils->fetch_user($map->target_usr);
580 $perm_org = $patron->home_ou;
584 ( $user_obj, $evt ) = $apputils->checkses($user_session);
586 $evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
590 my $session = $apputils->start_db_session();
591 $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
592 my $req = $session->request($method, $map);
593 my $newid = $req->gather(1);
594 warn "Updated new stat cat map with id $newid\n";
595 $apputils->commit_db_session($session);
602 __PACKAGE__->register_method(
603 method => "retrieve_maps",
604 api_name => "open-ils.circ.stat_cat.actor.user_map.retrieve");
606 __PACKAGE__->register_method(
607 method => "retrieve_maps",
608 api_name => "open-ils.circ.stat_cat.asset.copy_map.retrieve");
611 my( $self, $client, $user_session, $target ) = @_;
614 my( $user_obj, $evt ) = $apputils->checkses($user_session);
617 my $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy.atomic";
618 if($self->api_name =~ /actor/ ) {
619 if(!$target) { $target = $user_obj->id; }
620 $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr.atomic";
623 return $apputils->simple_scalar_request("open-ils.storage", $method, $target);
629 __PACKAGE__->register_method(
630 method => "delete_stats",
631 api_name => "open-ils.circ.stat_cat.actor.delete");
633 __PACKAGE__->register_method(
634 method => "delete_stats",
635 api_name => "open-ils.circ.stat_cat.asset.delete");
638 my( $self, $client, $user_session, $target ) = @_;
643 my $perm = 'DELETE_PATRON_STAT_CAT';
644 if($self->api_name =~ /asset/) {
646 $perm = 'DELETE_COPY_STAT_CAT';
649 my( $user_obj, $evt ) = $apputils->checkses($user_session);
652 ( $cat, $evt ) = $apputils->fetch_stat_cat( $type, $target );
655 $evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
658 my $session = OpenSRF::AppSession->create("open-ils.storage");
659 return _delete_stats($session, $target, $type);
663 my( $session, $stat, $type) = @_;
665 my $method = "open-ils.storage.direct.asset.stat_cat.delete";
666 if($type =~ /actor/ ) {
667 $method = "open-ils.storage.direct.actor.stat_cat.delete";
669 return $session->request($method, $stat)->gather(1);
674 __PACKAGE__->register_method(
675 method => "delete_entry",
676 api_name => "open-ils.circ.stat_cat.actor.entry.delete");
678 __PACKAGE__->register_method(
679 method => "delete_entry",
680 api_name => "open-ils.circ.stat_cat.asset.entry.delete");
683 my( $self, $client, $user_session, $target ) = @_;
686 my $perm = 'DELETE_PATRON_STAT_CAT_ENTRY';
687 if($self->api_name =~ /asset/) {
689 $perm = 'DELETE_COPY_STAT_CAT_ENTRY';
693 my( $user_obj, $evt ) = $apputils->checkses($user_session);
696 ( $entry, $evt ) = $apputils->fetch_stat_cat_entry( $type, $target );
699 $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
702 my $session = OpenSRF::AppSession->create("open-ils.storage");
703 return _delete_entry($session, $target, $type);
707 my( $session, $stat_entry, $type) = @_;
709 my $method = "open-ils.storage.direct.asset.stat_cat_entry.delete";
710 if($type =~ /actor/ ) {
711 $method = "open-ils.storage.direct.actor.stat_cat_entry.delete";
714 return $session->request($method, $stat_entry)->gather(1);
718 __PACKAGE__->register_method(
719 method => "delete_entry_default",
720 api_name => "open-ils.circ.stat_cat.actor.entry.default.delete");
722 sub delete_entry_default {
723 my( $self, $client, $user_session, $target ) = @_;
726 my $perm = 'DELETE_PATRON_STAT_CAT_ENTRY_DEFAULT';
729 my( $user_obj, $evt ) = $apputils->checkses($user_session);
732 ( $default_entry, $evt ) = $apputils->fetch_stat_cat_entry_default( $type, $target );
735 $evt = $apputils->check_perms( $user_obj->id, $default_entry->owner, $perm );
738 my $session = OpenSRF::AppSession->create("open-ils.storage");
739 return _delete_entry_default($session, $target, $type);
742 sub _delete_entry_default {
743 my( $session, $stat_entry, $type) = @_;
745 my $method = "open-ils.storage.direct.actor.stat_cat_entry_default.delete";
746 if($type =~ /asset/ ) {
747 $method = "open-ils.storage.direct.asset.stat_cat_entry_default.delete";
750 return $session->request($method, $stat_entry)->gather(1);
753 __PACKAGE__->register_method(
754 method => 'fetch_stats_by_copy',
755 api_name => 'open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy',
759 sub fetch_stats_by_copy {
760 my( $self, $conn, $args ) = @_;
764 if( $$args{public} ) {
765 my $maps = $U->cstorereq(
766 'open-ils.cstore.direct.asset.stat_cat_entry_copy_map.search.atomic', { owning_copy => $$args{copyid} });
770 for my $map (@$maps) {
772 warn "map ".$map->id."\n";
773 warn "map ".$map->stat_cat_entry."\n";
775 my $entry = $U->cstorereq(
776 'open-ils.cstore.direct.asset.stat_cat_entry.retrieve', $map->stat_cat_entry);
778 warn "Found entry ".$entry->id."\n";
780 my $cat = $U->cstorereq(
781 'open-ils.cstore.direct.asset.stat_cat.retrieve', $entry->stat_cat );
782 $entry->stat_cat( $cat );
783 push( @entries, $entry );
790 __PACKAGE__->register_method(
791 method => 'retrieve_entry_default',
792 api_name => "open-ils.circ.stat_cat.actor.entry_default.ancestor_default",
795 sub retrieve_entry_default {
796 my( $self, $client, $user_session, $orgid, $stat_cat ) = @_;
798 my $method = "open-ils.storage.actor.stat_cat_entry_default.ancestor.retrieve.atomic";
800 return $apputils->simple_scalar_request( "open-ils.storage", $method, $orgid, $stat_cat);