svc_hardware: better error messages for bad hw_addr when not validating as a MAC...
[freeside.git] / FS / FS / circuit_provider.pm
1 package FS::circuit_provider;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::circuit_provider - Object methods for circuit_provider records
10
11 =head1 SYNOPSIS
12
13   use FS::circuit_provider;
14
15   $record = new FS::circuit_provider \%hash;
16   $record = new FS::circuit_provider { 'column' => 'value' };
17
18   $error = $record->insert;
19
20   $error = $new_record->replace($old_record);
21
22   $error = $record->delete;
23
24   $error = $record->check;
25
26 =head1 DESCRIPTION
27
28 An FS::circuit_provider object represents a telecom carrier that provides
29 physical circuits (L<FS::svc_circuit>).  FS::circuit_provider inherits from
30 FS::Record.  The following fields are currently supported:
31
32 =over 4
33
34 =item providernum - primary key
35
36 =item provider - provider name
37
38 =item disabled - disabled
39
40 =back
41
42 =head1 METHODS
43
44 =over 4
45
46 =item new HASHREF
47
48 Creates a new record.  To add the record to the database, see L<"insert">.
49
50 =cut
51
52 sub table { 'circuit_provider'; }
53
54 =item insert
55
56 Adds this record to the database.  If there is an error, returns the error,
57 otherwise returns false.
58
59 =item delete
60
61 Delete this record from the database.
62
63 =item replace OLD_RECORD
64
65 Replaces the OLD_RECORD with this one in the database.  If there is an error,
66 returns the error, otherwise returns false.
67
68 =item check
69
70 Checks all fields to make sure this is a valid example.  If there is
71 an error, returns the error, otherwise returns false.  Called by the insert
72 and replace methods.
73
74 =cut
75
76 # the check method should currently be supplied - FS::Record contains some
77 # data checking routines
78
79 sub check {
80   my $self = shift;
81
82   my $error = 
83     $self->ut_numbern('providernum')
84     || $self->ut_text('provider')
85     || $self->ut_flag('disabled')
86   ;
87   return $error if $error;
88
89   $self->SUPER::check;
90 }
91
92 =back
93
94 =head1 SEE ALSO
95
96 L<FS::Record>
97
98 =cut
99
100 1;
101