1 package FS::cdr_upstream_rate;
5 use FS::Record qw( qsearch qsearchs );
12 FS::cdr_upstream_rate - Object methods for cdr_upstream_rate records
16 use FS::cdr_upstream_rate;
18 $record = new FS::cdr_upstream_rate \%hash;
19 $record = new FS::cdr_upstream_rate { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::cdr_upstream_rate object represents an upstream rate mapping to
32 internal rate detail (see L<FS::rate_detail>). FS::cdr_upstream_rate inherits
33 from FS::Record. The following fields are currently supported:
37 =item upstreamratenum - primary key
39 =item upstream_rateid - CDR upstream Rate ID (cdr.upstream_rateid - see L<FS::cdr>)
41 =item ratedetailnum - Rate detail - see L<FS::rate_detail>
51 Creates a new upstream rate mapping. To add the upstream rate to the database,
54 Note that this stores the hash reference, not a distinct copy of the hash it
55 points to. You can ask the object for a copy with the I<hash> method.
59 # the new method can be inherited from FS::Record, if a table method is defined
61 sub table { 'cdr_upstream_rate'; }
65 Adds this record to the database. If there is an error, returns the error,
66 otherwise returns false.
70 # the insert method can be inherited from FS::Record
74 Delete this record from the database.
78 # the delete method can be inherited from FS::Record
80 =item replace OLD_RECORD
82 Replaces the OLD_RECORD with this one in the database. If there is an error,
83 returns the error, otherwise returns false.
87 # the replace method can be inherited from FS::Record
91 Checks all fields to make sure this is a valid upstream rate. If there is
92 an error, returns the error, otherwise returns false. Called by the insert
97 # the check method should currently be supplied - FS::Record contains some
98 # data checking routines
104 $self->ut_numbern('upstreamratenum')
105 #|| $self->ut_number('upstream_rateid')
106 || $self->ut_alpha('upstream_rateid')
107 #|| $self->ut_text('upstream_rateid')
108 || $self->ut_foreign_key('ratedetailnum', 'rate_detail', 'ratedetailnum' )
110 return $error if $error;
117 Returns the internal rate detail object for this upstream rate (see
124 qsearchs('rate_detail', { 'ratedetailnum' => $self->ratedetailnum } );
133 L<FS::Record>, schema.html from the base documentation.