5 #use FS::Record qw( qsearch qsearchs );
8 @ISA = qw( FS::svc_Common );
12 FS::svc_phone - Object methods for svc_phone records
18 $record = new FS::svc_phone \%hash;
19 $record = new FS::svc_phone { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
29 $error = $record->suspend;
31 $error = $record->unsuspend;
33 $error = $record->cancel;
37 An FS::svc_phone object represents a phone number. FS::svc_phone inherits
38 from FS::Record. The following fields are currently supported:
42 =item svcnum - primary key
58 Creates a new phone number. To add the number to the database, see L<"insert">.
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to. You can ask the object for a copy with the I<hash> method.
65 # the new method can be inherited from FS::Record, if a table method is defined
69 'name' => 'Phone number',
70 'sorts' => 'phonenum',
71 'display_weight' => 60,
72 'cancel_weight' => 80,
74 'countrycode' => { label => 'Country code',
76 disable_inventory => 1,
79 'phonenum' => 'Phone number',
80 'pin' => { label => 'Personal Identification Number',
82 disable_inventory => 1,
89 sub table { 'svc_phone'; }
91 =item search_sql STRING
93 Class method which returns an SQL fragment to search for the given string.
98 my( $class, $string ) = @_;
99 $class->search_sql_field('phonenum', $string );
104 Returns the phone number.
110 $self->phonenum; #XXX format it better
115 Adds this record to the database. If there is an error, returns the error,
116 otherwise returns false.
120 # the insert method can be inherited from FS::Record
124 Delete this record from the database.
128 # the delete method can be inherited from FS::Record
130 =item replace OLD_RECORD
132 Replaces the OLD_RECORD with this one in the database. If there is an error,
133 returns the error, otherwise returns false.
137 # the replace method can be inherited from FS::Record
141 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
145 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
149 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
153 Checks all fields to make sure this is a valid phone number. If there is
154 an error, returns the error, otherwise returns false. Called by the insert
159 # the check method should currently be supplied - FS::Record contains some
160 # data checking routines
166 $self->ut_numbern('svcnum')
167 || $self->ut_numbern('countrycode')
168 || $self->ut_number('phonenum')
169 || $self->ut_numbern('pin')
171 return $error if $error;
173 $self->countrycode(1) unless $self->countrycode;
184 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
185 L<FS::cust_pkg>, schema.html from the base documentation.