enable CardFortress in test database, #71513
[freeside.git] / FS / FS / cust_bill_pkg_discount_void.pm
1 package FS::cust_bill_pkg_discount_void;
2 use base qw( FS::Record );
3
4 use strict;
5
6 =head1 NAME
7
8 FS::cust_bill_pkg_discount_void - Object methods for cust_bill_pkg_discount_void records
9
10 =head1 SYNOPSIS
11
12   use FS::cust_bill_pkg_discount_void;
13
14   $record = new FS::cust_bill_pkg_discount_void \%hash;
15   $record = new FS::cust_bill_pkg_discount_void { 'column' => 'value' };
16
17   $error = $record->insert;
18
19   $error = $new_record->replace($old_record);
20
21   $error = $record->delete;
22
23   $error = $record->check;
24
25 =head1 DESCRIPTION
26
27 An FS::cust_bill_pkg_discount_void object represents the slice of a customer
28 discount applied to a specific voided line item.
29 FS::cust_bill_pkg_discount_void inherits from FS::Record.  The following fields
30 are currently supported:
31
32 =over 4
33
34 =item billpkgdiscountnum
35
36 primary key
37
38 =item billpkgnum
39
40 billpkgnum
41
42 =item pkgdiscountnum
43
44 pkgdiscountnum
45
46 =item amount
47
48 amount
49
50 =item months
51
52 months
53
54
55 =back
56
57 =head1 METHODS
58
59 =over 4
60
61 =item new HASHREF
62
63 Creates a new example.  To add the example to the database, see L<"insert">.
64
65 Note that this stores the hash reference, not a distinct copy of the hash it
66 points to.  You can ask the object for a copy with the I<hash> method.
67
68 =cut
69
70 sub table { 'cust_bill_pkg_discount_void'; }
71
72 =item insert
73
74 Adds this record to the database.  If there is an error, returns the error,
75 otherwise returns false.
76
77 =cut
78
79 =item delete
80
81 Delete this record from the database.
82
83 =cut
84
85 =item replace OLD_RECORD
86
87 Replaces the OLD_RECORD with this one in the database.  If there is an error,
88 returns the error, otherwise returns false.
89
90 =cut
91
92 =item check
93
94 Checks all fields to make sure this is a valid example.  If there is
95 an error, returns the error, otherwise returns false.  Called by the insert
96 and replace methods.
97
98 =cut
99
100 sub check {
101   my $self = shift;
102
103   my $error = 
104     $self->ut_number('billpkgdiscountnum')
105     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg_void', 'billpkgnum' )
106     || $self->ut_foreign_key('pkgdiscountnum', 'cust_pkg_discount', 'pkgdiscountnum' )
107     || $self->ut_money('amount')
108     || $self->ut_float('months')
109   ;
110   return $error if $error;
111
112   $self->SUPER::check;
113 }
114
115 =back
116
117 =head1 BUGS
118
119 =head1 SEE ALSO
120
121 L<FS::Record>, schema.html from the base documentation.
122
123 =cut
124
125 1;
126