1 package FS::cust_bill_pkg;
5 use FS::Record qw( qsearchs );
9 @ISA = qw(FS::Record );
13 FS::cust_bill_pkg - Object methods for cust_bill_pkg records
17 use FS::cust_bill_pkg;
19 $record = new FS::cust_bill_pkg \%hash;
20 $record = new FS::cust_bill_pkg { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::cust_bill_pkg object represents an invoice line item.
33 FS::cust_bill_pkg inherits from FS::Record. The following fields are currently
38 =item invnum - invoice (see L<FS::cust_bill>)
40 =item pkgnum - package (see L<FS::cust_pkg>) or 0 for the special virtual sales tax package
42 =item setup - setup fee
44 =item recur - recurring fee
46 =item sdate - starting date of recurring fee
48 =item edate - ending date of recurring fee
52 sdate and edate are specified as UNIX timestamps; see L<perlfunc/"time">. Also
53 see L<Time::Local> and L<Date::Parse> for conversion functions.
61 Creates a new line item. To add the line item to the database, see
62 L<"insert">. Line items are normally created by calling the bill method of a
63 customer object (see L<FS::cust_main>).
67 sub table { 'cust_bill_pkg'; }
71 Adds this line item to the database. If there is an error, returns the error,
72 otherwise returns false.
76 Currently unimplemented. I don't remove line items because there would then be
77 no record the items ever existed (which is bad, no?)
82 return "Can't delete cust_bill_pkg records!";
85 =item replace OLD_RECORD
87 Currently unimplemented. This would be even more of an accounting nightmare
88 than deleteing the items. Just don't do it.
93 return "Can't modify cust_bill_pkg records!";
98 Checks all fields to make sure this is a valid line item. If there is an
99 error, returns the error, otherwise returns false. Called by the insert
108 $self->ut_number('pkgnum')
109 || $self->ut_number('invnum')
110 || $self->ut_money('setup')
111 || $self->ut_money('recur')
112 || $self->ut_numbern('sdate')
113 || $self->ut_numbern('edate')
115 return $error if $error;
117 if ( $self->pkgnum != 0 ) { #allow unchecked pkgnum 0 for tax! (add to part_pkg?)
118 return "Unknown pkgnum ". $self->pkgnum
119 unless qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
122 return "Unknown invnum"
123 unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } );
130 Returns the package (see L<FS::cust_pkg>) for this invoice line item.
136 qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
145 L<FS::Record>, L<FS::cust_bill>, L<FS::cust_pkg>, L<FS::cust_main>, schema.html
146 from the base documentation.