[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1284] trunk/LedgerSMB



Revision: 1284
          http://svn.sourceforge.net/ledger-smb/?rev=1284&view=rev
Author:   einhverfr
Date:     2007-06-18 23:37:26 -0700 (Mon, 18 Jun 2007)

Log Message:
-----------
Voucher creation support added to API

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/GL.pm
    trunk/LedgerSMB/IR.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/OP.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2007-06-19 05:38:48 UTC (rev 1283)
+++ trunk/LedgerSMB/AA.pm	2007-06-19 06:37:26 UTC (rev 1284)
@@ -321,7 +321,12 @@
     );
 
     $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

Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm	2007-06-19 05:38:48 UTC (rev 1283)
+++ trunk/LedgerSMB/GL.pm	2007-06-19 06:37:26 UTC (rev 1284)
@@ -130,6 +130,12 @@
 		      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);

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2007-06-19 05:38:48 UTC (rev 1283)
+++ trunk/LedgerSMB/IR.pm	2007-06-19 06:37:26 UTC (rev 1284)
@@ -295,7 +295,13 @@
                 $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"} ) {
 
                 # add purchase to inventory

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2007-06-19 05:38:48 UTC (rev 1283)
+++ trunk/LedgerSMB/IS.pm	2007-06-19 06:37:26 UTC (rev 1284)
@@ -1096,7 +1096,13 @@
                 $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;
 

Modified: trunk/LedgerSMB/OP.pm
===================================================================
--- trunk/LedgerSMB/OP.pm	2007-06-19 05:38:48 UTC (rev 1283)
+++ trunk/LedgerSMB/OP.pm	2007-06-19 06:37:26 UTC (rev 1284)
@@ -92,9 +92,13 @@
     $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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.