1 package FS::cust_bill_pay_batch;
2 use base qw( FS::Record );
5 use FS::Record qw( dbh );
9 FS::cust_bill_pay_batch - Object methods for cust_bill_pay_batch records
13 use FS::cust_bill_pay_batch;
15 $record = new FS::cust_bill_pay_batch \%hash;
16 $record = new FS::cust_bill_pay_batch { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::cust_bill_pay_batch object represents a relationship between a
29 customer's bill and a batch. FS::cust_bill_pay_batch inherits from
30 FS::Record. The following fields are currently supported:
34 =item billpaynum - primary key
36 =item invnum - customer's bill (invoice)
38 =item paybatchnum - entry in cust_pay_batch table
53 Creates a new record. To add the record to the database, see L<"insert">.
55 Note that this stores the hash reference, not a distinct copy of the hash it
56 points to. You can ask the object for a copy with the I<hash> method.
60 sub table { 'cust_bill_pay_batch'; }
64 Adds this record to the database. If there is an error, returns the error,
65 otherwise returns false.
71 Delete this record from the database.
75 =item replace OLD_RECORD
77 Replaces the OLD_RECORD with this one in the database. If there is an error,
78 returns the error, otherwise returns false.
84 Checks all fields to make sure this is a valid example. If there is
85 an error, returns the error, otherwise returns false. Called by the insert
94 $self->ut_numbern('billpaynum')
95 || $self->ut_number('invnum')
96 || $self->ut_number('paybatchnum')
97 || $self->ut_money('amount')
98 || $self->ut_numbern('_date')
100 return $error if $error;
110 sub _upgrade_schema {
111 my ($class, %opts) = @_;
114 DELETE FROM cust_bill_pay_batch WHERE NOT EXISTS
115 ( SELECT 1 FROM cust_pay_batch WHERE cust_pay_batch.paybatchnum = cust_bill_pay_batch.paybatchnum )
118 my $sth = dbh->prepare($sql) or die dbh->errstr;
119 $sth->execute or die $sth->errstr;
131 L<FS::Record>, schema.html from the base documentation.