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

Last change on this file since 1904 was 1551, checked in by nanardon, 8 years ago

Various fixes after i18n changes

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