summaryrefslogtreecommitdiff
path: root/LedgerSMB/IR.pm
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB/IR.pm')
-rwxr-xr-xLedgerSMB/IR.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 5dc1676b..3f3b0aed 100755
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -123,9 +123,10 @@ sub post_invoice {
&reverse_invoice( $dbh, $form );
}
else {
- $query = qq|INSERT INTO ap (id) VALUES (?)|;
+ $query = qq|INSERT INTO ap (id, vendor_id) VALUES (?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{id} ) || $form->dberror($query);
+ $sth->execute( $form->{id}, $form->{vendor_id} )
+ || $form->dberror($query);
}
}
@@ -135,11 +136,12 @@ sub post_invoice {
if ( !$form->{id} ) {
$query = qq|
- INSERT INTO ap (invnumber, employee_id)
- VALUES ('$uid', (SELECT id FROM employee
+ INSERT INTO ap (invnumber, vendor_id, employee_id)
+ VALUES ('$uid', ?, (SELECT id FROM employee
WHERE login = ?))|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{login} ) || $form->dberror($query);
+ $sth->execute( $form->{vendor_id}, $form->{login})
+ || $form->dberror($query);
$query = qq|SELECT id FROM ap WHERE invnumber = '$uid'|;
$sth = $dbh->prepare($query);