1 package FS::rt_field_charge;
2 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::rt_field_charge - Object methods for rt_field_charge records
13 use FS::rt_field_charge;
15 $record = new FS::rt_field_charge \%hash;
16 $record = new FS::rt_field_charge { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::rt_field_charge object represents an individual charge
29 that has been added to an invoice by a package with the rt_field price plan.
30 FS::rt_field_charge inherits from FS::Record.
31 The following fields are currently supported:
35 =item rtfieldchargenum - primary key
37 =item pkgnum - cust_pkg that generated the charge
39 =item ticketid - RT ticket that generated the charge
41 =item rate - the rate per unit for the charge
43 =item units - quantity of units being charged
45 =item charge - the total amount charged
47 =item _date - billing date for the charge
57 Creates a new object. To add the object to the database, see L<"insert">.
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to. You can ask the object for a copy with the I<hash> method.
64 # the new method can be inherited from FS::Record, if a table method is defined
66 sub table { 'rt_field_charge'; }
70 Adds this record to the database. If there is an error, returns the error,
71 otherwise returns false.
75 # the insert method can be inherited from FS::Record
79 Delete this record from the database.
83 # the delete method can be inherited from FS::Record
85 =item replace OLD_RECORD
87 Replaces the OLD_RECORD with this one in the database. If there is an error,
88 returns the error, otherwise returns false.
92 # the replace method can be inherited from FS::Record
96 Checks all fields to make sure this is a valid object. If there is
97 an error, returns the error, otherwise returns false. Called by the insert
106 $self->ut_numbern('rtfieldchargenum')
107 || $self->ut_foreign_key('pkgnum', 'cust_pkg', 'pkgnum' )
108 || $self->ut_number('ticketid')
109 || $self->ut_money('rate')
110 || $self->ut_float('units')
111 || $self->ut_money('charge')
112 || $self->ut_number('_date')
114 return $error if $error;