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