new 477 report: deployment info, combined browse-edit UI, #24047
[freeside.git] / FS / FS / deploy_zone_vertex.pm
1 package FS::deploy_zone_vertex;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::deploy_zone_vertex - Object methods for deploy_zone_vertex records
10
11 =head1 SYNOPSIS
12
13   use FS::deploy_zone_vertex;
14
15   $record = new FS::deploy_zone_vertex \%hash;
16   $record = new FS::deploy_zone_vertex { 'column' => 'value' };
17
18   $error = $record->insert;
19
20   $error = $new_record->replace($old_record);
21
22   $error = $record->delete;
23
24   $error = $record->check;
25
26 =head1 DESCRIPTION
27
28 An FS::deploy_zone_vertex object represents a vertex of a polygonal 
29 deployment zone (L<FS::deploy_zone>).  FS::deploy_zone_vertex inherits from
30 FS::Record.  The following fields are currently supported:
31
32 =over 4
33
34 =item vertexnum
35
36 primary key
37
38 =item zonenum
39
40 Foreign key to L<FS::deploy_zone>.
41
42 =item latitude
43
44 Latitude, as a decimal; positive values are north of the Equator.
45
46 =item longitude
47
48 Longitude, as a decimal; positive values are east of Greenwich.
49
50 =item sequence
51
52 The ordinal position of this vertex, starting with zero.
53
54 =back
55
56 =head1 METHODS
57
58 =over 4
59
60 =item new HASHREF
61
62 Creates a new vertex record.  To add the record to the database, see L<"insert">.
63
64 =cut
65
66 sub table { 'deploy_zone_vertex'; }
67
68 =item insert
69
70 Adds this record to the database.  If there is an error, returns the error,
71 otherwise returns false.
72
73 =cut
74
75 =item delete
76
77 Delete this record from the database.
78
79 =cut
80
81 =item replace OLD_RECORD
82
83 Replaces the OLD_RECORD with this one in the database.  If there is an error,
84 returns the error, otherwise returns false.
85
86 =cut
87
88 =item check
89
90 Checks all fields to make sure this is a valid vertex.  If there is
91 an error, returns the error, otherwise returns false.  Called by the insert
92 and replace methods.
93
94 =cut
95
96 # the check method should currently be supplied - FS::Record contains some
97 # data checking routines
98
99 sub check {
100   my $self = shift;
101
102   my $error = 
103     $self->ut_numbern('vertexnum')
104     || $self->ut_number('zonenum')
105     || $self->ut_coord('latitude')
106     || $self->ut_coord('longitude')
107     || $self->ut_number('sequence')
108   ;
109   return $error if $error;
110
111   $self->SUPER::check;
112 }
113
114 =back
115
116 =head1 BUGS
117
118 =head1 SEE ALSO
119
120 L<FS::Record>
121
122 =cut
123
124 1;
125