agent-virtualize credit card surcharge percentage, RT#72961
[freeside.git] / FS / FS / circuit_type.pm
1 package FS::circuit_type;
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_type - Object methods for circuit_type records
10
11 =head1 SYNOPSIS
12
13   use FS::circuit_type;
14
15   $record = new FS::circuit_type \%hash;
16   $record = new FS::circuit_type { '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_type object represents a circuit type (such as "DS1" or "OC3").
29 FS::circuit_type inherits from FS::Record.  The following fields are currently
30 supported:
31
32 =over 4
33
34 =item typenum - primary key
35
36 =item typename - name of the circuit type
37
38 =item disabled - 'Y' if this is disabled
39
40 =back
41
42 =head1 METHODS
43
44 =over 4
45
46 =item new HASHREF
47
48 Creates a new example.  To add the example to the database, see L<"insert">.
49
50 =cut
51
52 sub table { 'circuit_type'; }
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 sub check {
77   my $self = shift;
78
79   my $error = 
80     $self->ut_numbern('typenum')
81     || $self->ut_text('typename')
82     || $self->ut_flag('disabled')
83   ;
84   return $error if $error;
85
86   $self->SUPER::check;
87 }
88
89 =back
90
91 =head1 SEE ALSO
92
93 L<FS::Record>
94
95 =cut
96
97 1;
98