[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4404] trunk
- Subject: SF.net SVN: ledger-smb:[4404] trunk
- From: ..hidden..
- Date: Wed, 07 Mar 2012 12:49:46 +0000
Revision: 4404
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4404&view=rev
Author: einhverfr
Date: 2012-03-07 12:49:46 +0000 (Wed, 07 Mar 2012)
Log Message:
-----------
Saving module settings for business reporting unit classes now works. Now to add to the UI for AR/AP/GL
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
trunk/LedgerSMB/Scripts/business_unit.pm
trunk/UI/business_units/list_classes.html
trunk/sql/modules/Roles.sql
Modified: trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-03-07 11:57:29 UTC (rev 4403)
+++ trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-03-07 12:49:46 UTC (rev 4404)
@@ -14,6 +14,7 @@
package LedgerSMB::DBObject::Business_Unit_Class;
use Moose;
use LedgerSMB::DBObject_Moose;
+use LedgerSMB::DBObject::App_Module;
extends 'LedgerSMB::DBObject_Moose';
=head1 PROPERTIES
@@ -56,7 +57,9 @@
=cut
-has 'modules' => (is => 'rw', isa => 'ArrayRef[LedgerSMB::DBObject::App_Module]');
+has 'modules' => (is => 'rw',
+ isa => 'ArrayRef[LedgerSMB::DBObject::App_Module]'
+);
=item ordering
@@ -85,8 +88,12 @@
args => [$id]
);
my $ref = shift @classes;
+ my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
+ args => [$id]
+ );
$self->prepare_dbhash($ref);
- return $self->new(shift @classes);
+ my $class = $self->new(shift @classes);
+ $class->modules(..hidden..);
}
=item save
@@ -136,6 +143,14 @@
for my $class (@classes){
$self->prepare_dbhash($class);
$class = $self->new(%$class);
+ my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
+ args => [$class->id]
+ );
+ for my $m (@modules){
+ $self->prepare_dbhash($m);
+ $m = LedgerSMB::DBObject::App_Module->new($m);
+ }
+ $class->modules(..hidden..);
}
return @classes;
}
Modified: trunk/LedgerSMB/Scripts/business_unit.pm
===================================================================
--- trunk/LedgerSMB/Scripts/business_unit.pm 2012-03-07 11:57:29 UTC (rev 4403)
+++ trunk/LedgerSMB/Scripts/business_unit.pm 2012-03-07 12:49:46 UTC (rev 4404)
@@ -208,13 +208,21 @@
sub save_class {
my ($request) = @_;
- $request->debug({file => '/tmp/search'});
+ my $lsmb_modules = LedgerSMB::DBObject::App_Module->new(%$request);
+ my @modules = $lsmb_modules->list;
+ my $modlist = [];
+ for my $mod (@modules){
+ if ($request->{"module_" . $mod->id}){
+ push @$modlist, $mod;
+ }
+ }
for my $key (qw(active non_accounting)){
if (!$request->{$key}){
$request->{$key} = 0;
}
}
my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
+ $bu_class->modules($modlist);
$bu_class->save;
list_classes($request);
}
Modified: trunk/UI/business_units/list_classes.html
===================================================================
--- trunk/UI/business_units/list_classes.html 2012-03-07 11:57:29 UTC (rev 4403)
+++ trunk/UI/business_units/list_classes.html 2012-03-07 12:49:46 UTC (rev 4404)
@@ -54,10 +54,11 @@
</td>
<?lsmb FOREACH m IN modules ?>
<td><?lsmb
- IF c.modules.grep(m.id);
- checked = 'checked';
- ELSE;
- checked = '';
+ checked = undef;
+ FOREACH mm IN c.modules;
+ IF mm.id == m.id;
+ checked = 'checked';
+ END;
END;
PROCESS input element_data = {
type = 'checkbox'
Modified: trunk/sql/modules/Roles.sql
===================================================================
--- trunk/sql/modules/Roles.sql 2012-03-07 11:57:29 UTC (rev 4403)
+++ trunk/sql/modules/Roles.sql 2012-03-07 12:49:46 UTC (rev 4404)
@@ -24,7 +24,7 @@
CREATE ROLE "lsmb_<?lsmb dbname ?>__business_units_manage"
WITH INHERIT NOLOGIN;
-GRANT INSERT, UPDATE, DELETE ON business_unit_class, business_unit
+GRANT INSERT, UPDATE, DELETE ON business_unit_class, business_unit, bu_class_to_module
TO "lsmb_<?lsmb dbname ?>__business_units_manage";
GRANT SELECT ON business_unit_class, business_unit TO PUBLIC;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.