2 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
10 FS::fiber_olt - Object methods for fiber_olt records
16 $record = new FS::fiber_olt \%hash;
17 $record = new FS::fiber_olt { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::fiber_olt object represents an Optical Line Terminal that fiber
30 connections (L<FS::svc_fiber>) connect to. FS::fiber_olt inherits from
31 FS::Record. The following fields are currently supported:
35 =item oltnum - primary key
37 =item oltname - name of this device
39 =item serial - serial number
41 =item sitenum - the L<FS::olt_site> where this OLT is installed
43 =item disabled - set to 'Y' to make this OLT unavailable for new connections
53 Creates a new fiber_olt record. To add it to the database, see L<"insert">.
57 # the new method can be inherited from FS::Record, if a table method is defined
59 sub table { 'fiber_olt'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
68 Delete this record from the database.
70 =item replace OLD_RECORD
72 Replaces the OLD_RECORD with this one in the database. If there is an error,
73 returns the error, otherwise returns false.
77 Checks all fields to make sure this is a valid example. If there is
78 an error, returns the error, otherwise returns false. Called by the insert
83 # the check method should currently be supplied - FS::Record contains some
84 # data checking routines
90 $self->ut_numbern('oltnum')
91 || $self->ut_text('oltname')
92 || $self->ut_text('serial')
93 || $self->ut_foreign_keyn('sitenum', 'olt_site', 'sitenum')
94 || $self->ut_flag('disabled')
96 return $error if $error;
101 =item site_description
103 Returns the OLT's site description.
107 sub site_description {
109 return '' if !$self->sitenum;
110 my $olt_site = FS::olt_site->by_key($self->sitenum);
111 return $olt_site->description;
116 Returns the OLT's site name and unit name.
122 my $desc = $self->oltname;
123 $desc = $self->site_description . '/' . $desc if $self->sitenum;
131 L<FS::svc_fiber>, L<FS::olt_site>, L<FS::Record>