[132] | 1 | package LATMOS::Accounts::Bases::Sql::Site; |
---|
| 2 | |
---|
| 3 | use 5.010000; |
---|
| 4 | use strict; |
---|
| 5 | use warnings; |
---|
| 6 | |
---|
| 7 | use base qw(LATMOS::Accounts::Bases::Sql::objects); |
---|
[1551] | 8 | use LATMOS::Accounts::I18N; |
---|
[132] | 9 | |
---|
[2175] | 10 | our $VERSION = (q$Rev: 1551 $ =~ /^Rev: (\d+) /)[0]; |
---|
[132] | 11 | |
---|
| 12 | =head1 NAME |
---|
| 13 | |
---|
[1023] | 14 | LATMOS::Accounts::Bases::Sql::Site - Common Location/Address object |
---|
[132] | 15 | |
---|
| 16 | =head1 DESCRIPTION |
---|
| 17 | |
---|
[1023] | 18 | Store common to many people office address (typically building location). |
---|
[132] | 19 | |
---|
| 20 | =cut |
---|
| 21 | |
---|
[1014] | 22 | sub _object_table { 'site' } |
---|
[132] | 23 | |
---|
[1014] | 24 | sub _key_field { 'name' } |
---|
[132] | 25 | |
---|
[1014] | 26 | sub _has_extended_attributes { 1 } |
---|
[132] | 27 | |
---|
[861] | 28 | sub _get_attr_schema { |
---|
| 29 | my ($class, $base) = @_; |
---|
[753] | 30 | |
---|
[861] | 31 | $class->SUPER::_get_attr_schema($base, |
---|
| 32 | { |
---|
| 33 | name => { ro => 1, inline => 1, }, |
---|
| 34 | cn => { ro => 1, inline => 1, iname => 'name' }, |
---|
| 35 | date => { ro => 1, inline => 1, }, |
---|
| 36 | create => { ro => 1, inline => 1, }, |
---|
| 37 | streetAddress => { formtype => 'TEXTAREA' }, |
---|
[1315] | 38 | postalAddress => { |
---|
| 39 | ro => 1, |
---|
| 40 | get => sub { |
---|
| 41 | my $self = $_[0]->object; |
---|
| 42 | my $bp = $self->_get_c_field('postOfficeBox'); |
---|
| 43 | return join("\n", grep { $_ } ( |
---|
| 44 | $self->_get_c_field('o'), |
---|
| 45 | $self->_get_c_field('streetAddress'), |
---|
| 46 | ($bp ? 'BP ' . $bp : ''), |
---|
| 47 | join(' ', grep { $_ } ( |
---|
| 48 | $self->_get_c_field('postalCode'), |
---|
| 49 | $self->_get_c_field('l'),)), |
---|
| 50 | join(' ', grep { $_ } ( |
---|
| 51 | $self->_get_c_field('st'), |
---|
| 52 | $self->_get_c_field('co'),), |
---|
| 53 | ) |
---|
| 54 | ) |
---|
| 55 | ); |
---|
| 56 | }, |
---|
| 57 | }, |
---|
[861] | 58 | siteNick => { uniq => 1 }, |
---|
[1315] | 59 | st => { }, |
---|
| 60 | postalCode => { }, |
---|
| 61 | postOfficeBox => { }, |
---|
| 62 | o => { }, |
---|
| 63 | l => { }, |
---|
| 64 | facsimileTelephoneNumber => { }, |
---|
| 65 | description => { }, |
---|
| 66 | co => { }, |
---|
[861] | 67 | } |
---|
| 68 | ) |
---|
[453] | 69 | } |
---|
| 70 | |
---|
[132] | 71 | 1; |
---|
| 72 | |
---|
| 73 | __END__ |
---|
| 74 | |
---|
| 75 | =head1 SEE ALSO |
---|
| 76 | |
---|
[1023] | 77 | L<LATMOS::Accounts::Bases::Sql> |
---|
| 78 | |
---|
[132] | 79 | =head1 AUTHOR |
---|
| 80 | |
---|
| 81 | Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> |
---|
| 82 | |
---|
| 83 | =head1 COPYRIGHT AND LICENSE |
---|
| 84 | |
---|
| 85 | Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS |
---|
| 86 | |
---|
| 87 | This library is free software; you can redistribute it and/or modify |
---|
| 88 | it under the same terms as Perl itself, either Perl version 5.10.0 or, |
---|
| 89 | at your option, any later version of Perl 5 you may have available. |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | =cut |
---|