1 package FS::part_pkg_usageprice;
2 use base qw( FS::Record );
6 #use FS::Record qw( qsearch qsearchs );
10 FS::part_pkg_usageprice - Object methods for part_pkg_usageprice records
14 use FS::part_pkg_usageprice;
16 $record = new FS::part_pkg_usageprice \%hash;
17 $record = new FS::part_pkg_usageprice { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::part_pkg_usageprice object represents a usage pricing add-on.
30 FS::part_pkg_usageprice inherits from FS::Record. The following fields are
72 Creates a new record. To add the record to the database, see L<"insert">.
74 Note that this stores the hash reference, not a distinct copy of the hash it
75 points to. You can ask the object for a copy with the I<hash> method.
79 sub table { 'part_pkg_usageprice'; }
83 Adds this record to the database. If there is an error, returns the error,
84 otherwise returns false.
88 Delete this record from the database.
90 =item replace OLD_RECORD
92 Replaces the OLD_RECORD with this one in the database. If there is an error,
93 returns the error, otherwise returns false.
97 Checks all fields to make sure this is a valid record. If there is
98 an error, returns the error, otherwise returns false. Called by the insert
107 $self->ut_numbern('usagepricepart')
108 || $self->ut_number('pkgpart')
109 || $self->ut_money('price')
110 || $self->ut_currencyn('currency')
111 || $self->ut_enum('action', [ 'increment', 'set' ])
112 || $self->ut_enum('target', [ 'svc_acct.totalbytes', 'svc_acct.seconds',
113 'svc_conferencing.participants',
114 'svc_conferencing.confqualitynum'
117 || $self->ut_text('amount')
119 return $error if $error;
126 Returns a hash reference of information about the target of this object.
127 Keys are "label" and "multiplier".
133 $self->targets->{$self->target};
139 Returns a hash reference. Keys are possible values for the "target" field.
140 Values are hash references with "label" and "multiplier" keys.
146 tie my %targets, 'Tie::IxHash', # once?
147 #'svc_acct.totalbytes' => { label => 'Megabytes',
148 # multiplier => 1048576,
150 'svc_acct.totalbytes' => { label => 'Gigabytes',
151 multiplier => 1073741824,
153 'svc_acct.seconds' => { label => 'Hours',
156 'svc_conferencing.participants' => { label => 'Conference Participants',
159 #this will take more work: set action, not increment..
160 # and then value comes from a select, not a text field
161 # 'svc_conferencing.confqualitynum' => { label => 'Conference Quality',
175 L<FS::part_pkg>, L<FS::Record>