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

SF.net SVN: ledger-smb:[3538] trunk/sql



Revision: 3538
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3538&view=rev
Author:   einhverfr
Date:     2011-07-16 06:03:48 +0000 (Sat, 16 Jul 2011)

Log Message:
-----------
Menu permissions issues fixed wrt fixed assets..... a couple minor menu fixes and sql routine fixes re: depreciation

Modified Paths:
--------------
    trunk/sql/Pg-database.sql
    trunk/sql/modules/Assets.sql
    trunk/sql/modules/Roles.sql

Added Paths:
-----------
    trunk/sql/upgrade/3538-asset-menu-fix.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2011-07-16 03:38:29 UTC (rev 3537)
+++ trunk/sql/Pg-database.sql	2011-07-16 06:03:48 UTC (rev 3538)
@@ -2457,8 +2457,9 @@
 233	Search Assets	\N	2
 235	Import	229	2
 234	Depreciate	229	4
-236	Reports	229	10
 237	Net Book Value	236	1
+238	Disposal	229	5
+236	Reports	229	11
 \.
 
 --
@@ -3090,22 +3091,24 @@
 227	menu	1	616
 228	menu	1	617
 229	menu	1	618
-230	module	asset.pl	619
 230	action	asset_category_screen	620
-231	module	asset.pl	621
 231	action	asset_category_search	622
-232	module	asset.pl	623
 232	action	asset_screen	624
-233	module	asset.pl	625
 233	action	asset_search	626
 234	module	asset.pl	627
 234	action	new_report	628
-234	depreciate	1	629
 235	module	asset.pl	630
 235	action	import	631
 236	menu	1	632
 237	module	asset.pl	633
 237	action	display_nbv	634
+232	module	asset.pl	623
+230	module	asset.pl	619
+231	module	asset.pl	621
+233	module	asset.pl	625
+234	depreciation	1	629
+238	action	new_report	636
+238	module	asset.pl	635
 \.
 
 --

Modified: trunk/sql/modules/Assets.sql
===================================================================
--- trunk/sql/modules/Assets.sql	2011-07-16 03:38:29 UTC (rev 3537)
+++ trunk/sql/modules/Assets.sql	2011-07-16 06:03:48 UTC (rev 3538)
@@ -941,11 +941,12 @@
           ai.purchase_date, ai.location_id, ai.invoice_id, ai.asset_account_id,
           ai.dep_account_id, ai.asset_class_id, ai.start_depreciation,
           ai.salvage_value, ai.department_id, ai.exp_account_id, ai.obsolete_by
-   HAVING     2 <> ALL(as_array(ar.report_class)) 
-          and 4 <> ALL(as_array(ar.report_class))
+   HAVING (count(ar.report_class) = 0 OR    
+          (2 <> ALL(as_array(ar.report_class)) 
+          and 4 <> ALL(as_array(ar.report_class))))
           AND ((ai.purchase_value - coalesce(sum(arl.amount), 0) 
                > ai.salvage_value) and ai.obsolete_by is null)
-               OR $1 is not true
+               OR $1 is not true;
 $$ language sql;
 
 COMMENT ON FUNCTION asset_report__generate

Modified: trunk/sql/modules/Roles.sql
===================================================================
--- trunk/sql/modules/Roles.sql	2011-07-16 03:38:29 UTC (rev 3537)
+++ trunk/sql/modules/Roles.sql	2011-07-16 06:03:48 UTC (rev 3538)
@@ -1600,6 +1600,10 @@
 GRANT SELECT, UPDATE ON asset_class_id_seq
 TO "lsmb_<?lsmb dbname ?>__assets_administer";
 
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 237);
+
+
 CREATE ROLE "lsmb_<?lsmb dbname ?>__assets_enter" NOLOGIN INHERIT;
 
 GRANT ALL ON asset_item_id_seq TO "lsmb_<?lsmb dbname ?>__assets_enter";
@@ -1608,10 +1612,26 @@
 
 GRANT INSERT, SELECT ON asset_note TO "lsmb_<?lsmb dbname ?>__assets_enter";
 
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 230);
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 231);
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 232);
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 233);
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_enter', 'allow', 235);
+
 CREATE ROLE "lsmb_<?lsmb dbname ?>__assets_depreciate" NOLOGIN INHERIT;
 GRANT SELECT, INSERT ON asset_report, asset_report_line, asset_item, asset_class
 TO "lsmb_<?lsmb dbname ?>__assets_depreciate";
 
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_depreciate', 'allow', 238);
+INSERT INTO menu_acl(role_name, acl_type, node_id)
+values('lsmb_<?lsmb dbname ?>__assets_depreciate', 'allow', 234);
+
 CREATE ROLE "lsmb_<?lsmb dbname ?>__assets_approve" NOLOGIN INHERIT;
 GRANT SELECT ON asset_report, asset_report_line, asset_item, asset_class
 TO "lsmb_<?lsmb dbname ?>__assets_approve";

Added: trunk/sql/upgrade/3538-asset-menu-fix.sql
===================================================================
--- trunk/sql/upgrade/3538-asset-menu-fix.sql	                        (rev 0)
+++ trunk/sql/upgrade/3538-asset-menu-fix.sql	2011-07-16 06:03:48 UTC (rev 3538)
@@ -0,0 +1,11 @@
+UPDATE menu_attribute set attribute = 'depreciation' 
+ where attribute = 'depreciate';
+
+SELECT menu_insert(parent, position + 1, 'Disposal')
+  FROM menu_node 
+ WHERE label = 'Depreciate';
+
+INSERT INTO menu_attribute(attribute, value, node_id)
+     VALUES ('module', 'asset.pl', currval('menu_node_id_seq'));
+INSERT INTO menu_attribute(attribute, value, node_id)
+     VALUES ('action', 'new_report', currval('menu_node_id_seq'));


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