1 package FS::vend_bill_pay;
2 use base qw( FS::Record );
5 use FS::Record qw( dbh ); #qsearch #qsearchs );
9 FS::vend_bill_pay - Object methods for vend_bill_pay records
13 use FS::vend_bill_pay;
15 $record = new FS::vend_bill_pay \%hash;
16 $record = new FS::vend_bill_pay { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::vend_bill_pay object represents the application of a vendor payment to a
29 specific invoice or payment. FS::vend_bill_pay inherits from FS::Record. The
30 following fields are currently supported:
59 Creates a new record. To add the record to the database, see L<"insert">.
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to. You can ask the object for a copy with the I<hash> method.
66 sub table { 'vend_bill_pay'; }
70 Adds this record to the database. If there is an error, returns the error,
71 otherwise returns false.
75 Delete this record from the database.
82 my $oldAutoCommit = $FS::UID::AutoCommit;
83 local $FS::UID::AutoCommit = 0;
86 my $error = $self->SUPER::delete;
88 $dbh->rollback if $oldAutoCommit;
92 #magically auto-deleting for the simple case
93 foreach my $vend_pay ( $self->vend_pay ) {
94 my $error = $vend_pay->delete;
96 $dbh->rollback if $oldAutoCommit;
101 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
107 =item replace OLD_RECORD
109 Replaces the OLD_RECORD with this one in the database. If there is an error,
110 returns the error, otherwise returns false.
114 Checks all fields to make sure this is a valid record. If there is
115 an error, returns the error, otherwise returns false. Called by the insert
124 $self->ut_numbern('vendbillpaynum')
125 || $self->ut_foreign_key('vendbillnum', 'vend_bill', 'vendbillnum')
126 || $self->ut_foreign_key('vendpaynum', 'vend_pay', 'vendpaynum')
127 || $self->ut_money('amount')
129 return $error if $error;
142 L<FS::Record>, schema.html from the base documentation.