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
50 =item itemdesc - Line item description (currentlty used only when pkgnum is 0)
54 sdate and edate are specified as UNIX timestamps; see L<perlfunc/"time">. Also
55 see L<Time::Local> and L<Date::Parse> for conversion functions.
63 Creates a new line item. To add the line item to the database, see
64 L<"insert">. Line items are normally created by calling the bill method of a
65 customer object (see L<FS::cust_main>).
69 sub table { 'cust_bill_pkg'; }
73 Adds this line item to the database. If there is an error, returns the error,
74 otherwise returns false.
78 Currently unimplemented. I don't remove line items because there would then be
79 no record the items ever existed (which is bad, no?)
84 return "Can't delete cust_bill_pkg records!";
87 =item replace OLD_RECORD
89 Currently unimplemented. This would be even more of an accounting nightmare
90 than deleteing the items. Just don't do it.
95 return "Can't modify cust_bill_pkg records!";
100 Checks all fields to make sure this is a valid line item. If there is an
101 error, returns the error, otherwise returns false. Called by the insert
110 $self->ut_number('pkgnum')
111 || $self->ut_number('invnum')
112 || $self->ut_money('setup')
113 || $self->ut_money('recur')
114 || $self->ut_numbern('sdate')
115 || $self->ut_numbern('edate')
116 || $self->ut_textn('itemdesc')
118 return $error if $error;
120 if ( $self->pkgnum != 0 ) { #allow unchecked pkgnum 0 for tax! (add to part_pkg?)
121 return "Unknown pkgnum ". $self->pkgnum
122 unless qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
125 return "Unknown invnum"
126 unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } );
133 Returns the package (see L<FS::cust_pkg>) for this invoice line item.
139 qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
146 $Id: cust_bill_pkg.pm,v 1.4 2002-09-21 11:17:39 ivan Exp $
152 L<FS::Record>, L<FS::cust_bill>, L<FS::cust_pkg>, L<FS::cust_main>, schema.html
153 from the base documentation.