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

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



Revision: 6433
          http://sourceforge.net/p/ledger-smb/code/6433
Author:   einhverfr
Date:     2014-01-10 11:06:54 +0000 (Fri, 10 Jan 2014)
Log Message:
-----------
Asset class search on 1.4 framework

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Asset_Class.pm
    trunk/LedgerSMB/Scripts/asset.pm
    trunk/UI/asset/search_class.html

Added Paths:
-----------
    trunk/LedgerSMB/Report/Listings/Asset_Class.pm

Modified: trunk/LedgerSMB/DBObject/Asset_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset_Class.pm	2014-01-10 10:06:20 UTC (rev 6432)
+++ trunk/LedgerSMB/DBObject/Asset_Class.pm	2014-01-10 11:06:54 UTC (rev 6433)
@@ -17,7 +17,7 @@
 
 Integer ID of record.
 
-=item lable
+=item label
 
 Text description of asset class
 

Added: trunk/LedgerSMB/Report/Listings/Asset_Class.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/Asset_Class.pm	                        (rev 0)
+++ trunk/LedgerSMB/Report/Listings/Asset_Class.pm	2014-01-10 11:06:54 UTC (rev 6433)
@@ -0,0 +1,130 @@
+=head1 NAME
+
+LedgerSMB::Report::Listings::Asset_Class - Asset Class listings for LedgerSMB
+
+=head1 SYNPOSIS
+
+ LedgerSMB::Report::Listings::Asset_Class->new(%$request)->render($request);
+
+=cut
+
+package LedgerSMB::Report::Listings::Asset_Class;
+use Moose;
+extends 'LedgerSMB::Report';
+
+=head1 CRITERIA PROPERTIES
+
+=head2 label
+
+Partial match for asset class label
+
+=head2 method
+
+Exact match for method, by id, int
+
+=head2 asset_account_id 
+
+id for asset account id, exact match
+
+=head2 dep_account_id 
+
+id for depreciation account id, exact match
+
+=cut
+
+has label             => (is => 'ro', isa => 'Str', required => 0);
+has method            => (is => 'ro', isa => 'Int', required => 0);
+has asset_account_id  => (is => 'ro', isa => 'Int', required => 0);
+has dep_account_id    => (is => 'ro', isa => 'Int', required => 0);
+
+=head1 CONSTANT METHODS
+
+=head2 columns
+
+=over
+
+=item id
+
+=item label
+
+=item method
+
+=item asset_description
+
+=item dep_description
+
+=back
+
+=cut
+
+sub columns {
+    return [ 
+   {  col_id => 'id',
+        name => LedgerSMB::Report::text('ID'),
+        type => 'text' },
+   {  col_id => 'label',
+        name =>  LedgerSMB::Report::text('Label'),
+        type => 'href',
+   href_base => 'asset.pl?action=edit_asset_class&id=', },
+  {   col_id => 'method',
+        name => LedgerSMB::Report::text('Depreciation Method'),
+        type => 'text' },
+   {  col_id => 'asset_description',
+        name => LedgerSMB::Report::text('Asset Account'),
+        type => 'text' },
+   {  col_id => 'dep_description',
+        name => LedgerSMB::Report::text('Depreciation Account'),
+        type => 'text' },
+   ];
+}
+
+=head2 header_lines
+
+Label and method
+
+=cut
+
+sub header_lines {
+    return [
+       {name => 'label', 
+        text => LedgerSMB::Report::text('Label') },
+       {name => 'method',
+        text => LedgerSMB::Report::text('Depreciation Method') },
+    ];
+}
+
+
+=head2 name
+
+Asset Class List
+
+=cut
+
+sub name { return LedgerSMB::Report::text('Asset Class List') };
+
+=head1 METHODS
+
+=head2 run_report
+
+Populates rows.
+
+=cut
+
+sub run_report {
+    my ($self, $request) = @_;
+    my @rows = $self->exec_method(funcname => 'asset_class__search');
+    for my $r (@rows){
+        $r->{row_id} = $r->{id};
+    }
+    $self->rows(\@rows);
+}
+
+=head1 COPYRIGHT
+
+Copyright(C) 2014 The LedgerSMB Core Team.  This file may be re-used under the
+terms of the GNU General Public License version 2 or at your option any later 
+version.  Please see the included LICENSE.txt for details.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;

Modified: trunk/LedgerSMB/Scripts/asset.pm
===================================================================
--- trunk/LedgerSMB/Scripts/asset.pm	2014-01-10 10:06:20 UTC (rev 6432)
+++ trunk/LedgerSMB/Scripts/asset.pm	2014-01-10 11:06:54 UTC (rev 6433)
@@ -20,6 +20,7 @@
 use LedgerSMB::DBObject::Asset;
 use LedgerSMB::DBObject::Asset_Report;
 use LedgerSMB::Report::Assets::Net_Book_Value;
+use LedgerSMB::Report::Listings::Asset_Class;
 use strict;
 
 our @file_columns = qw(tag purchase_date description asset_class location vendor 
@@ -153,60 +154,7 @@
 
 sub asset_category_results {
     my ($request) = @_;
-    my $ac = LedgerSMB::DBObject::Asset_Class->new(base => $request);
-    my @classes = $ac->list_asset_classes();
-    my $locale = $request->{_locale};
-    $ac->get_metadata;
-    my $template = LedgerSMB::Template->new(
-        user =>$request->{_user}, 
-        locale => $request->{_locale},
-        path => 'UI',
-        template => 'form-dynatable',
-        format => 'HTML'
-    );
-    my $columns;
-    @$columns = qw(id label dep_method asset_account dep_account);
-    my $heading = {
-         id            => $locale->text('ID'),
-         label         => $locale->text('Description'),
-         asset_account => $locale->text('Asset Account'),
-         dep_account   => $locale->text('Depreciation Account'),
-         dep_method    => $locale->text('Depreciation Method')
-    };
-
-    my $rows = [];
-    my $a_accs = {};
-    for my $a_acc (@{$ac->{asset_accounts}}){
-        $a_accs->{$a_acc->{id}} = $a_acc;
-    }
-    my $d_accs = {};
-    for my $d_acc (@{$ac->{dep_accounts}}){
-        $d_accs->{$d_acc->{id}} = $d_acc;
-    }
-    for my $aclass (@{$ac->{classes}}) {
-        print STDERR "$aclass\n";
-        my $a_acc = $a_accs->{$aclass->{asset_account_id}};
-        my $d_acc = $d_accs->{$aclass->{dep_account_id}};
-        my $href = "asset.pl?action=edit_asset_class";
-        my $row = {
-             id            => $aclass->{id},
-             label         => {
-                               text => $aclass->{label},
-                               href => "$href&id=$aclass->{id}",
-                              },
-             dep_method    => $aclass->{dep_method},
-             life_unit     => $aclass->{life_unit}, 
-             asset_account => $a_acc->{text},
-             dep_account   => $d_acc->{text},
-		};
-        push @$rows, $row;
-    }
-    $template->render({
-         form    => $ac,
-         heading => $heading,
-         rows    => $rows,
-         columns => $columns,
-   });
+    LedgerSMB::Report::Listings::Asset_Class->new(%$request)->render($request);
 }
 
 =item edit_asset_class

Modified: trunk/UI/asset/search_class.html
===================================================================
--- trunk/UI/asset/search_class.html	2014-01-10 10:06:20 UTC (rev 6432)
+++ trunk/UI/asset/search_class.html	2014-01-10 11:06:54 UTC (rev 6433)
@@ -1,5 +1,6 @@
 <?lsmb INCLUDE 'ui-header.html' ?>
 <?lsmb PROCESS 'elements.html' ?>
+<body class="<?lsmb dojo_theme ?>">
 <div class="listtop"><?lsmb text('Search Asset Class') ?></div>
 <form action="<?lsmb script ?>" method="post">
 <div class="inputrow" id="labelrow">

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits