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

SF.net SVN: ledger-smb:[4338] trunk



Revision: 4338
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4338&view=rev
Author:   einhverfr
Date:     2012-02-20 07:22:51 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Business Unit Classes now display

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Business_Unit.pm
    trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
    trunk/LedgerSMB/DBObject_Moose.pm
    trunk/LedgerSMB/Scripts/business_unit.pm
    trunk/UI/business_units/list_classes.html

Modified: trunk/LedgerSMB/DBObject/Business_Unit.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit.pm	2012-02-20 06:48:22 UTC (rev 4337)
+++ trunk/LedgerSMB/DBObject/Business_Unit.pm	2012-02-20 07:22:51 UTC (rev 4338)
@@ -178,4 +178,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 1;

Modified: trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit_Class.pm	2012-02-20 06:48:22 UTC (rev 4337)
+++ trunk/LedgerSMB/DBObject/Business_Unit_Class.pm	2012-02-20 07:22:51 UTC (rev 4338)
@@ -108,8 +108,9 @@
 
 sub list {
     my ($self) = @_;
-    my @classes = $self->exec_method({funcname => 'business_unit_class__list'});
+    my @classes = $self->exec_method({funcname => 'business_unit__list_classes'});
     for my $class (@classes){
+        $self->prepare_dbhash($class);
         $class = $self->new(%$class);
     }
     return @classes;
@@ -159,4 +160,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 1;

Modified: trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- trunk/LedgerSMB/DBObject_Moose.pm	2012-02-20 06:48:22 UTC (rev 4337)
+++ trunk/LedgerSMB/DBObject_Moose.pm	2012-02-20 07:22:51 UTC (rev 4338)
@@ -56,7 +56,17 @@
 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)){
+        if (!$target->{$att}){
+           $target->{$att} = $self->{$att};
+        }
+    }
+}
 
+
 my $logger = Log::Log4perl->get_logger('LedgerSMB::DBObject');
 
 sub __validate__ {}
@@ -428,6 +438,8 @@
    $self->error($self->{dbh}->state . ":" . $self->{dbh}->errstr);
 }
 
+__PACKAGE__->meta->make_immutable;
+
 1;
 
 =back

Modified: trunk/LedgerSMB/Scripts/business_unit.pm
===================================================================
--- trunk/LedgerSMB/Scripts/business_unit.pm	2012-02-20 06:48:22 UTC (rev 4337)
+++ trunk/LedgerSMB/Scripts/business_unit.pm	2012-02-20 07:22:51 UTC (rev 4338)
@@ -28,6 +28,11 @@
     my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
     @{$request->{classes}} = $bu_class->list;
     my $template = LedgerSMB::Template->new(
+        user =>$request->{_user},
+        locale => $request->{_locale},
+        path => 'UI/business_units',
+        template => 'list_classes',
+        format => 'HTML'
     );
     $template->render($request);
 }

Modified: trunk/UI/business_units/list_classes.html
===================================================================
--- trunk/UI/business_units/list_classes.html	2012-02-20 06:48:22 UTC (rev 4337)
+++ trunk/UI/business_units/list_classes.html	2012-02-20 07:22:51 UTC (rev 4338)
@@ -14,11 +14,11 @@
     <th><?lsmb text('Ordering') ?></th>
     <th>&nbsp;</th>
 </tr>
-<?lsmb push classes, {}; 
+<?lsmb classes.push({}); 
        FOR c IN classes 
 ?>
 <form action="<?lsmb script ?>" method=POST id="edit-<?lsmb c.id ?>">
-<tr class="row<?lsmb LOOP%2?>">
+<tr class="row<?lsmb LOOP % 2 ?>">
 <td><?lsmb c.id ?>
 <?lsmb PROCESS input element_data = {
     type = "hidden"
@@ -63,7 +63,7 @@
    value = "save"
     text = (c.id) ? text('Save') : text('Add')
 };
-<?lsmb PROCESS button element_data = {
+PROCESS button element_data = {
     type = "submit"
    class = "submit"
     name = "action"

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