per-agent disable_previous_balance, #15863
[freeside.git] / FS / FS / cdr_carrier.pm
1 package FS::cdr_carrier;
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_carrier - Object methods for cdr_carrier records
12
13 =head1 SYNOPSIS
14
15   use FS::cdr_carrier;
16
17   $record = new FS::cdr_carrier \%hash;
18   $record = new FS::cdr_carrier { '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_carrier object represents an CDR carrier or upstream.
31 FS::cdr_carrier inherits from FS::Record.  The following fields are currently
32 supported:
33
34 =over 4
35
36 =item carrierid - primary key
37
38 =item carriername - Carrier name
39
40 =back
41
42 =head1 METHODS
43
44 =over 4
45
46 =item new HASHREF
47
48 Creates a new carrier.  To add the carrier to the database, see L<"insert">.
49
50 Note that this stores the hash reference, not a distinct copy of the hash it
51 points to.  You can ask the object for a copy with the I<hash> method.
52
53 =cut
54
55 # the new method can be inherited from FS::Record, if a table method is defined
56
57 sub table { 'cdr_carrier'; }
58
59 =item insert
60
61 Adds this record to the database.  If there is an error, returns the error,
62 otherwise returns false.
63
64 =cut
65
66 # the insert method can be inherited from FS::Record
67
68 =item delete
69
70 Delete this record from the database.
71
72 =cut
73
74 # the delete method can be inherited from FS::Record
75
76 =item replace OLD_RECORD
77
78 Replaces the OLD_RECORD with this one in the database.  If there is an error,
79 returns the error, otherwise returns false.
80
81 =cut
82
83 # the replace method can be inherited from FS::Record
84
85 =item check
86
87 Checks all fields to make sure this is a valid carrier.  If there is
88 an error, returns the error, otherwise returns false.  Called by the insert
89 and replace methods.
90
91 =cut
92
93 sub check {
94   my $self = shift;
95
96   my $error = 
97     $self->ut_numbern('carrierid')
98     || $self->ut_text('carriername')
99   ;
100   return $error if $error;
101
102   $self->SUPER::check;
103 }
104
105 =back
106
107 =head1 BUGS
108
109 =head1 SEE ALSO
110
111 L<FS::Record>, schema.html from the base documentation.
112
113 =cut
114
115 1;
116