summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LedgerSMB/AA.pm5
-rw-r--r--LedgerSMB/GL.pm6
-rw-r--r--LedgerSMB/IR.pm6
-rw-r--r--LedgerSMB/IS.pm6
-rw-r--r--LedgerSMB/OP.pm8
5 files changed, 29 insertions, 2 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index 2edcc44a..4f14fda8 100644
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -321,7 +321,12 @@ sub post_transaction {
);
$dbh->prepare($query)->execute(@queryargs) || $form->dberror($query);
+ if (defined $form->{approved}) {
+ $query = qq| UPDATE $table SET approved = ? WHERE id = ?|;
+ $dbh->prepare($query)->execute($form->{approved}, $form->{id}) ||
+ $form->dberror($query);
+ }
@queries = $form->run_custom_queries( $table, 'INSERT' );
# update exchangerate
diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm
index 322e08b1..98be9cbe 100644
--- a/LedgerSMB/GL.pm
+++ b/LedgerSMB/GL.pm
@@ -130,6 +130,12 @@ sub post_transaction {
department_id = ?
WHERE id = ?|;
+ if (defined $form->{approved}) {
+
+ $query = qq| UPDATE gl SET approved = ? WHERE id = ?|;
+ $dbh->prepare($query)->execute($form->{approved}, $form->{id})
+ || $form->dberror($query);
+ }
$sth = $dbh->prepare($query);
$sth->execute( $form->{transdate}, $department_id, $form->{id} )
|| $form->dberror($query);
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 714acf61..4812b9f8 100644
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -295,6 +295,12 @@ sub post_invoice {
$project_id, $form->{"serialnumber_$i"},
$form->{"notes_$i"}, $invoice_id
) || $form->dberror($query);
+ if (defined $form->{approved}) {
+
+ $query = qq| UPDATE ap SET approved = ? WHERE id = ?|;
+ $dbh->prepare($query)->execute($form->{approved}, $form->{id})
+ || $form->dberror($query);
+ }
if ( $form->{"inventory_accno_id_$i"} ) {
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index f737e5d3..dfbb465d 100644
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -1096,6 +1096,12 @@ sub post_invoice {
$project_id, $form->{"serialnumber_$i"},
$form->{"notes_$i"}, $invoice_id
) || $form->dberror($query);
+ if (defined $form->{approved}) {
+
+ $query = qq| UPDATE ar SET approved = ? WHERE id = ?|;
+ $dbh->prepare($query)->execute($form->{approved}, $form->{id})
+ || $form->dberror($query);
+ }
# add invoice_id
$form->{acc_trans}{lineitems}[$ndx]->{invoice_id} = $invoice_id;
diff --git a/LedgerSMB/OP.pm b/LedgerSMB/OP.pm
index 3a07f036..836ef92c 100644
--- a/LedgerSMB/OP.pm
+++ b/LedgerSMB/OP.pm
@@ -92,9 +92,13 @@ sub overpayment {
$query = qq|
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount)
VALUES (?, (SELECT id FROM chart
- WHERE accno = ?), ?, ?)|;
+ WHERE accno = ?), ?, ?, ?)|;
+ if (not defined $form->{approved}){
+ $form->{approved} = 1;
+ }
$sth = $dbh->prepare($query);
- $sth->execute( $uid, $accno, $form->{datepaid}, $fxamount * $ml )
+ $sth->execute( $uid, $accno, $form->{datepaid}, $fxamount * $ml,
+ $form->{approved} )
|| $form->dberror($query);
# add payment