1 package FS::cust_bill_pkg;
4 use vars qw(@ISA @EXPORT_OK);
6 use FS::Record qw(fields qsearchs);
8 @ISA = qw(FS::Record Exporter);
9 @EXPORT_OK = qw(fields);
13 FS::cust_bill_pkg - Object methods for cust_bill_pkg records
17 use FS::cust_bill_pkg;
19 $record = create FS::cust_bill_pkg \%hash;
20 $record = create 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>)
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>).
68 my($proto,$hashref)=@_;
70 #now in FS::Record::new
72 #foreach $field (fields('cust_bill_pkg')) {
73 # $hashref->{$field}='' unless defined $hashref->{$field};
76 $proto->new('cust_bill_pkg',$hashref);
82 Adds this line item to the database. If there is an error, returns the error,
83 otherwise returns false.
96 Currently unimplemented. I don't remove line items because there would then be
97 no record the items ever existed (which is bad, no?)
102 return "Can't delete cust_bill_pkg records!";
107 =item replace OLD_RECORD
109 Currently unimplemented. This would be even more of an accounting nightmare
110 than deleteing the items. Just don't do it.
115 return "Can't modify cust_bill_pkg records!";
117 #return "(Old) Not a cust_bill_pkg record!"
118 # unless $old->table eq "cust_bill_pkg";
126 Checks all fields to make sure this is a valid line item. If there is an
127 error, returns the error, otherwise returns false. Called by the insert
134 return "Not a cust_bill_pkg record!" unless $self->table eq "cust_bill_pkg";
137 $self->ut_number('pkgnum')
138 or $self->ut_number('invnum')
139 or $self->ut_money('setup')
140 or $self->ut_money('recur')
141 or $self->ut_numbern('sdate')
142 or $self->ut_numbern('edate')
144 return $error if $error;
146 if ( $self->pkgnum != 0 ) { #allow unchecked pkgnum 0 for tax! (add to part_pkg?)
147 return "Unknown pkgnum ".$self->pkgnum
148 unless qsearchs('cust_pkg',{'pkgnum'=> $self->pkgnum });
151 return "Unknown invnum"
152 unless qsearchs('cust_bill',{'invnum'=> $self->invnum });
161 It doesn't properly override FS::Record yet.
165 L<FS::Record>, L<FS::cust_bill>, L<FS::cust_pkg>, L<FS::cust_main>, schema.html
166 from the base documentation.
170 ivan@sisd.com 98-mar-13
172 pod ivan@sisd.com 98-sep-21