[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4916] addons/1.3/enhanced_tb/trunk/sql/modules/ enhanced_tb/menu2.sql
- Subject: SF.net SVN: ledger-smb:[4916] addons/1.3/enhanced_tb/trunk/sql/modules/ enhanced_tb/menu2.sql
- From: ..hidden..
- Date: Mon, 18 Jun 2012 13:52:41 +0000
Revision: 4916
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4916&view=rev
Author: einhverfr
Date: 2012-06-18 13:52:40 +0000 (Mon, 18 Jun 2012)
Log Message:
-----------
Alternative menu that does not remove previous trial balance for comparison and testing
Added Paths:
-----------
addons/1.3/enhanced_tb/trunk/sql/modules/enhanced_tb/menu2.sql
Added: addons/1.3/enhanced_tb/trunk/sql/modules/enhanced_tb/menu2.sql
===================================================================
--- addons/1.3/enhanced_tb/trunk/sql/modules/enhanced_tb/menu2.sql (rev 0)
+++ addons/1.3/enhanced_tb/trunk/sql/modules/enhanced_tb/menu2.sql 2012-06-18 13:52:40 UTC (rev 4916)
@@ -0,0 +1,67 @@
+-- Create the trial balance menu entries.
+
+BEGIN;
+
+CREATE OR REPLACE FUNCTION enhanced_trial_balance_menu () RETURNS int AS $body$
+
+ DECLARE
+ v_tb_node int;
+ v_tb_attr_node int;
+
+ v_new_id int;
+ v_reports_id int;
+ BEGIN
+
+ SELECT max(id) + 1
+ INTO v_tb_node
+ FROM menu_node;
+
+ DELETE FROM menu_attribute WHERE node_id = v_tb_node;
+ INSERT INTO menu_attribute (node_id, attribute, value )
+ VALUES (v_tb_node, 'menu', 1)
+ RETURNING id INTO v_tb_attr_node;
+
+ INSERT INTO menu_node (label, parent, position)
+ VALUES ('New', v_tb_node, 2)
+ RETURNING id INTO v_new_id;
+
+ INSERT INTO menu_node (label, parent, position)
+ VALUES ('Reports', v_tb_node, 1)
+ RETURNING id INTO v_reports_id;
+
+ /*
+ Set up the control structire for the menu attribute stuff.
+
+ First, new. We need:
+ * action
+ * module (code file)
+
+ */
+
+ INSERT INTO menu_attribute (node_id, attribute, value)
+ VALUES (v_new_id, 'action', 'new');
+
+ INSERT INTO menu_attribute (node_id, attribute, value)
+ VALUES (v_new_id, 'module', 'trial_balance.pl');
+
+
+ /* Then the reports */
+
+ INSERT INTO menu_attribute (node_id, attribute, value)
+ VALUES (v_reports_id, 'action', 'reports');
+
+ INSERT INTO menu_attribute (node_id, attribute, value)
+ VALUES (v_reports_id, 'module', 'trial_balance.pl');
+
+ RETURN 1;
+
+ END;
+$body$ LANGUAGE PLPGSQL;
+
+SELECT * FROM enhanced_trial_balance_menu ();
+
+DROP FUNCTION enhanced_trial_balance_menu ();
+
+SELECT 'Commit if 2 records.';
+
+SELECT ma.* FROM menu_attribute ma, menu_node p, menu_node c WHERE ma.node_id = c.id AND (p.id = c.parent AND p.label = 'Trial Balance') group by ma.id, ma.node_id, ma.attribute, ma.value;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.