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

SF.net SVN: ledger-smb:[3283] trunk/sql/modules/Payment.sql



Revision: 3283
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3283&view=rev
Author:   ehuelsmann
Date:     2011-06-18 21:01:30 +0000 (Sat, 18 Jun 2011)

Log Message:
-----------
Patch by John Locke: don't hard-code batch_class_id in cash receipt vouchers.

Modified Paths:
--------------
    trunk/sql/modules/Payment.sql

Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql	2011-06-18 20:22:59 UTC (rev 3282)
+++ trunk/sql/modules/Payment.sql	2011-06-18 21:01:30 UTC (rev 3283)
@@ -362,7 +362,7 @@
 		       LEFT JOIN voucher v ON (acc_trans.voucher_id = v.id)
 		           WHERE ((al.description = 'AP' AND in_account_class = 1)
 		                 OR (al.description = 'AR' AND in_account_class = 2))
-			   AND (approved IS TRUE or v.batch_class = 3)
+			   AND (approved IS TRUE or v.batch_class IN (3, 6))
 		        GROUP BY acc_trans.trans_id) p ON (a.id = p.trans_id)
 		LEFT JOIN "session" s ON (s."session_id" = t.locked_by)
 		LEFT JOIN users u ON (u.id = s.users_id)
@@ -491,7 +491,9 @@
 		RAISE EXCEPTION 'Bulk Post Must be from Batch!';
 	ELSE
 		INSERT INTO voucher (batch_id, batch_class, trans_id)
-		values (in_batch_id, 3, in_transactions[1][1]);
+		values (in_batch_id,
+                (SELECT batch_class_id FROM batch WHERE id = in_batch_id),
+                in_transactions[1][1]);
 
 		t_voucher_id := currval('voucher_id_seq');
 	END IF;


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