[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4394] trunk
- Subject: SF.net SVN: ledger-smb:[4394] trunk
- From: ..hidden..
- Date: Wed, 07 Mar 2012 04:58:45 +0000
Revision: 4394
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4394&view=rev
Author: einhverfr
Date: 2012-03-07 04:58:45 +0000 (Wed, 07 Mar 2012)
Log Message:
-----------
LedgerSMB module framework added
Modified Paths:
--------------
trunk/UI/business_units/list_classes.html
trunk/sql/modules/Business_Unit.sql
trunk/sql/modules/Roles.sql
Added Paths:
-----------
trunk/LedgerSMB/DBObject/App_Module.pm
trunk/sql/modules/App_Module.sql
Added: trunk/LedgerSMB/DBObject/App_Module.pm
===================================================================
--- trunk/LedgerSMB/DBObject/App_Module.pm (rev 0)
+++ trunk/LedgerSMB/DBObject/App_Module.pm 2012-03-07 04:58:45 UTC (rev 4394)
@@ -0,0 +1,98 @@
+=head1 NAME
+
+LedgerSMB::DBObject::App_Module -- Application Module Lists for LedgerSMB
+
+=head1 SYNOPSYS
+
+Application modules, new to LedgerSMB 1.4, are ways to categorize functionality in
+LedgerSMB. In future versions, these may be important to security management and the
+like. However at present they are mostly available to tie various reporting entries
+to various parts of the software.
+
+Note that modules are generally read-only and not expected to be saved in the system.
+
+The id attribute is expected to be static and hardcoded, so these must be assigned.
+
+A default module (id 0, label '') is available for doing lookups.
+
+=head1 INHERITS
+
+=over
+
+=item LedgerSMB::DBObject_Moose
+
+=back
+
+=cut
+
+package LedgerSMB::DBObject::App_Module;
+use Moose;
+extends 'LedgerSMB::DBObject_Moose';
+
+=head1 PROPERTIES
+
+=over
+
+=item int id
+
+This is the internal system id of the module.
+
+=cut
+
+has 'id' => (is => 'ro', isa => 'Int', default => '0');
+
+=item string label
+
+This is the human readable label.
+
+=cut
+
+has 'label' => (is => 'ro', isa => 'Str', default => '');
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item get($id)
+
+This retrieves a single module by id, and returns it.
+
+=cut
+
+sub get {
+ my ($self, $id) = @_;
+ my ($ref) = $self->call_procedure(procname => 'lsmb_module__get', args => [$id]);
+ $self->prepare_dbhash($ref);
+ return $self->new($ref);
+}
+
+=item list_all()
+
+This returns a list of all modules, ordered by id.
+
+=cut
+
+sub list_all{
+ my ($self) = @_;
+ my @results = $self->call_procedure(procname => 'lsmb_module__list');
+ for my $ref(@results){
+ $self->prepare_dbhash($ref);
+ $ref = $self->new($ref);
+ }
+ return @results;
+}
+
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012, The LedgerSMB Core Team. This file may be reused under the terms of
+the GNU General Public License, version 2, or at your option any later version. See
+the included LICENSE.txt for details.
+
+=cut
+
+return 1;
Modified: trunk/UI/business_units/list_classes.html
===================================================================
--- trunk/UI/business_units/list_classes.html 2012-03-07 03:14:09 UTC (rev 4393)
+++ trunk/UI/business_units/list_classes.html 2012-03-07 04:58:45 UTC (rev 4394)
@@ -10,8 +10,10 @@
<th><?lsmb text('ID') ?></th>
<th><?lsmb text('Label') ?></th>
<th><?lsmb text('Active') ?></th>
- <th><?lsmb text('Non-Accounting') ?></th>
<th><?lsmb text('Ordering') ?></th>
+ <?lsmb FOR mod IN modules ?>
+ <th><?lsmb text(mod.label) ?></th>
+ <?lsmb END ?>
<th> </th>
<th> </th>
</tr>
@@ -57,6 +59,21 @@
size = 4
} ?>
</td>
+ <?lsmb FOR mod IN modules ?>
+ <td><?lsmb
+ IF c.modules.grep(mod.id);
+ checked = 'checked';
+ ELSE;
+ checked = '';
+ END;
+ PROCESS input element_data = {
+ type = 'checkbox'
+ checked = checked
+ name = "module_" _ mod.id
+ value = 1
+ } ?> </td>
+ <?lsmb END ?>
+ <!-- TODO: Add modules perms here -->
<td><?lsmb PROCESS button element_data = {
type = "submit"
class = "submit"
Added: trunk/sql/modules/App_Module.sql
===================================================================
--- trunk/sql/modules/App_Module.sql (rev 0)
+++ trunk/sql/modules/App_Module.sql 2012-03-07 04:58:45 UTC (rev 4394)
@@ -0,0 +1,15 @@
+BEGIN;
+
+CREATE OR REPLACE FUNCTION lsmb_module__get(in_id int) RETURNS lsmb_module AS
+$$ SELECT * FROM lsmb_module where id = $1; $$ LANGUAGE SQL;
+
+COMMENT ON FUNCTION lsmb_module__get(in_id int) IS
+$$ Retrieves a single module's info by id. $$; --'
+
+CREATE OR REPLACE FUNCTION lsmb_module__list() RETURNS SETOF lsmb_module AS
+$$ SELECT * FROM lsmb_module ORDER BY id $$ LANGUAGE SQL;
+
+COMMENT ON FUNCTION lsmb_module__list() IS
+$$ Returns a list of all defined modules, ordered by id. $$;
+
+COMMIT;
Modified: trunk/sql/modules/Business_Unit.sql
===================================================================
--- trunk/sql/modules/Business_Unit.sql 2012-03-07 03:14:09 UTC (rev 4393)
+++ trunk/sql/modules/Business_Unit.sql 2012-03-07 04:58:45 UTC (rev 4394)
@@ -103,7 +103,7 @@
$$;
CREATE OR REPLACE FUNCTION business_unit_class__save
-(in_id int, in_label text, in_active bool, in_non_accounting bool, in_ordering int)
+(in_id int, in_label text, in_active bool, in_ordering int)
RETURNS business_unit_class AS
$$
DECLARE retval business_unit_class;
@@ -114,14 +114,13 @@
UPDATE business_unit_class
SET label = in_label,
active = in_active,
- ordering = in_ordering,
- non_accounting = in_non_accounting
+ ordering = in_ordering
WHERE id = in_id;
IF NOT FOUND THEN
- INSERT INTO business_unit_class (label, active, non_accounting, ordering)
- VALUES (in_label, in_active, in_non_accounting, in_ordering);
+ INSERT INTO business_unit_class (label, active, ordering)
+ VALUES (in_label, in_active, in_ordering);
t_id := currval('business_unit_class_id_seq');
Modified: trunk/sql/modules/Roles.sql
===================================================================
--- trunk/sql/modules/Roles.sql 2012-03-07 03:14:09 UTC (rev 4393)
+++ trunk/sql/modules/Roles.sql 2012-03-07 04:58:45 UTC (rev 4394)
@@ -1750,6 +1750,8 @@
GRANT SELECT ON asset_dep_method TO public;
-- Grants to all users;
+GRANT SELECT ON lsmb_module TO public; -- everyone needs to read this table and nothing
+-- sensitive in that table.
GRANT SELECT ON makemodel TO public;
GRANT SELECT ON custom_field_catalog TO public;
GRANT SELECT ON custom_table_catalog TO public;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.