source: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Service.pm @ 1314

Last change on this file since 1314 was 1303, checked in by nanardon, 9 years ago

add Services object (step to Itil)

File size: 1.9 KB
Line 
1package LATMOS::Accounts::Bases::Sql::Service;
2
3use 5.010000;
4use strict;
5use warnings;
6
7use base qw(LATMOS::Accounts::Bases::Sql::objects);
8
9our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];
10
11=head1 NAME
12
13LATMOS::Accounts::Bases::Sql::Site - Common Location/Address object
14
15=head1 DESCRIPTION
16
17Store common to many people office address (typically building location).
18
19=cut
20
21sub _object_table { 'service' }
22
23sub _key_field { 'name' }
24
25sub _has_extended_attributes { 1 }
26
27sub _get_attr_schema {
28    my ($class, $base) = @_;
29
30    $class->SUPER::_get_attr_schema($base,
31        {
32            name   => { ro => 1, inline => 1, },
33            date   => { ro => 1, inline => 1, },
34            create => { ro => 1, inline => 1, },
35            dependOn => {
36                multiple => 1,
37                can_values => sub {
38                    my $sth = $base->db->prepare_cached(
39                        q{
40                        select relname, name from "objects_table"
41                        where exported = true
42                        }
43                    );
44                    $sth->execute();
45                    my @res;
46                    while (my $res = $sth->fetchrow_hashref) {
47                        push(@res, $res->{relname} . '.' . $res->{name});
48                    }
49                    return @res;
50                },
51            },
52            manager => {
53                multiple => 1,
54                reference => 'user',
55            },
56        }
57    )
58}
59
601;
61
62__END__
63
64=head1 SEE ALSO
65
66L<LATMOS::Accounts::Bases::Sql>
67
68=head1 AUTHOR
69
70Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
71
72=head1 COPYRIGHT AND LICENSE
73
74Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS
75
76This library is free software; you can redistribute it and/or modify
77it under the same terms as Perl itself, either Perl version 5.10.0 or,
78at your option, any later version of Perl 5 you may have available.
79
80
81=cut
Note: See TracBrowser for help on using the repository browser.