2 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
11 FS::fiber_olt - Object methods for fiber_olt records
17 $record = new FS::fiber_olt \%hash;
18 $record = new FS::fiber_olt { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::fiber_olt object represents an Optical Line Terminal that fiber
31 connections (L<FS::svc_fiber>) connect to. FS::fiber_olt inherits from
32 FS::Record. The following fields are currently supported:
36 =item oltnum - primary key
38 =item oltname - name of this device
40 =item serial - serial number
42 =item sitenum - the L<FS::olt_site> where this OLT is installed
44 =item disabled - set to 'Y' to make this OLT unavailable for new connections
54 Creates a new fiber_olt record. To add it to the database, see L<"insert">.
58 # the new method can be inherited from FS::Record, if a table method is defined
60 sub table { 'fiber_olt'; }
64 Adds this record to the database. If there is an error, returns the error,
65 otherwise returns false.
69 Delete this record from the database.
71 =item replace OLD_RECORD
73 Replaces the OLD_RECORD with this one in the database. If there is an error,
74 returns the error, otherwise returns false.
78 Checks all fields to make sure this is a valid example. If there is
79 an error, returns the error, otherwise returns false. Called by the insert
84 # the check method should currently be supplied - FS::Record contains some
85 # data checking routines
91 $self->ut_numbern('oltnum')
92 || $self->ut_text('oltname')
93 || $self->ut_text('serial')
94 || $self->ut_foreign_keyn('sitenum', 'olt_site', 'sitenum')
95 || $self->ut_flag('disabled')
97 return $error if $error;
102 =item site_description
104 Returns the OLT's site description.
108 sub site_description {
110 return '' if !$self->sitenum;
111 my $olt_site = FS::olt_site->by_key($self->sitenum);
112 return $olt_site->description;
117 Returns the OLT's site name and unit name.
123 my $desc = $self->oltname;
124 $desc = $self->site_description . '/' . $desc if $self->sitenum;
132 qsearch('svc_fiber', { 'oltnum' => $self->get('oltnum') });
139 L<FS::svc_fiber>, L<FS::olt_site>, L<FS::Record>