svc_hardware: better error messages for bad hw_addr when not validating as a MAC...
[freeside.git] / FS / FS / cdr_calltype.pm
1 package FS::cdr_calltype;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record qw( qsearch qsearchs );
6
7 @ISA = qw(FS::Record);
8
9 =head1 NAME
10
11 FS::cdr_calltype - Object methods for cdr_calltype records
12
13 =head1 SYNOPSIS
14
15   use FS::cdr_calltype;
16
17   $record = new FS::cdr_calltype \%hash;
18   $record = new FS::cdr_calltype { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::cdr_calltype object represents an CDR call type.  FS::cdr_calltype
31 inherits from FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item calltypenum - primary key
36
37 =item calltypename - CDR call type name
38
39 =back
40
41 =head1 METHODS
42
43 =over 4
44
45 =item new HASHREF
46
47 Creates a new call type.  To add the call type to the database, see L<"insert">.
48
49 Note that this stores the hash reference, not a distinct copy of the hash it
50 points to.  You can ask the object for a copy with the I<hash> method.
51
52 =cut
53
54 # the new method can be inherited from FS::Record, if a table method is defined
55
56 sub table { 'cdr_calltype'; }
57
58 =item insert
59
60 Adds this record to the database.  If there is an error, returns the error,
61 otherwise returns false.
62
63 =cut
64
65 # the insert method can be inherited from FS::Record
66
67 =item delete
68
69 Delete this record from the database.
70
71 =cut
72
73 # the delete method can be inherited from FS::Record
74
75 =item replace OLD_RECORD
76
77 Replaces the OLD_RECORD with this one in the database.  If there is an error,
78 returns the error, otherwise returns false.
79
80 =cut
81
82 # the replace method can be inherited from FS::Record
83
84 =item check
85
86 Checks all fields to make sure this is a valid call type.  If there is
87 an error, returns the error, otherwise returns false.  Called by the insert
88 and replace methods.
89
90 =cut
91
92 sub check {
93   my $self = shift;
94
95   my $error = 
96     $self->ut_numbern('calltypenum')
97     || $self->ut_text('calltypename')
98   ;
99   return $error if $error;
100
101   $self->SUPER::check;
102 }
103
104 =back
105
106 =head1 BUGS
107
108 =head1 SEE ALSO
109
110 L<FS::Record>, schema.html from the base documentation.
111
112 =cut
113
114 1;
115