1 package FS::vend_bill_pay;
4 use base qw( FS::Record );
5 use FS::Record qw( dbh qsearch ); #qsearchs );
11 FS::vend_bill_pay - Object methods for vend_bill_pay records
15 use FS::vend_bill_pay;
17 $record = new FS::vend_bill_pay \%hash;
18 $record = new FS::vend_bill_pay { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::vend_bill_pay object represents the application of a vendor payment to a
31 specific invoice or payment. FS::vend_bill_pay inherits from FS::Record. The
32 following fields are currently supported:
61 Creates a new record. To add the record to the database, see L<"insert">.
63 Note that this stores the hash reference, not a distinct copy of the hash it
64 points to. You can ask the object for a copy with the I<hash> method.
68 sub table { 'vend_bill_pay'; }
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
77 Delete this record from the database.
84 my $oldAutoCommit = $FS::UID::AutoCommit;
85 local $FS::UID::AutoCommit = 0;
88 #magically auto-deleting for the simple case
89 foreach my $vend_pay ( $self->vend_pay ) {
90 my $error = $vend_pay->delete;
92 $dbh->rollback if $oldAutoCommit;
97 my $error = $self->SUPER::delete;
99 $dbh->rollback if $oldAutoCommit;
103 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
109 =item replace OLD_RECORD
111 Replaces the OLD_RECORD with this one in the database. If there is an error,
112 returns the error, otherwise returns false.
116 Checks all fields to make sure this is a valid record. If there is
117 an error, returns the error, otherwise returns false. Called by the insert
126 $self->ut_numbern('vendbillpaynum')
127 || $self->ut_foreign_key('vendbillnum', 'vend_bill', 'vendbillnum')
128 || $self->ut_foreign_key('vendpaynum', 'vend_pay', 'vendpaynum')
129 || $self->ut_money('amount')
131 return $error if $error;
142 qsearch('vend_pay', { 'vendpaynum', $self->vendpaynum });
151 L<FS::Record>, schema.html from the base documentation.