fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / olt_site.pm
1 package FS::olt_site;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::olt_site - Object methods for olt_site records
10
11 =head1 SYNOPSIS
12
13   use FS::olt_site;
14
15   $record = new FS::olt_site \%hash;
16   $record = new FS::olt_site { '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::olt_site object represents a central office housing Optical Line
29 Terminals (L<FS::fiber_olt>). FS::olt_site inherits from
30 FS::Record.  The following fields are currently supported:
31
32 =over 4
33
34 =item sitenum - primary key
35
36 =item market - market designator, indicating the general area the site serves
37
38 =item site - site designator
39
40 =back
41
42 =head1 METHODS
43
44 =over 4
45
46 =item new HASHREF
47
48 Creates a new record.  To add the record to the database, see L<"insert">.
49
50 =cut
51
52 sub table { 'olt_site'; }
53
54 =item insert
55
56 Adds this record to the database.  If there is an error, returns the error,
57 otherwise returns false.
58
59 =item delete
60
61 Delete this record from the database.
62
63 =item replace OLD_RECORD
64
65 Replaces the OLD_RECORD with this one in the database.  If there is an error,
66 returns the error, otherwise returns false.
67
68 =item check
69
70 Checks all fields to make sure this is a valid example.  If there is
71 an error, returns the error, otherwise returns false.  Called by the insert
72 and replace methods.
73
74 =cut
75
76 # the check method should currently be supplied - FS::Record contains some
77 # data checking routines
78
79 sub check {
80   my $self = shift;
81
82   my $error = 
83     $self->ut_numbern('sitenum')
84     || $self->ut_text('market')
85     || $self->ut_text('site')
86   ;
87   return $error if $error;
88
89   $self->SUPER::check;
90 }
91
92 sub description {
93   my $self = shift;
94   return $self->market . '/' . $self->site;
95 }
96
97 =back
98
99 =head1 SEE ALSO
100
101 L<FS::Record>, L<FS::fiber_olt>
102
103 =cut
104
105 1;
106