diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-09-10 01:33:44 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-09-10 01:33:44 -0700 |
commit | 99b652023e643e4f33b72f238cca65fd9f3394b3 (patch) | |
tree | 5e430194db42a89dbf741702e4a7de15295db22e /FS | |
parent | 6027eeaf77eb9f7e55a60ed551d41fe804433e2e (diff) |
svc_cable service have a single serial / MAC / model, not one-to-many devices like svc_phone and svc_dsl, RT#22009
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cable_device.pm | 140 | ||||
-rw-r--r-- | FS/t/cable_device.t | 5 |
2 files changed, 0 insertions, 145 deletions
diff --git a/FS/FS/cable_device.pm b/FS/FS/cable_device.pm deleted file mode 100644 index 1a0f1b998..000000000 --- a/FS/FS/cable_device.pm +++ /dev/null @@ -1,140 +0,0 @@ -package FS::cable_device; - -use strict; -use base qw( FS::Record ); -use FS::Record qw( qsearchs ); # qsearch ); -use FS::part_device; -use FS::svc_cable; - -=head1 NAME - -FS::cable_device - Object methods for cable_device records - -=head1 SYNOPSIS - - use FS::cable_device; - - $record = new FS::cable_device \%hash; - $record = new FS::cable_device { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -An FS::cable_device object represents a specific customer cable modem. -FS::cable_device inherits from FS::Record. The following fields are currently -supported: - -=over 4 - -=item devicenum - -primary key - -=item devicepart - -devicepart - -=item svcnum - -svcnum - -=item mac_addr - -mac_addr - -=item serial - -serial - - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Creates a new record. To add the record to the database, see L<"insert">. - -Note that this stores the hash reference, not a distinct copy of the hash it -points to. You can ask the object for a copy with the I<hash> method. - -=cut - -sub table { 'cable_device'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Delete this record from the database. - -=item replace OLD_RECORD - -Replaces the 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 $mac = $self->mac_addr; - $mac =~ s/\s+//g; - $mac =~ s/://g; - $self->mac_addr($mac); - - my $error = - $self->ut_numbern('devicenum') - || $self->ut_number('devicepart') - || $self->ut_foreign_key('devicepart', 'part_device', 'devicepart') - || $self->ut_foreign_key('svcnum', 'svc_cable', 'svcnum' ) #cust_svc? - || $self->ut_hexn('mac_addr') - || $self->ut_textn('serial') - ; - return $error if $error; - - $self->SUPER::check; -} - -=item part_device - -Returns the device type record (see L<FS::part_device>) associated with this -customer device. - -=cut - -sub part_device { - my $self = shift; - qsearchs( 'part_device', { 'devicepart' => $self->devicepart } ); -} - -=back - -=head1 BUGS - -=head1 SEE ALSO - -L<FS::Record> - -=cut - -1; - diff --git a/FS/t/cable_device.t b/FS/t/cable_device.t deleted file mode 100644 index 016d2c5c1..000000000 --- a/FS/t/cable_device.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n" } -END {print "not ok 1\n" unless $loaded;} -use FS::cable_device; -$loaded=1; -print "ok 1\n"; |