[1303] | 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 | |
---|
| 9 | our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; |
---|
| 10 | |
---|
| 11 | =head1 NAME |
---|
| 12 | |
---|
| 13 | LATMOS::Accounts::Bases::Sql::Site - Common Location/Address object |
---|
| 14 | |
---|
| 15 | =head1 DESCRIPTION |
---|
| 16 | |
---|
| 17 | Store common to many people office address (typically building location). |
---|
| 18 | |
---|
| 19 | =cut |
---|
| 20 | |
---|
| 21 | sub _object_table { 'service' } |
---|
| 22 | |
---|
| 23 | sub _key_field { 'name' } |
---|
| 24 | |
---|
| 25 | sub _has_extended_attributes { 1 } |
---|
| 26 | |
---|
| 27 | sub _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 | |
---|
| 60 | 1; |
---|
| 61 | |
---|
| 62 | __END__ |
---|
| 63 | |
---|
| 64 | =head1 SEE ALSO |
---|
| 65 | |
---|
| 66 | L<LATMOS::Accounts::Bases::Sql> |
---|
| 67 | |
---|
| 68 | =head1 AUTHOR |
---|
| 69 | |
---|
| 70 | Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> |
---|
| 71 | |
---|
| 72 | =head1 COPYRIGHT AND LICENSE |
---|
| 73 | |
---|
| 74 | Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS |
---|
| 75 | |
---|
| 76 | This library is free software; you can redistribute it and/or modify |
---|
| 77 | it under the same terms as Perl itself, either Perl version 5.10.0 or, |
---|
| 78 | at your option, any later version of Perl 5 you may have available. |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | =cut |
---|