RT# 83450 - fixed rateplan export
[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 =back
51
52 =head1 METHODS
53
54 =over 4
55
56 =item new HASHREF
57
58 Creates a new vertex record.  To add the record to the database, see L<"insert">.
59
60 =cut
61
62 sub table { 'deploy_zone_vertex'; }
63
64 =item insert
65
66 Adds this record to the database.  If there is an error, returns the error,
67 otherwise returns false.
68
69 =cut
70
71 =item delete
72
73 Delete this record from the database.
74
75 =cut
76
77 =item replace OLD_RECORD
78
79 Replaces the OLD_RECORD with this one in the database.  If there is an error,
80 returns the error, otherwise returns false.
81
82 =cut
83
84 =item check
85
86 Checks all fields to make sure this is a valid vertex.  If there is
87 an error, returns the error, otherwise returns false.  Called by the insert
88 and replace methods.
89
90 =cut
91
92 # the check method should currently be supplied - FS::Record contains some
93 # data checking routines
94
95 sub check {
96   my $self = shift;
97
98   my $error = 
99     $self->ut_numbern('vertexnum')
100     || $self->ut_number('zonenum')
101     || $self->ut_coord('latitude')
102     || $self->ut_coord('longitude')
103   ;
104   return $error if $error;
105
106   $self->SUPER::check;
107 }
108
109 =back
110
111 =head1 BUGS
112
113 =head1 SEE ALSO
114
115 L<FS::Record>
116
117 =cut
118
119 1;
120