1 package FS::phone_device;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearchs ); # qsearch );
11 FS::phone_device - Object methods for phone_device records
17 $record = new FS::phone_device \%hash;
18 $record = new FS::phone_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::phone_device object represents a specific customer phone device, such as
31 a SIP phone or ATA. FS::phone_device inherits from FS::Record. The following
32 fields are currently supported:
61 Creates a new record. To add the record to the database, see L<"insert">.
63 Note that this stores the hash reference, not a distinct copy of the hash it
64 points to. You can ask the object for a copy with the I<hash> method.
68 # the new method can be inherited from FS::Record, if a table method is defined
70 sub table { 'phone_device'; }
74 Adds this record to the database. If there is an error, returns the error,
75 otherwise returns false.
79 # the insert method can be inherited from FS::Record
83 Delete this record from the database.
87 # the delete method can be inherited from FS::Record
89 =item replace OLD_RECORD
91 Replaces the OLD_RECORD with this one in the database. If there is an error,
92 returns the error, otherwise returns false.
96 # the replace method can be inherited from FS::Record
100 Checks all fields to make sure this is a valid record. If there is
101 an error, returns the error, otherwise returns false. Called by the insert
106 # the check method should currently be supplied - FS::Record contains some
107 # data checking routines
112 my $mac = $self->mac_addr;
115 $self->mac_addr($mac);
118 $self->ut_numbern('devicenum')
119 || $self->ut_foreign_key('devicepart', 'part_device', 'devicepart')
120 || $self->ut_foreign_key('svcnum', 'svc_phone', 'svcnum' ) #cust_svc?
121 || $self->ut_hexn('mac_addr')
123 return $error if $error;
130 Returns the device type record (see L<FS::part_device>) associated with this
137 qsearchs( 'part_device', { 'devicepart' => $self->devicepart } );
146 L<FS::Record>, schema.html from the base documentation.