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

SF.net SVN: ledger-smb:[4769] trunk/LedgerSMB/DBObject_Moose.pm



Revision: 4769
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4769&view=rev
Author:   einhverfr
Date:     2012-05-24 06:35:51 +0000 (Thu, 24 May 2012)
Log Message:
-----------
prepare_dbhash no longer requires a full 'chain of custody' back to the initial request.  Simpler, more modular code. ++'

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject_Moose.pm

Modified: trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- trunk/LedgerSMB/DBObject_Moose.pm	2012-05-24 06:04:11 UTC (rev 4768)
+++ trunk/LedgerSMB/DBObject_Moose.pm	2012-05-24 06:35:51 UTC (rev 4769)
@@ -58,16 +58,19 @@
 has '_roles' => (is => 'ro', isa => 'ArrayRef[Str]', required => '1');
 has '_user' => (is => 'ro', isa => 'LedgerSMB::User', required => '1');
 has '_locale' => (is => 'ro', isa => 'LedgerSMB::Locale', required => '1');
-has '_request' => (is => 'ro', isa => 'CGI::Simple', required => '1');
 
 sub prepare_dbhash {
     my $self = shift;
     my $target = shift;
-    for my $att (qw(dbh _roles _user _locale _request)){
+    for my $att (qw(_roles _user _locale)){
+        my $t_att = $att;
+        $att =~ s/^\_//;
+        $att = ucfirst($att);
         if (!$target->{$att}){
-           $target->{$att} = $self->{$att};
+           $target->{$t_att} = ${"LedgerSMB::App_State::$att"};
         }
     }
+    $target->{dbh} = $LedgerSMB::App_State::DBH;
 }
 
 # _to_dbobject 

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