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