delete fees, RT#81713
[freeside.git] / FS / FS / cust_bill_pkg_fee.pm
1 package FS::cust_bill_pkg_fee;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::cust_bill_pkg_fee - Object methods for cust_bill_pkg_fee records
10
11 =head1 SYNOPSIS
12
13   use FS::cust_bill_pkg_fee;
14
15   $record = new FS::cust_bill_pkg_fee \%hash;
16   $record = new FS::cust_bill_pkg_fee { 'column' => 'value' };
17
18   $error = $record->insert;
19
20   $error = $new_record->replace($old_record);
21
22   $error = $record->delete;
23
24   $error = $record->check;
25
26 =head1 DESCRIPTION
27
28 An FS::cust_bill_pkg_fee object records the origin of a fee.  
29 FS::cust_bill_pkg_fee inherits from FS::Record.  The following fields 
30 are currently supported:
31
32 =over 4
33
34 =item billpkgfeenum - primary key
35
36 =item billpkgnum - the billpkgnum of the fee line item
37
38 =item base_invnum - the invoice number (L<FS::cust_bill>) that caused 
39 (this portion of) the fee to be charged.
40
41 =item base_billpkgnum - the invoice line item (L<FS::cust_bill_pkg>) that
42 caused (this portion of) the fee to be charged.  May be null.
43
44 =item amount - the fee amount
45
46 =back
47
48 =head1 METHODS
49
50 =over 4
51
52 =cut
53
54 sub table { 'cust_bill_pkg_fee'; }
55
56 # seeing as these methods are not defined in this module I object to having
57 # perldoc noise for them
58
59 =item check
60
61 Checks all fields to make sure this is a valid example.  If there is
62 an error, returns the error, otherwise returns false.  Called by the insert
63 and replace methods.
64
65 =cut
66
67 sub check {
68   my $self = shift;
69
70   my $error = 
71     $self->ut_numbern('billpkgfeenum')
72     || $self->ut_number('billpkgnum')
73     || $self->ut_foreign_key('base_invnum', 'cust_bill', 'invnum')
74     || $self->ut_foreign_keyn('base_billpkgnum', 'cust_bill_pkg', 'billpkgnum')
75     || $self->ut_money('amount')
76   ;
77   return $error if $error;
78
79   $self->SUPER::check;
80 }
81
82 =back
83
84 =head1 SEE ALSO
85
86 L<FS::Record>
87
88 =cut
89
90 1;
91