4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::areacode - Object methods for areacode records
15 $record = new FS::areacode \%hash;
16 $record = new FS::areacode { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::areacode object represents an example. FS::areacode inherits from
29 FS::Record. The following fields are currently supported:
35 area code (primary key)
39 two-letter country code
43 two-letter state code, if appropriate
47 description (optional)
58 sub table { 'areacode'; }
62 Adds this record to the database. If there is an error, returns the error,
63 otherwise returns false.
69 Delete this record from the database.
73 =item replace OLD_RECORD
75 Replaces the OLD_RECORD with this one in the database. If there is an error,
76 returns the error, otherwise returns false.
82 Checks all fields to make sure this is a valid example. If there is
83 an error, returns the error, otherwise returns false. Called by the insert
88 # the check method should currently be supplied - FS::Record contains some
89 # data checking routines
95 $self->ut_number('code')
96 || $self->ut_text('country')
97 || $self->ut_textn('state')
98 || $self->ut_textn('description')
100 return $error if $error;
111 Returns the country, state, and description for an area code.
118 my $areacode = qsearchs('areacode', { code => $code })
120 return ($areacode->country, $areacode->state, $areacode->description);
125 L<FS::Record>, schema.html from the base documentation.