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

SF.net SVN: ledger-smb:[2506] trunk



Revision: 2506
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2506&view=rev
Author:   einhverfr
Date:     2009-03-17 17:51:23 +0000 (Tue, 17 Mar 2009)

Log Message:
-----------
Correcting join issue on pending transactions (bug causes transactions to be added multiple times)

Modified Paths:
--------------
    trunk/sql/modules/Reconciliaton.sql
    trunk/sql/modules/test/Reconciliation.sql
    trunk/t/43-dbtest.t

Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql	2009-03-17 02:35:41 UTC (rev 2505)
+++ trunk/sql/modules/Reconciliaton.sql	2009-03-17 17:51:23 UTC (rev 2506)
@@ -279,7 +279,7 @@
 		      select id, reference, 'gl' as table FROM gl WHERE approved) gl 
 			ON (gl.table = t.table_name AND gl.id = t.id)
 		LEFT JOIN cr_report_line rl ON (rl.report_id = in_report_id
-			AND ((rl.ledger_id = ac.trans_id 
+			AND ((rl.ledger_id = ac.entry_id 
 				AND ac.voucher_id IS NULL) 
 				OR (rl.voucher_id = ac.voucher_id)))
 		WHERE ac.cleared IS FALSE

Modified: trunk/sql/modules/test/Reconciliation.sql
===================================================================
--- trunk/sql/modules/test/Reconciliation.sql	2009-03-17 02:35:41 UTC (rev 2505)
+++ trunk/sql/modules/test/Reconciliation.sql	2009-03-17 17:51:23 UTC (rev 2506)
@@ -15,6 +15,10 @@
 SELECT 'Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -200, currval('cr_report_id_seq')::int, 110) > 0;
 
 INSERT INTO test_result(test_name, success)
+select 'Correct number of transactions 1', count(*) = 10 
+from cr_report_line where report_id = currval('cr_report_id_seq')::int;
+
+INSERT INTO test_result(test_name, success)
 SELECT 'Correct number of GL groups', count(*) = 4 from cr_report_line where scn like '% gl %' and report_id = currval('cr_report_id_seq')::int;
 
 INSERT INTO test_result(test_name, success)
@@ -41,6 +45,17 @@
 SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int, 110) > 0;
 
 INSERT INTO test_result(test_name, success)
+select 'Correct number of transactions 2', count(*) = 10 
+from cr_report_line where report_id = currval('cr_report_id_seq')::int;
+
+INSERT INTO test_result(test_name, success)
+SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int, 110) > 0;
+
+INSERT INTO test_result(test_name, success)
+select 'Correct number of transactions 3', count(*) = 10 
+from cr_report_line where report_id = currval('cr_report_id_seq')::int;
+
+INSERT INTO test_result(test_name, success)
 SELECT '1 Correct number of GL groups', count(*) = 4 from cr_report_line where scn like '% gl %' and report_id = currval('cr_report_id_seq')::int;
 
 INSERT INTO test_result(test_name, success)
@@ -71,7 +86,11 @@
 INSERT INTO test_result(test_name, success)
 SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int, 110) > 0;
 
+INSERT INTO test_result(test_name, success)
+select 'Correct number of transactions 4', count(*) = 10 
+from cr_report_line where report_id = currval('cr_report_id_seq')::int;
 
+
 INSERT INTO test_result(test_name, success)
 SELECT 'Report Submitted', reconciliation__submit_set(currval('cr_report_id_seq')::int, (select as_array(id::int) from cr_report_line where report_id = currval('cr_report_id_seq')::int));
 
@@ -92,6 +111,7 @@
 SELECT 'Cleared balance post-approval is 130', reconciliation__get_cleared_balance(-201) = 130;
 
 
+
 SELECT * FROM test_result;
 
 SELECT (select count(*) from test_result where success is true) 

Modified: trunk/t/43-dbtest.t
===================================================================
--- trunk/t/43-dbtest.t	2009-03-17 02:35:41 UTC (rev 2505)
+++ trunk/t/43-dbtest.t	2009-03-17 17:51:23 UTC (rev 2506)
@@ -5,7 +5,7 @@
 	plan skip_all => 'Skipping all.  Told not to test db.';
 }
 else {
-	plan tests => 81;
+	plan tests => 86;
 	if (defined $ENV{LSMB_NEW_DB}){
 		$ENV{PGDATABASE} = $ENV{LSMB_NEW_DB};
 	}


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