1 | package LATMOS::Accounts::Bases::Sql::Service; |
---|
2 | |
---|
3 | use 5.010000; |
---|
4 | use strict; |
---|
5 | use warnings; |
---|
6 | |
---|
7 | use base qw(LATMOS::Accounts::Bases::Sql::objects); |
---|
8 | use LATMOS::Accounts::I18N; |
---|
9 | |
---|
10 | our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; |
---|
11 | |
---|
12 | =head1 NAME |
---|
13 | |
---|
14 | LATMOS::Accounts::Bases::Sql::Site - Common Location/Address object |
---|
15 | |
---|
16 | =head1 DESCRIPTION |
---|
17 | |
---|
18 | Store common to many people office address (typically building location). |
---|
19 | |
---|
20 | =cut |
---|
21 | |
---|
22 | sub _object_table { 'service' } |
---|
23 | |
---|
24 | sub _key_field { 'name' } |
---|
25 | |
---|
26 | sub _has_extended_attributes { 1 } |
---|
27 | |
---|
28 | sub _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 | |
---|
79 | 1; |
---|
80 | |
---|
81 | __END__ |
---|
82 | |
---|
83 | =head1 SEE ALSO |
---|
84 | |
---|
85 | L<LATMOS::Accounts::Bases::Sql> |
---|
86 | |
---|
87 | =head1 AUTHOR |
---|
88 | |
---|
89 | Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> |
---|
90 | |
---|
91 | =head1 COPYRIGHT AND LICENSE |
---|
92 | |
---|
93 | Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS |
---|
94 | |
---|
95 | This library is free software; you can redistribute it and/or modify |
---|
96 | it under the same terms as Perl itself, either Perl version 5.10.0 or, |
---|
97 | at your option, any later version of Perl 5 you may have available. |
---|
98 | |
---|
99 | |
---|
100 | =cut |
---|