diff options
author | khoff <khoff> | 2003-02-05 23:23:00 +0000 |
---|---|---|
committer | khoff <khoff> | 2003-02-05 23:23:00 +0000 |
commit | 6e2dcb26245ef419438f60e99c91873a8d762625 (patch) | |
tree | 65014338652b084dfe2eb9ebbe6f78d1898cb1b9 /FS | |
parent | 0354f39ed0e74fd2eae1d9da13906625b4f56591 (diff) |
svc_broadband rewrite
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/ac.pm | 148 | ||||
-rwxr-xr-x | FS/FS/ac_block.pm | 148 | ||||
-rwxr-xr-x | FS/FS/ac_field.pm | 138 | ||||
-rwxr-xr-x | FS/FS/ac_type.pm | 128 | ||||
-rwxr-xr-x | FS/FS/part_ac_field.pm | 102 |
5 files changed, 0 insertions, 664 deletions
diff --git a/FS/FS/ac.pm b/FS/FS/ac.pm deleted file mode 100644 index 5a2b36079..000000000 --- a/FS/FS/ac.pm +++ /dev/null @@ -1,148 +0,0 @@ -package FS::ac; - -use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs qsearch ); -use FS::ac_type; -use FS::ac_block; - -@ISA = qw( FS::Record ); - -=head1 NAME - -FS::ac - Object methods for ac records - -=head1 SYNOPSIS - - use FS::ac; - - $record = new FS::ac \%hash; - $record = new FS::ac { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -An FS::ac record describes a broadband Access Concentrator, such as a DSLAM -or a wireless access point. FS::ac inherits from FS::Record. The following -fields are currently supported: - -narf - -=over 4 - -=item acnum - primary key - -=item actypenum - AC type, see L<FS::ac_type> - -=item acname - descriptive name for the AC - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Create a new record. To add the record to the database, see L<"insert">. - -=cut - -sub table { 'ac'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Deletes this record from the database. If there is an error, returns the -error, otherwise returns false. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=item check - -Checks all fields to make sure this is a valid record. If there is an error, -returns the error, otherwise returns false. Called by the insert and replace -methods. - -=cut - -sub check { - my $self = shift; - - my $error = - $self->ut_numbern('acnum') - || $self->ut_number('actypenum') - || $self->ut_text('acname'); - return $error if $error; - - return "Unknown actypenum" - unless $self->ac_type; - ''; -} - -=item ac_type - -Returns the L<FS::ac_type> object corresponding to this object. - -=cut - -sub ac_type { - my $self = shift; - return qsearchs('ac_type', { actypenum => $self->actypenum }); -} - -=item ac_block - -Returns a list of L<FS::ac_block> objects (address blocks) associated -with this object. - -=cut - -sub ac_block { - my $self = shift; - return qsearch('ac_block', { acnum => $self->acnum }); -} - -=item ac_field - -Returns a hash of L<FS::ac_field> objects assigned to this object. - -=cut - -sub ac_field { - my $self = shift; - - return qsearch('ac_field', { acnum => $self->acnum }); -} - -=back - -=head1 VERSION - -$Id: - -=head1 BUGS - -=head1 SEE ALSO - -L<FS::svc_broadband>, L<FS::ac>, L<FS::ac_block>, L<FS::ac_field>, schema.html -from the base documentation. - -=cut - -1; - diff --git a/FS/FS/ac_block.pm b/FS/FS/ac_block.pm deleted file mode 100755 index 09de6a4d8..000000000 --- a/FS/FS/ac_block.pm +++ /dev/null @@ -1,148 +0,0 @@ -package FS::ac_block; - -use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs qsearch ); -use FS::ac_type; -use FS::ac; -use FS::svc_broadband; -use NetAddr::IP; - -@ISA = qw( FS::Record ); - -=head1 NAME - -FS::ac - Object methods for ac records - -=head1 SYNOPSIS - - use FS::ac_block; - - $record = new FS::ac_block \%hash; - $record = new FS::ac_block { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -An FS::ac_block record describes an address block assigned for broadband -access. FS::ac_block inherits from FS::Record. The following fields are -currently supported: - -=over 4 - -=item acnum - the access concentrator (see L<FS::ac_type>) to which this -block is assigned. - -=item ip_gateway - the gateway address used by customers within this block. -This functions as the primary key. - -=item ip_netmask - the netmask of the block, expressed as an integer. - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Create a new record. To add the record to the database, see L<"insert">. - -=cut - -sub table { 'ac_block'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Deletes this record from the database. If there is an error, returns the -error, otherwise returns false. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=item check - -Checks all fields to make sure this is a valid record. If there is an error, -returns the error, otherwise returns false. Called by the insert and replace -methods. - -=cut - -sub check { - my $self = shift; - - my $error = - $self->ut_number('acnum') - || $self->ut_ip('ip_gateway') - || $self->ut_number('ip_netmask') - ; - return $error if $error; - - return "Unknown acnum" - unless $self->ac; - - my $self_addr = new NetAddr::IP ($self->ip_gateway, $self->ip_netmask); - return "Cannot parse address: ". $self->ip_gateway . '/' . $self->ip_netmask - unless $self_addr; - - my @block = grep { - my $block_addr = new NetAddr::IP ($_->ip_gateway, $_->ip_netmask); - if($block_addr->contains($self_addr) - or $self_addr->contains($block_addr)) { $_; }; - } qsearch( 'ac_block', {}); - - foreach(@block) { - return "Block intersects existing block ".$_->ip_gateway."/".$_->ip_netmask; - } - - ''; -} - - -=item ac - -Returns the L<FS::ac> object corresponding to this object. - -=cut - -sub ac { - my $self = shift; - return qsearchs('ac', { acnum => $self->acnum }); -} - -=item svc_broadband - -Returns a list of L<FS::svc_broadband> objects associated -with this object. - -=cut - -#sub svc_broadband { -# my $self = shift; -# my @svc = qsearch('svc_broadband', { actypenum => $self->ac->ac_type->actypenum }); -# return grep { -# my $svc_addr = new NetAddr::IP($_->ip_addr, $_->ip_netmask); -# $self_addr->contains($svc_addr); -# } @svc; -#} - -=back - -=cut - -1; - diff --git a/FS/FS/ac_field.pm b/FS/FS/ac_field.pm deleted file mode 100755 index f6011192f..000000000 --- a/FS/FS/ac_field.pm +++ /dev/null @@ -1,138 +0,0 @@ -package FS::ac_field; - -use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs ); -use FS::part_ac_field; -use FS::ac; - -use UNIVERSAL qw( can ); - -@ISA = qw( FS::Record ); - -=head1 NAME - -FS::ac_field - Object methods for ac_field records - -=head1 SYNOPSIS - - use FS::ac_field; - - $record = new FS::ac_field \%hash; - $record = new FS::ac_field { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -L<FS::ac_field> contains values of fields defined by L<FS::part_ac_field> -for an L<FS::ac>. Values must be of the data type defined by ut_type in -L<FS::part_ac_field>. -Supported fields as follows: - -=over 4 - -=item acfieldpart - Type of ac_field as defined by L<FS::part_ac_field> - -=item acnum - The L<FS::ac> to which this value belongs. - -=item value - The contents of the field. - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Create a new record. To add the record to the database, see L<"insert">. - -=cut - -sub table { 'ac_field'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Deletes this record from the database. If there is an error, returns the -error, otherwise returns false. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=item check - -Checks all fields to make sure this is a valid record. If there is an error, -returns the error, otherwise returns false. Called by the insert and replace -methods. - -=cut - -sub check { - my $self = shift; - - return "acnum must be defined" unless $self->acnum; - return "acfieldpart must be defined" unless $self->acfieldpart; - - my $ut_func = $self->can("ut_" . $self->part_ac_field->ut_type); - my $error = $self->$ut_func('value'); - - return $error if $error; - - ''; #no error -} - -=item part_ac_field - -Returns a reference to the L<FS:part_ac_field> that defines this L<FS::ac_field> - -=cut - -sub part_ac_field { - my $self = shift; - - return qsearchs('part_ac_field', { acfieldpart => $self->acfieldpart }); -} - -=item ac - -Returns a reference to the L<FS::ac> to which this L<FS::ac_field> belongs. - -=cut - -sub ac { - my $self = shift; - - return qsearchs('ac', { acnum => $self->acnum }); -} - -=back - -=head1 VERSION - -$Id: - -=head1 BUGS - -=head1 SEE ALSO - -L<FS::svc_broadband>, L<FS::ac>, L<FS::ac_block>, L<FS::ac_field>, schema.html -from the base documentation. - -=cut - -1; - diff --git a/FS/FS/ac_type.pm b/FS/FS/ac_type.pm deleted file mode 100755 index e83c5c5f0..000000000 --- a/FS/FS/ac_type.pm +++ /dev/null @@ -1,128 +0,0 @@ -package FS::ac_type; - -use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs ); -use FS::ac; - -@ISA = qw( FS::Record ); - -=head1 NAME - -FS::ac_type - Object methods for ac_type records - -=head1 SYNOPSIS - - use FS::ac_type; - - $record = new FS::ac_type \%hash; - $record = new FS::ac_type { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -L<FS::ac_type> refers to a type of access concentrator. L<FS::svc_broadband> -records refer to a specific L<FS::ac_type> limiting the choice of access -concentrator to one of the chosen type. This should be set as a fixed -default in part_svc to prevent provisioning the wrong type of service for -a given package or service type. Supported fields as follows: - -=over 4 - -=item actypenum - Primary key. see L<FS::ac> - -=item actypename - Text identifier for access concentrator type. - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Create a new record. To add the record to the database, see L<"insert">. - -=cut - -sub table { 'ac_type'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Deletes this record from the database. If there is an error, returns the -error, otherwise returns false. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=item check - -Checks all fields to make sure this is a valid record. If there is an error, -returns the error, otherwise returns false. Called by the insert and replace -methods. - -=cut - -sub check { - my $self = shift; - - # What do we check? - - ''; #no error -} - -=item ac - -Returns a list of all L<FS::ac> records of this type. - -=cut - -sub ac { - my $self = shift; - - return qsearch('ac', { actypenum => $self->actypenum }); -} - -=item part_ac_field - -Returns a list of all L<FS::part_ac_field> records of this type. - -=cut - -sub part_ac_field { - my $self = shift; - - return qsearch('part_ac_field', { actypenum => $self->actypenum }); -} - -=back - -=head1 VERSION - -$Id: - -=head1 BUGS - -=head1 SEE ALSO - -L<FS::svc_broadband>, L<FS::ac>, L<FS::ac_block>, L<FS::ac_field>, schema.html -from the base documentation. - -=cut - -1; - diff --git a/FS/FS/part_ac_field.pm b/FS/FS/part_ac_field.pm deleted file mode 100755 index dcb445253..000000000 --- a/FS/FS/part_ac_field.pm +++ /dev/null @@ -1,102 +0,0 @@ -package FS::part_ac_field; - -use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs ); -use FS::ac_field; -use FS::ac; - - -@ISA = qw( FS::Record ); - -=head1 NAME - -FS::part_ac_field - Object methods for part_ac_field records - -=head1 SYNOPSIS - - use FS::part_ac_field; - - $record = new FS::part_ac_field \%hash; - $record = new FS::part_ac_field { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - - -=over 4 - -=item blank - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Create a new record. To add the record to the database, see L<"insert">. - -=cut - -sub table { 'part_ac_field'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Deletes this record from the database. If there is an error, returns the -error, otherwise returns false. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=item check - -Checks all fields to make sure this is a valid record. If there is an error, -returns the error, otherwise returns false. Called by the insert and replace -methods. - -=cut - -sub check { - my $self = shift; - my $error = ''; - - $self->name =~ /^([a-z0-9_\-\.]{1,15})$/i - or return "Invalid field name for part_ac_field"; - - ''; #no error -} - - -=back - -=head1 VERSION - -$Id: - -=head1 BUGS - -=head1 SEE ALSO - -L<FS::svc_broadband>, L<FS::ac>, L<FS::ac_block>, L<FS::ac_field>, schema.html -from the base documentation. - -=cut - -1; - |