1 package FS::phone_avail;
5 use FS::Record qw( qsearch qsearchs );
11 FS::phone_avail - Phone number availability cache
17 $record = new FS::phone_avail \%hash;
18 $record = new FS::phone_avail { '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_avail object represents availability of phone service.
31 FS::phone_avail inherits from FS::Record. The following fields are currently
80 Creates a new record. To add the record to the database, see L<"insert">.
82 Note that this stores the hash reference, not a distinct copy of the hash it
83 points to. You can ask the object for a copy with the I<hash> method.
87 # the new method can be inherited from FS::Record, if a table method is defined
89 sub table { 'phone_avail'; }
93 Adds this record to the database. If there is an error, returns the error,
94 otherwise returns false.
98 # the insert method can be inherited from FS::Record
102 Delete this record from the database.
106 # the delete method can be inherited from FS::Record
108 =item replace OLD_RECORD
110 Replaces the OLD_RECORD with this one in the database. If there is an error,
111 returns the error, otherwise returns false.
115 # the replace method can be inherited from FS::Record
119 Checks all fields to make sure this is a valid record. If there is
120 an error, returns the error, otherwise returns false. Called by the insert
125 # the check method should currently be supplied - FS::Record contains some
126 # data checking routines
132 $self->ut_numbern('availnum')
133 || $self->ut_foreign_key('exportnum', 'part_export', 'exportnum' )
134 || $self->ut_number('countrycode')
135 || $self->ut_alphan('state')
136 || $self->ut_number('npa')
137 || $self->ut_numbern('nxx')
138 || $self->ut_numbern('station')
139 || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum' )
140 || $self->ut_textn('availbatch')
142 return $error if $error;
147 sub process_batch_import {
151 my( $hash, $value ) = @_;
153 $value =~ /^(\d{3})(\d{3})(\d+)$/ or die "unparsable number $value\n";
154 ( $hash->{npa}, $hash->{nxx}, $hash->{station} ) = ( $1, $2, $3 );
157 my $opt = { 'table' => 'phone_avail',
158 'params' => [ 'availbatch', 'exportnum', 'countrycode' ],
159 'formats' => { 'default' => [ 'state', $numsub ] },
162 FS::Record::process_batch_import( $job, $opt, @_ );
170 Sparse documentation.
174 L<FS::Record>, schema.html from the base documentation.