1 package FS::cdr_cust_pkg_usage;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::cdr_cust_pkg_usage - Object methods for cdr_cust_pkg_usage records
13 use FS::cdr_cust_pkg_usage;
15 $record = new FS::cdr_cust_pkg_usage \%hash;
16 $record = new FS::cdr_cust_pkg_usage { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::cdr_cust_pkg_usage object represents an allocation of included
29 usage minutes to a call. FS::cdr_cust_pkg_usage inherits from
30 FS::Record. The following fields are currently supported:
34 =item cdrusagenum - primary key
36 =item acctid - foreign key to cdr.acctid
38 =item pkgusagenum - foreign key to cust_pkg_usage.pkgusagenum
40 =item minutes - the number of minutes allocated
50 Creates a new example. To add the example to the database, see L<"insert">.
52 Note that this stores the hash reference, not a distinct copy of the hash it
53 points to. You can ask the object for a copy with the I<hash> method.
57 # the new method can be inherited from FS::Record, if a table method is defined
59 sub table { 'cdr_cust_pkg_usage'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
68 Delete this record from the database.
70 =item replace OLD_RECORD
72 Replaces the OLD_RECORD with this one in the database. If there is an error,
73 returns the error, otherwise returns false.
77 Checks all fields to make sure this is a valid example. If there is
78 an error, returns the error, otherwise returns false. Called by the insert
87 $self->ut_numbern('cdrusagenum')
88 || $self->ut_foreign_key('acctid', 'cdr', 'acctid')
89 || $self->ut_foreign_key('pkgusagenum', 'cust_pkg_usage', 'pkgusagenum')
90 || $self->ut_float('minutes')
92 return $error if $error;
99 Returns the L<FS::cust_pkg_usage> object that this usage allocation came from.
103 Returns the L<FS::cdr> object that the usage was applied to.
108 FS::cust_pkg_usage->by_key($_[0]->pkgusagenum);
112 FS::cdr->by_key($_[0]->acctid);
119 L<FS::Record>, schema.html from the base documentation.