X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Ffiber_olt.pm;h=a9a46efb0542875963477202bba89d6907be1969;hp=a0de38d6d8afeb7c8e48cfe5843ff46230f64742;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=38444ef88b5e93aa9aa724369ae8fe17c97fa480 diff --git a/FS/FS/fiber_olt.pm b/FS/FS/fiber_olt.pm index a0de38d6d..a9a46efb0 100644 --- a/FS/FS/fiber_olt.pm +++ b/FS/FS/fiber_olt.pm @@ -3,6 +3,7 @@ use base qw( FS::Record ); use strict; use FS::Record qw( qsearch qsearchs ); +use FS::olt_site; =head1 NAME @@ -37,6 +38,8 @@ FS::Record. The following fields are currently supported: =item serial - serial number +=item sitenum - the L where this OLT is installed + =item disabled - set to 'Y' to make this OLT unavailable for new connections =back @@ -87,6 +90,7 @@ sub check { $self->ut_numbern('oltnum') || $self->ut_text('oltname') || $self->ut_text('serial') + || $self->ut_foreign_keyn('sitenum', 'olt_site', 'sitenum') || $self->ut_flag('disabled') ; return $error if $error; @@ -94,11 +98,37 @@ sub check { $self->SUPER::check; } +=item site_description + +Returns the OLT's site description. + +=cut + +sub site_description { + my $self = shift; + return '' if !$self->sitenum; + my $olt_site = FS::olt_site->by_key($self->sitenum); + return $olt_site->description; +} + +=item description + +Returns the OLT's site name and unit name. + +=cut + +sub description { + my $self = shift; + my $desc = $self->oltname; + $desc = $self->site_description . '/' . $desc if $self->sitenum; + return $desc; +} + =back =head1 SEE ALSO -L, L +L, L, L =cut