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

SF.net SVN: ledger-smb:[2661] trunk/sql/Pg-database.sql



Revision: 2661
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2661&view=rev
Author:   einhverfr
Date:     2009-06-12 17:59:56 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Restoring test cases to working order

Modified Paths:
--------------
    trunk/sql/Pg-database.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2009-06-12 17:57:49 UTC (rev 2660)
+++ trunk/sql/Pg-database.sql	2009-06-12 17:59:56 UTC (rev 2661)
@@ -40,6 +40,11 @@
 SELECT id, accno, description, 'H' as charttype, NULL as category, NULL as link, NULL as account_heading, null as gifi_accno, false as contra from account_heading UNION
 select c.id, c.accno, c.description, 'A' as charttype, c.category, concat_colon(l.description) as link, heading, gifi_accno, contra from account c left join account_link l ON (c.id = l.account_id) group by c.id, c.accno, c.description, c.category, c.heading, c.gifi_accno, c.contra;
 
+CREATE RULE chart_i AS ON INSERT TO chart
+DO INSTEAD
+SELECT CASE WHEN new.charttype='H' THEN account_heading_save(new.id, new.accno, new.description, NULL)
+ELSE account_save(new.id, new.accno, new.description, new.category, new.gifi_accno, NULL, CASE WHEN new.contra IS NULL THEN FALSE ELSE new.contra END, string_to_array(new.link, ':'))
+END;
 --
 -- pricegroup added here due to references
 CREATE TABLE pricegroup (


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