diff options
-rw-r--r-- | LedgerSMB/AA.pm | 10 | ||||
-rw-r--r-- | LedgerSMB/GL.pm | 10 | ||||
-rw-r--r-- | LedgerSMB/IR.pm | 10 | ||||
-rw-r--r-- | LedgerSMB/IS.pm | 10 | ||||
-rw-r--r-- | LedgerSMB/OP.pm | 10 |
5 files changed, 50 insertions, 0 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm index 4f14fda8..8c4c4ad9 100644 --- a/LedgerSMB/AA.pm +++ b/LedgerSMB/AA.pm @@ -326,6 +326,16 @@ sub post_transaction { $query = qq| UPDATE $table SET approved = ? WHERE id = ?|; $dbh->prepare($query)->execute($form->{approved}, $form->{id}) || $form->dberror($query); + if (!$form->{approved}){ + if (not defined $form->{batch_id}){ + $form->error($locale->text('Batch ID Missing')); + } + $query = qq| + INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|; + $dbh->prepare($query)->execute($form->{batch_id}, $form->{id}) || + $form->dberror($query); + } + } @queries = $form->run_custom_queries( $table, 'INSERT' ); diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm index 98be9cbe..60761cf3 100644 --- a/LedgerSMB/GL.pm +++ b/LedgerSMB/GL.pm @@ -135,6 +135,16 @@ sub post_transaction { $query = qq| UPDATE gl SET approved = ? WHERE id = ?|; $dbh->prepare($query)->execute($form->{approved}, $form->{id}) || $form->dberror($query); + if (!$form->{approved}){ + if (not defined $form->{batch_id}){ + $form->error($locale->text('Batch ID Missing')); + } + $query = qq| + INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|; + $sth = $dbh->prepare($query); + $sth->execute($form->{batch_id}, $form->{id}) || + $form->dberror($query); + } } $sth = $dbh->prepare($query); $sth->execute( $form->{transdate}, $department_id, $form->{id} ) diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm index 4812b9f8..d651a520 100644 --- a/LedgerSMB/IR.pm +++ b/LedgerSMB/IR.pm @@ -300,6 +300,16 @@ sub post_invoice { $query = qq| UPDATE ap SET approved = ? WHERE id = ?|; $dbh->prepare($query)->execute($form->{approved}, $form->{id}) || $form->dberror($query); + if (!$form->{approved}){ + if (not defined $form->{batch_id}){ + $form->error($locale->text('Batch ID Missing')); + } + $query = qq| + INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|; + $sth = $dbh->prepare($query); + $sth->execute($form->{batch_id}, $form->{id}) || + $form->dberror($query); + } } if ( $form->{"inventory_accno_id_$i"} ) { diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index dfbb465d..6d3cc7cc 100644 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -1101,6 +1101,16 @@ sub post_invoice { $query = qq| UPDATE ar SET approved = ? WHERE id = ?|; $dbh->prepare($query)->execute($form->{approved}, $form->{id}) || $form->dberror($query); + if (!$form->{approved}){ + if (not defined $form->{batch_id}){ + $form->error($locale->text('Batch ID Missing')); + } + $query = qq| + INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|; + $sth = $dbh->prepare($query); + $sth->execute($form->{batch_id}, $form->{id}) || + $form->dberror($query); + } } # add invoice_id diff --git a/LedgerSMB/OP.pm b/LedgerSMB/OP.pm index 836ef92c..962011de 100644 --- a/LedgerSMB/OP.pm +++ b/LedgerSMB/OP.pm @@ -96,6 +96,16 @@ sub overpayment { if (not defined $form->{approved}){ $form->{approved} = 1; } + if (!$form->{approved}){ + if (not defined $form->{batch_id}){ + $form->error($locale->text('Batch ID Missing')); + } + $query = qq| + INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|; + $sth = $dbh->prepare($query); + $sth->execute($form->{batch_id}, $uid) || + $form->dberror($query); + } $sth = $dbh->prepare($query); $sth->execute( $uid, $accno, $form->{datepaid}, $fxamount * $ml, $form->{approved} ) |