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

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



Revision: 2906
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2906&view=rev
Author:   einhverfr
Date:     2010-02-24 04:51:59 +0000 (Wed, 24 Feb 2010)

Log Message:
-----------
Corrected bug with bulk posting receipts.

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

Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql	2010-02-22 20:24:18 UTC (rev 2905)
+++ trunk/sql/modules/Payment.sql	2010-02-24 04:51:59 UTC (rev 2906)
@@ -545,11 +545,19 @@
 		||$E$ , $E$ || coalesce(quote_literal(in_payment_type), 'NULL') || $E$ 
 		FROM bulk_payments_in $E$;
 
-	EXECUTE $E$
-		UPDATE ap 
-		set paid = paid + (select amount from bulk_payments_in b 
-			where b.id = ap.id)
-		where id in (select id from bulk_payments_in) $E$;
+        IF in_account_class = 1 THEN
+        	EXECUTE $E$
+	        	UPDATE ap 
+		        set paid = paid + (select amount from bulk_payments_in b 
+		         	where b.id = ap.id)
+		         where id in (select id from bulk_payments_in) $E$;
+        ELSE
+        	EXECUTE $E$
+	        	UPDATE ar 
+		        set paid = paid + (select amount from bulk_payments_in b 
+		         	where b.id = ar.id)
+		         where id in (select id from bulk_payments_in) $E$;
+        END IF;
 	EXECUTE $E$ DROP TABLE bulk_payments_in $E$;
 	perform unlock_all();
 	return out_count;


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