58234b9240f81976d67f830cf603fa08009a39c1
[freeside.git] / FS / FS / deploy_zone_block.pm
1 package FS::deploy_zone_block;
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_block - Object methods for deploy_zone_block records
10
11 =head1 SYNOPSIS
12
13   use FS::deploy_zone_block;
14
15   $record = new FS::deploy_zone_block \%hash;
16   $record = new FS::deploy_zone_block { '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_block object represents a census block that's part of
29 a deployment zone.  FS::deploy_zone_block inherits from FS::Record.  The 
30 following fields are currently supported:
31
32 =over 4
33
34 =item blocknum
35
36 primary key
37
38 =item zonenum
39
40 L<FS::deploy_zone> foreign key for the zone.
41
42 =item censusblock
43
44 U.S. census block number (15 digits).
45
46 =item censusyear
47
48 The year of the census map where the block appeared or was last verified.
49
50 =back
51
52 =head1 METHODS
53
54 =over 4
55
56 =item new HASHREF
57
58 Creates a new block entry.  To add the recordto the database, see L<"insert">.
59
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to.  You can ask the object for a copy with the I<hash> method.
62
63 =cut
64
65 # the new method can be inherited from FS::Record, if a table method is defined
66
67 sub table { 'deploy_zone_block'; }
68
69 =item insert
70
71 Adds this record to the database.  If there is an error, returns the error,
72 otherwise returns false.
73
74 =cut
75
76 # the insert method can be inherited from FS::Record
77
78 =item delete
79
80 Delete this record from the database.
81
82 =cut
83
84 # the delete method can be inherited from FS::Record
85
86 =item replace OLD_RECORD
87
88 Replaces the OLD_RECORD with this one in the database.  If there is an error,
89 returns the error, otherwise returns false.
90
91 =cut
92
93 # the replace method can be inherited from FS::Record
94
95 =item check
96
97 Checks all fields to make sure this is a valid record.  If there is
98 an error, returns the error, otherwise returns false.  Called by the insert
99 and replace methods.
100
101 =cut
102
103 sub check {
104   my $self = shift;
105
106   my $error = 
107     $self->ut_numbern('blocknum')
108     || $self->ut_number('zonenum')
109     || $self->ut_number('censusblock')
110     || $self->ut_number('censusyear')
111   ;
112   return $error if $error;
113
114   $self->SUPER::check;
115 }
116
117 =back
118
119 =head1 SEE ALSO
120
121 L<FS::Record>
122
123 =cut
124
125 1;
126