diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-01-14 17:29:29 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-01-14 17:29:29 +0000 |
commit | b79c3f25ea8e931a060ce13764cdeb5b15b33196 (patch) | |
tree | 740de9e4597fb228e8f81ce3218fe2e665cfe42d /LedgerSMB | |
parent | 8fd8d152972d6fb853cdb9cd6cd0dcccb7cce600 (diff) |
Merging bug fix 1839776 from 1.2
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2044 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/IS.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index 8960d92a..8f804089 100644 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -826,6 +826,10 @@ sub post_invoice { %$form->{acc_trans} = (); + if ($form->{id}){ + delete_invoice($self, $myconfig, $form); + } + ( $null, $form->{employee_id} ) = split /--/, $form->{employee}; unless ( $form->{employee_id} ) { ( $form->{employee}, $form->{employee_id} ) = $form->get_employee($dbh); @@ -1837,9 +1841,20 @@ sub delete_invoice { $form->audittrail( $dbh, "", \%audittrail ); # delete AR record - my $query = qq|DELETE FROM ar WHERE id = ?|; + + my $query = qq|DELETE FROM invoice WHERE trans_id = ?|; + $sth = $dbh->prepare($query); + $sth->execute( $form->{id} ) || $form->dberror($query); + $sth->finish; + $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|; + $sth = $dbh->prepare($query); + $sth->execute( $form->{id} ) || $form->dberror($query); + $sth->finish; + + $query = qq|DELETE FROM ar WHERE id = ?|; $sth = $dbh->prepare($query); $sth->execute( $form->{id} ) || $form->dberror($query); + $sth->finish; # delete spool files $query = qq| |