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

SF.net SVN: ledger-smb: [1797] trunk/LedgerSMB/AA.pm



Revision: 1797
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1797&view=rev
Author:   einhverfr
Date:     2007-10-19 14:26:14 -0700 (Fri, 19 Oct 2007)

Log Message:
-----------
AR/AP Vouchers now posting properly.

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2007-10-19 18:47:03 UTC (rev 1796)
+++ trunk/LedgerSMB/AA.pm	2007-10-19 21:26:14 UTC (rev 1797)
@@ -372,10 +372,16 @@
            if (not defined $form->{batch_id}){
                $form->error($locale->text('Batch ID Missing'));
            }
+           if ($form->{arap} eq 'ar'){
+               $batch_class = 'receivable';
+           } else {
+               $batch_class = 'payable';
+           }
            $query = qq| 
-		INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|;
-           $dbh->prepare($query)->execute($form->{batch_id}, $form->{id}) ||
-                $form->dberror($query);
+		INSERT INTO voucher (batch_id, trans_id, batch_class)
+		VALUES (?, ?, (select id from batch_class where class = ?))|;
+           $dbh->prepare($query)->execute($form->{batch_id}, $form->{id}, 
+                $batch_class) || $form->dberror($query);
         }
         
     }


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