]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
methods for circ and cat
[working/Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Storage / Publisher / asset.pm
1 package OpenILS::Application::Storage::Publisher::asset;
2 use base qw/OpenILS::Application::Storage/;
3 #use OpenILS::Application::Storage::CDBI::asset;
4 #use OpenSRF::Utils::Logger qw/:level/;
5 #use OpenILS::Utils::Fieldmapper;
6 #
7 #my $log = 'OpenSRF::Utils::Logger';
8
9 sub asset_copy_location_all {
10         my $self = shift;
11         my $client = shift;
12
13         for my $rec ( asset::copy_location->retrieve_all ) {
14                 $client->respond( $rec->to_fieldmapper );
15         }
16
17         return undef;
18 }
19 __PACKAGE__->register_method(
20         method          => 'asset_copy_location_all',
21         api_name        => 'open-ils.storage.direct.asset.copy_location.retrieve.all',
22         argc            => 0,
23         stream          => 1,
24 );
25
26 sub fleshed_copy {
27         my $self = shift;
28         my $client = shift;
29         my $id = ''.shift;
30
31         my $cp = asset::copy->retrieve($id);
32
33         my $cp_fm = $cp->to_fieldmapper;
34         $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
35         $cp_fm->location( $cp->location->to_fieldmapper );
36         $cp_fm->status( $cp->status->to_fieldmapper );
37         return $cp_fm;
38 }
39 __PACKAGE__->register_method(
40         api_name        => 'open-ils.storage.fleshed.asset.copy.retrieve',
41         method          => 'fleshed_copy',
42         argc            => 1,
43 );
44
45 sub fleshed_copy_by_barcode {
46         my $self = shift;
47         my $client = shift;
48         my $bc = ''.shift;
49
50         my ($cp) = asset::copy->search( { barcode => $bc } );
51
52         my $cp_fm = $cp->to_fieldmapper;
53         $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
54         $cp_fm->location( $cp->location->to_fieldmapper );
55         $cp_fm->status( $cp->status->to_fieldmapper );
56
57         return [ $cp_fm ];
58 }       
59 __PACKAGE__->register_method(
60         api_name        => 'open-ils.storage.fleshed.asset.copy.search.barcode',
61         method          => 'fleshed_copy_by_barcode',
62         argc            => 1,
63         stream          => 1,
64 );
65
66
67 1;