This commit was generated by cvs2svn to compensate for changes in r4888,
[freeside.git] / FS / FS / pay_batch.pm
1 package FS::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::pay_batch - Object methods for pay_batch records
12
13 =head1 SYNOPSIS
14
15   use FS::pay_batch;
16
17   $record = new FS::pay_batch \%hash;
18   $record = new FS::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::pay_batch object represents an example.  FS::pay_batch inherits from
31 FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item batchnum - primary key
36
37 =item payby - CARD or CHEK
38
39 =item status - O (Open), I (In-transit), or R (Resolved)
40
41 =item download - 
42
43 =item upload - 
44
45
46 =back
47
48 =head1 METHODS
49
50 =over 4
51
52 =item new HASHREF
53
54 Creates a new example.  To add the example to the database, see L<"insert">.
55
56 Note that this stores the hash reference, not a distinct copy of the hash it
57 points to.  You can ask the object for a copy with the I<hash> method.
58
59 =cut
60
61 # the new method can be inherited from FS::Record, if a table method is defined
62
63 sub table { 'pay_batch'; }
64
65 =item insert
66
67 Adds this record to the database.  If there is an error, returns the error,
68 otherwise returns false.
69
70 =cut
71
72 # the insert method can be inherited from FS::Record
73
74 =item delete
75
76 Delete this record from the database.
77
78 =cut
79
80 # the delete method can be inherited from FS::Record
81
82 =item replace OLD_RECORD
83
84 Replaces the OLD_RECORD with this one in the database.  If there is an error,
85 returns the error, otherwise returns false.
86
87 =cut
88
89 # the replace method can be inherited from FS::Record
90
91 =item check
92
93 Checks all fields to make sure this is a valid example.  If there is
94 an error, returns the error, otherwise returns false.  Called by the insert
95 and replace methods.
96
97 =cut
98
99 # the check method should currently be supplied - FS::Record contains some
100 # data checking routines
101
102 sub check {
103   my $self = shift;
104
105   my $error = 
106     $self->ut_numbern('batchnum')
107     || $self->ut_enum('payby', [ 'CARD', 'CHEK' ])
108     || $self->ut_enum('status', [ 'O', 'I', 'R' ])
109   ;
110   return $error if $error;
111
112   $self->SUPER::check;
113 }
114
115 =back
116
117 =head1 BUGS
118
119 status is somewhat redundant now that download and upload exist
120
121 =head1 SEE ALSO
122
123 L<FS::Record>, schema.html from the base documentation.
124
125 =cut
126
127 1;
128