1 package OpenILS::Application::Storage::Publisher::actor;
2 use base qw/OpenILS::Application::Storage/;
3 use OpenILS::Application::Storage::CDBI::actor;
4 use OpenSRF::Utils::Logger qw/:level/;
5 use OpenILS::Utils::Fieldmapper;
7 my $log = 'OpenSRF::Utils::Logger';
16 ORDER BY CASE WHEN parent_ou IS NULL THEN 0 ELSE 1 END, name;
19 my $sth = actor::org_unit->db_Main->prepare_cached($select);
23 push @fms, $_->to_fieldmapper for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
27 __PACKAGE__->register_method(
28 api_name => 'open-ils.storage.direct.actor.org_unit.retrieve.all',
30 method => 'org_unit_list',
33 sub org_unit_type_list {
39 FROM actor.org_unit_type
43 my $sth = actor::org_unit_type->db_Main->prepare_cached($select);
47 push @fms, $_->to_fieldmapper for ( map { actor::org_unit_type->construct($_) } $sth->fetchall_hash );
51 __PACKAGE__->register_method(
52 api_name => 'open-ils.storage.direct.actor.org_unit_type.retrieve.all',
54 method => 'org_unit_type_list',
57 sub org_unit_descendants {
62 return undef unless ($id);
66 FROM connectby('actor.org_unit','id','parent_ou','name',?,'100','.')
67 as t(keyid text, parent_keyid text, level int, branch text,pos int),
73 my $sth = actor::org_unit->db_Main->prepare_cached($select);
77 push @fms, $_->to_fieldmapper for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
81 __PACKAGE__->register_method(
82 api_name => 'open-ils.storage.actor.org_unit.descendants',
84 method => 'org_unit_descendants',