source: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Site.pm @ 1144

Last change on this file since 1144 was 1023, checked in by nanardon, 12 years ago
  • complete POD

This patch a basic documentation to all functions.
It also add two test to ensure all POD syntax are correct and coverage is full.

  • Property svn:keywords set to Id Rev
File size: 2.0 KB
Line 
1package LATMOS::Accounts::Bases::Sql::Site;
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 { 'site' }
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            cn     => { ro => 1, inline => 1, iname => 'name' },
34            date   => { ro => 1, inline => 1, },
35            create => { ro => 1, inline => 1, },
36            streetAddress => { formtype => 'TEXTAREA' },
37            postalAddress => { ro => 1, },
38            siteNick => { uniq => 1 },
39        }
40    )
41}
42
43sub get_field {
44    my ($self, $field) = @_;
45    if ($field eq 'postalAddress' ) {
46        my $bp = $self->_get_c_field('postOfficeBox');
47        return join("\n", grep { $_ } (
48            $self->_get_c_field('o'),
49            $self->_get_c_field('streetAddress'),
50            ($bp ? 'BP ' . $bp : ''),
51            join(' ', grep { $_ } (
52                    $self->_get_c_field('postalCode'),
53                    $self->_get_c_field('l'),)),
54            join(' ', grep { $_ } (
55                    $self->_get_c_field('st'),
56                    $self->_get_c_field('co'),),
57            )
58        ));
59    } else {
60        return $self->SUPER::get_field($field);
61    }
62}
63
641;
65
66__END__
67
68=head1 SEE ALSO
69
70L<LATMOS::Accounts::Bases::Sql>
71
72=head1 AUTHOR
73
74Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
75
76=head1 COPYRIGHT AND LICENSE
77
78Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS
79
80This library is free software; you can redistribute it and/or modify
81it under the same terms as Perl itself, either Perl version 5.10.0 or,
82at your option, any later version of Perl 5 you may have available.
83
84
85=cut
Note: See TracBrowser for help on using the repository browser.