1 package FS::tower_sector;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
11 FS::tower_sector - Object methods for tower_sector records
17 $record = new FS::tower_sector \%hash;
18 $record = new FS::tower_sector { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::tower_sector object represents an tower sector. FS::tower_sector
31 inherits from FS::Record. The following fields are currently supported:
60 Creates a new sector. To add the sector to the database, see L<"insert">.
62 Note that this stores the hash reference, not a distinct copy of the hash it
63 points to. You can ask the object for a copy with the I<hash> method.
67 sub table { 'tower_sector'; }
71 Adds this record to the database. If there is an error, returns the error,
72 otherwise returns false.
76 Delete this record from the database.
83 #not the most efficient, not not awful, and its not like deleting a sector
84 # with customers is a common operation
85 return "Can't delete a sector with customers" if $self->svc_broadband;
90 =item replace OLD_RECORD
92 Replaces the OLD_RECORD with this one in the database. If there is an error,
93 returns the error, otherwise returns false.
97 Checks all fields to make sure this is a valid sector. If there is
98 an error, returns the error, otherwise returns false. Called by the insert
107 $self->ut_numbern('sectornum')
108 || $self->ut_number('towernum', 'tower', 'towernum')
109 || $self->ut_text('sectorname')
110 || $self->ut_textn('ip_addr')
111 || $self->ut_floatn('height')
112 || $self->ut_numbern('freq_mhz')
113 || $self->ut_numbern('direction')
114 || $self->ut_numbern('width')
115 || $self->ut_floatn('sector_range')
117 return $error if $error;
124 Returns the tower for this sector, as an FS::tower object (see L<FS::tower>).
130 qsearchs('tower', { 'towernum'=>$self->towernum } );
135 Returns a description for this sector including tower name.
141 if ( $self->sectorname eq '_default' ) {
142 $self->tower->towername
145 $self->tower->towername. ' sector '. $self->sectorname
151 Returns the services on this tower sector.
157 qsearch('svc_broadband', { 'sectornum' => $self->sectornum });
166 L<FS::tower>, L<FS::Record>, schema.html from the base documentation.