[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4770] trunk
- Subject: SF.net SVN: ledger-smb:[4770] trunk
- From: ..hidden..
- Date: Thu, 24 May 2012 06:57:33 +0000
Revision: 4770
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4770&view=rev
Author: einhverfr
Date: 2012-05-24 06:57:33 +0000 (Thu, 24 May 2012)
Log Message:
-----------
Now empty column lists mean show all columns
Also changed App_State and DBObject_Moose so that global properties are now global
Modified Paths:
--------------
trunk/LedgerSMB/App_State.pm
trunk/LedgerSMB/DBObject/Report.pm
trunk/LedgerSMB/DBObject_Moose.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB.pm
Modified: trunk/LedgerSMB/App_State.pm
===================================================================
--- trunk/LedgerSMB/App_State.pm 2012-05-24 06:35:51 UTC (rev 4769)
+++ trunk/LedgerSMB/App_State.pm 2012-05-24 06:57:33 UTC (rev 4770)
@@ -63,6 +63,23 @@
our $DBH;
+
+=item Roles
+
+This is a list (array) of role names for the current user.
+
+=cut
+
+our @Roles;
+
+=item Role_Prefix
+
+String of the beginning of the role.
+
+=cut
+
+our $Role_Prefix;
+
=back
=head1 METHODS
@@ -93,6 +110,8 @@
$User = undef;
$Locale = undef;
$DBH = undef;
+ @Roles = ();
+ $Role_Prefix = undef;
}
=item cleanup
@@ -114,6 +133,8 @@
$SODA = {};
$Company_Settings = {};
$DBH = undef;
+ @Roles = ();
+ $Role_Prefix = undef;
}
1;
Modified: trunk/LedgerSMB/DBObject/Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report.pm 2012-05-24 06:35:51 UTC (rev 4769)
+++ trunk/LedgerSMB/DBObject/Report.pm 2012-05-24 06:57:33 UTC (rev 4770)
@@ -161,6 +161,9 @@
push @retval, $ref;
}
}
+ if (scalar @retval == 0){
+ @retval = @{$self->columns};
+ }
return ..hidden..;
}
Modified: trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- trunk/LedgerSMB/DBObject_Moose.pm 2012-05-24 06:35:51 UTC (rev 4769)
+++ trunk/LedgerSMB/DBObject_Moose.pm 2012-05-24 06:57:33 UTC (rev 4770)
@@ -1,12 +1,11 @@
-
-
=head1 NAME
-LedgerSMB::DBObject - LedgerSMB class for building objects from db relations
+LedgerSMB::DBObject_Moose - LedgerSMB class for building objects from db
+relations, now with Moose!
=head1 SYOPSIS
-This module creates object instances based on LedgerSMB's in-database ORM.
+This module creates object instances based on LedgerSMB's in-database ORM, using Moose.
=head1 METHODS
@@ -74,7 +73,7 @@
}
# _to_dbobject
-#Private method used to convert to db object for purposes of
+#Private method used to convert to db object for purposes of function wrapping
#
sub _to_dbobject {
my $self = shift @_;
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2012-05-24 06:35:51 UTC (rev 4769)
+++ trunk/LedgerSMB/Form.pm 2012-05-24 06:57:33 UTC (rev 4770)
@@ -1276,6 +1276,17 @@
push @{$self->{_roles}}, $roles[0];
}
+ $sth = $self->{dbh}->prepare("
+ SELECT value FROM defaults
+ WHERE setting_key = 'role_prefix'");
+ $sth->execute;
+
+ ($self->{_role_prefix}) = $sth->fetchrow_array;
+ $LedgerSMB::App_State::Roles = @{$self->{_roles}};
+ $LedgerSMB::App_State::Role_Prefix = $self->{_role_prefix};
+ # Expect @{$self->{_roles}} to go away sometime during 1.4/1.5 development
+ # -CT
+
$sth = $dbh->prepare('SELECT check_expiration()');
$sth->execute;
($self->{warn_expire}) = $sth->fetchrow_array;
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2012-05-24 06:35:51 UTC (rev 4769)
+++ trunk/LedgerSMB.pm 2012-05-24 06:57:33 UTC (rev 4770)
@@ -361,6 +361,7 @@
LedgerSMB::Company_Config::initialize($self);
#TODO move before _db_init to avoid _db_init with invalid session?
+ # Can't do that: Company_Config has to pull company data from the db --CT
if ($self->is_run_mode('cgi', 'mod_perl') and !$ENV{LSMB_NOHEAD}) {
#check for valid session unless this is an inital authentication
#request -- CT
@@ -938,6 +939,11 @@
while (my @roles = $sth->fetchrow_array){
push @{$self->{_roles}}, $roles[0];
}
+
+ $LedgerSMB::App_State::Roles = @{$self->{_roles}};
+ $LedgerSMB::App_State::Role_Prefix = $self->{_role_prefix};
+ # @{$self->{_roles}} will eventually go away. --CT
+
$sth->finish();
$logger->debug("end");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.