summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-01-14 17:26:53 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-01-14 17:26:53 +0000
commit7a867668a4459de3cc474000930f245aea01468d (patch)
treed347dda2ea31d7c8f548159d7238d7f499dacffd /LedgerSMB
parentf058158efb8dae52129bd78526a62af6ed69c2a1 (diff)
Correcting bug 1839776-- reposting sales invoice causes duplication.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2043 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/IS.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index 2f3eebef..9946b891 100755
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -821,6 +821,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);
@@ -1820,9 +1824,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|