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

SF.net SVN: ledger-smb:[2863] addons/1.3/assets/trunk



Revision: 2863
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2863&view=rev
Author:   einhverfr
Date:     2010-02-08 04:05:12 +0000 (Mon, 08 Feb 2010)

Log Message:
-----------
missed changes for approval

Modified Paths:
--------------
    addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm
    addons/1.3/assets/trunk/scripts/asset.pl
    addons/1.3/assets/trunk/sql/modules/Assets.sql

Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm	2010-02-07 23:43:56 UTC (rev 2862)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm	2010-02-08 04:05:12 UTC (rev 2863)
@@ -53,6 +53,11 @@
     }
 }
 
+sub search {
+    my ($self) = @_;
+    return $self->exec_method(funcname => 'asset_report__search');
+}
+
 sub get_metadata {
     my ($self) = @_;
     @{$self->{asset_classes}} = $self->exec_method(

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2010-02-07 23:43:56 UTC (rev 2862)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2010-02-08 04:05:12 UTC (rev 2863)
@@ -106,7 +106,6 @@
 		};
         push @$rows, $row;
     }
-    print STDERR "$#rows rows\n";
     $template->render({
          form    => $ac,
          heading => $heading,
@@ -407,6 +406,7 @@
     my $locale = $request->{_locale};
     my $ar = LedgerSMB::DBObject::Asset_Report->new(base => $request);
     $ar->get_metadata;
+    $ar->{title} = $locale->text('Report Results');
     my @results = $ar->search;
     my $cols = [];
     @$cols = qw(select id report_date type asset_class entered_at 
@@ -416,8 +416,8 @@
                report_date => $locale->text('Date'),
                       type => $locale->text('Type'),
                asset_class => $locale->text('Asset Class'),
-                entered_at => $locale->type('Entered at'),
-               approved_at => $locale->type('Approved at'),
+                entered_at => $locale->text('Entered at'),
+               approved_at => $locale->text('Approved at'),
     };
     my $rows = [];
     my $hiddens = {};
@@ -442,10 +442,11 @@
             }
         }
         if ($r->{depreciation}){
-           $r->{type} = $locale->text('Depreciation');
+           $ref->{type} = $locale->text('Depreciation');
         } else {
-           $r->{type} = $locale->text('Disposal');
+           $ref->{type} = $locale->text('Disposal');
         }
+        push @$rows, $ref;
         ++$count;
     }
     my $buttons = [{
@@ -455,6 +456,21 @@
                    action => 'approve'
                    },
     ];
+    my $template = LedgerSMB::Template->new(
+        user =>$request->{_user}, 
+        locale => $request->{_locale},
+        path => 'UI',
+        template => 'form-dynatable',
+        format => 'HTML'
+    );
+    $template->render({
+         form    => $ar,
+         heading => $header,
+         rows    => $rows,
+         columns => $cols,
+         hidden  => $hidden,
+        buttons  => $buttons,
+   });
 }
 
 sub report_results_approve {

Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql	2010-02-07 23:43:56 UTC (rev 2862)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql	2010-02-08 04:05:12 UTC (rev 2863)
@@ -442,7 +442,7 @@
 CREATE OR REPLACE FUNCTION asset_report__get_lines(in_id int)
 RETURNS SETOF asset_report_line
 as $$
-select * from asset_report_line where id = $1;
+select * from asset_report_line where report_id = $1;
 $$ language sql;
 
 CREATE OR REPLACE FUNCTION asset_report__search
@@ -452,8 +452,8 @@
 
 SELECT * 
   FROM asset_report
- where ($1 is null or $1 >= report_date)
-       and ($2 is null or $2 <= report_date)
+ where ($1 is null or $1 <= report_date)
+       and ($2 is null or $2 >= report_date)
        and ($3 is null or $3 = asset_class)
        and ($4 is null 
             or ($4 is true and approved_by is not null)
@@ -505,24 +505,19 @@
 UPDATE asset_report 
    set approved_by = person__get_my_entity_id(),
        approved_at = now()
- where id = $1
-       and approved_by is null;
+ where id = $1;
 
 select * from asset_report where id = $1;
 
 $$ language sql;
 
-
-declare retval asset_report;
-$$ language plpgsql;
-
 create or replace function asset_depreciation__approve(in_report_id int, in_expense_acct int)
 returns asset_report
 as $$
 declare retval asset_report;
 begin
 
-retval := asset_report__record_approve(in_report_id)
+retval := asset_report__record_approve(in_report_id);
 
 INSERT INTO gl (reference, description, approved)
 select 'Asset Report ' || in_id, 'Asset Depreciation Report for ' || report_date,
@@ -560,7 +555,7 @@
    iter record;
 begin
 
-retval := asset_report__record_approve(in_report_id)
+retval := asset_report__record_approve(in_report_id);
 
 INSERT INTO gl (reference, description, approved)
 select 'Asset Report ' || in_id, 'Asset Depreciation Report for ' || report_date,


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