[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2699] trunk
- Subject: SF.net SVN: ledger-smb:[2699] trunk
- From: ..hidden..
- Date: Thu, 18 Jun 2009 16:27:17 +0000
Revision: 2699
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2699&view=rev
Author: einhverfr
Date: 2009-06-18 16:27:16 +0000 (Thu, 18 Jun 2009)
Log Message:
-----------
Draft delete bug fix, test case added, other test cases corrected
Modified Paths:
--------------
trunk/sql/modules/Drafts.sql
trunk/sql/modules/Payment.sql
trunk/sql/modules/test/Company.sql
trunk/sql/modules/test/Draft.sql
trunk/t/43-dbtest.t
Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql 2009-06-17 21:54:59 UTC (rev 2698)
+++ trunk/sql/modules/Drafts.sql 2009-06-18 16:27:16 UTC (rev 2699)
@@ -92,6 +92,10 @@
declare
t_table text;
begin
+ DELETE FROM ac_tax_form
+ WHERE entry_id IN
+ (SELECT entry_id FROM acc_trans WHERE trans_id = in_id);
+
DELETE FROM acc_trans WHERE trans_id = in_id;
SELECT lower(table_name) into t_table FROM transactions where id = in_id;
Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql 2009-06-17 21:54:59 UTC (rev 2698)
+++ trunk/sql/modules/Payment.sql 2009-06-18 16:27:16 UTC (rev 2699)
@@ -326,10 +326,11 @@
THEN amount * -1
END) AS due
FROM acc_trans
- JOIN chart ON (chart.id = acc_trans.chart_id)
+ JOIN account coa ON (coa.id = acc_trans.chart_id)
+ JOIN account_link al ON (al.account_id = coa.id)
LEFT JOIN voucher v ON (acc_trans.voucher_id = v.id)
- WHERE ((chart.link = 'AP' AND in_account_class = 1)
- OR (chart.link = 'AR' AND in_account_class = 2))
+ 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)
GROUP BY acc_trans.trans_id) p ON (a.id = p.trans_id)
LEFT JOIN "session" s ON (s."session_id" = t.locked_by)
@@ -350,7 +351,7 @@
AND NOT a.on_hold
AND EXISTS (select trans_id FROM acc_trans
WHERE trans_id = a.id AND
- chart_id = (SELECT id frOM chart
+ chart_id = (SELECT id from account
WHERE accno
= in_ar_ap_accno)
)))
Modified: trunk/sql/modules/test/Company.sql
===================================================================
--- trunk/sql/modules/test/Company.sql 2009-06-17 21:54:59 UTC (rev 2698)
+++ trunk/sql/modules/test/Company.sql 2009-06-18 16:27:16 UTC (rev 2699)
@@ -3,7 +3,7 @@
INSERT INTO test_result (test_name, success)
SELECT 'Saving Company',
- company_save (NULL, 'TESTING...', 1,'TESTING', 'TESTING', NULL, '1234')
+ company_save (NULL, 'TESTING...', 1,'TESTING', 'TESTING', NULL, '1234', 232)
IS NOT NULL;
Modified: trunk/sql/modules/test/Draft.sql
===================================================================
--- trunk/sql/modules/test/Draft.sql 2009-06-17 21:54:59 UTC (rev 2698)
+++ trunk/sql/modules/test/Draft.sql 2009-06-18 16:27:16 UTC (rev 2699)
@@ -1,20 +1,7 @@
BEGIN;
\i Base.sql
-
-INSERT INTO entity_credit_account (id, entity_id, entity_class, meta_number)
-SELECT '-1', min(id), 1, '_test vendor'
-FROM entity;
-
-INSERT INTO entity_credit_account (id, entity_id, entity_class, meta_number)
-SELECT '-2', min(id), 2, '_test customer'
-FROM entity;
-
-INSERT INTO chart (accno, description, charttype, category, link)
-VALUES ('00001', 'AP Test', 'A', 'L', 'AP');
-
-INSERT INTO chart (accno, description, charttype, category, link)
-VALUES ('00002', 'AR Test', 'A', 'A', 'AP');
-
+SELECT account_save(NULL, '00001', 'test only', 'A', NULL, NULL, FALSE, '{}');
+SELECT account_save(NULL, '00002', 'test only', 'A', NULL, NULL, FALSE, '{}');
INSERT INTO ap (invnumber, entity_credit_account, amount, netamount, paid,
approved, curr)
select '_TEST AP', min(id), '100', '100', '0', FALSE, 'USD'
@@ -22,8 +9,12 @@
INSERT INTO acc_trans (chart_id, trans_id, amount, approved)
SELECT id, currval('id'), '100', TRUE FROM chart WHERE accno = '00001';
+INSERT INTO ac_tax_form (entry_id, reportable)
+VALUES (currval('acc_trans_entry_id_seq')::int, true);
INSERT INTO acc_trans (chart_id, trans_id, amount, approved)
SELECT id, currval('id'), '-100', TRUE FROM chart WHERE accno = '00002';
+INSERT INTO ac_tax_form (entry_id, reportable)
+VALUES (currval('acc_trans_entry_id_seq')::int, false);
INSERT INTO ar (invnumber, entity_credit_account, amount, netamount, paid,
approved, curr)
@@ -54,6 +45,11 @@
WHERE reference = '_TEST AP';
INSERT INTO test_result(test_name, success)
+SELECT '"AP" delete successful (w/1099)', draft_delete(id)
+FROM draft__search('AP', NULL, NULL, NULL, NULL, NULL)
+WHERE reference = '_TEST AP';
+
+INSERT INTO test_result(test_name, success)
SELECT '"ar" search successful', count(*) = 1
FROM draft__search('ar', NULL, NULL, NULL, NULL, NULL)
WHERE reference = '_TEST AR';
Modified: trunk/t/43-dbtest.t
===================================================================
--- trunk/t/43-dbtest.t 2009-06-17 21:54:59 UTC (rev 2698)
+++ trunk/t/43-dbtest.t 2009-06-18 16:27:16 UTC (rev 2699)
@@ -5,7 +5,7 @@
plan skip_all => 'Skipping all. Told not to test db.';
}
else {
- plan tests => 95;
+ plan tests => 96;
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.