1 package FS::cable_device;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearchs ); # qsearch );
11 FS::cable_device - Object methods for cable_device records
17 $record = new FS::cable_device \%hash;
18 $record = new FS::cable_device { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::cable_device object represents a specific customer cable modem.
31 FS::cable_device inherits from FS::Record. The following fields are currently
65 Creates a new record. To add the record to the database, see L<"insert">.
67 Note that this stores the hash reference, not a distinct copy of the hash it
68 points to. You can ask the object for a copy with the I<hash> method.
72 sub table { 'cable_device'; }
76 Adds this record to the database. If there is an error, returns the error,
77 otherwise returns false.
81 Delete this record from the database.
83 =item replace OLD_RECORD
85 Replaces the OLD_RECORD with this one in the database. If there is an error,
86 returns the error, otherwise returns false.
90 Checks all fields to make sure this is a valid record. If there is
91 an error, returns the error, otherwise returns false. Called by the insert
99 my $mac = $self->mac_addr;
102 $self->mac_addr($mac);
105 $self->ut_numbern('devicenum')
106 || $self->ut_number('devicepart')
107 || $self->ut_foreign_key('devicepart', 'part_device', 'devicepart')
108 || $self->ut_foreign_key('svcnum', 'svc_cable', 'svcnum' ) #cust_svc?
109 || $self->ut_hexn('mac_addr')
110 || $self->ut_textn('serial')
112 return $error if $error;
119 Returns the device type record (see L<FS::part_device>) associated with this
126 qsearchs( 'part_device', { 'devicepart' => $self->devicepart } );