1 package FS::cust_bill_pkg_discount;
4 use base qw( FS::cust_main_Mixin FS::Record );
5 use FS::Record qw( qsearch qsearchs );
7 use FS::cust_pkg_discount;
11 FS::cust_bill_pkg_discount - Object methods for cust_bill_pkg_discount records
15 use FS::cust_bill_pkg_discount;
17 $record = new FS::cust_bill_pkg_discount \%hash;
18 $record = new FS::cust_bill_pkg_discount { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::cust_bill_pkg_discount object represents the slice of a customer
31 applied to a line item. FS::cust_bill_pkg_discount inherits from
32 FS::Record. The following fields are currently supported:
36 =item billpkgdiscountnum
42 Line item (see L<FS::cust_bill_pkg>)
46 Customer discount (see L<FS::cust_pkg_discount>)
50 Amount discounted from the line itme.
54 Number of months of discount this represents.
64 Creates a new record. To add the record to the database, see L<"insert">.
66 Note that this stores the hash reference, not a distinct copy of the hash it
67 points to. You can ask the object for a copy with the I<hash> method.
71 # the new method can be inherited from FS::Record, if a table method is defined
73 sub table { 'cust_bill_pkg_discount'; }
77 Adds this record to the database. If there is an error, returns the error,
78 otherwise returns false.
82 # the insert method can be inherited from FS::Record
86 Delete this record from the database.
90 # the delete method can be inherited from FS::Record
92 =item replace OLD_RECORD
94 Replaces the OLD_RECORD with this one in the database. If there is an error,
95 returns the error, otherwise returns false.
99 # the replace method can be inherited from FS::Record
103 Checks all fields to make sure this is a valid record. If there is
104 an error, returns the error, otherwise returns false. Called by the insert
113 $self->ut_numbern('billpkgdiscountnum')
114 || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum' )
115 || $self->ut_foreign_key('pkgdiscountnum', 'cust_pkg_discount', 'pkgdiscountnum' )
116 || $self->ut_money('amount')
117 || $self->ut_float('months')
119 return $error if $error;
126 Returns the associated line item (see L<FS::cust_bill_pkg>).
132 qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ) ;
135 =item cust_pkg_discount
137 Returns the associated customer discount (see L<FS::cust_pkg_discount>).
141 sub cust_pkg_discount {
143 qsearchs( 'cust_pkg_discount', { 'pkgdiscountnum' => $self->pkgdiscountnum });
153 L<FS::Record>, schema.html from the base documentation.