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

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



Revision: 2810
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2810&view=rev
Author:   einhverfr
Date:     2009-12-09 16:51:18 +0000 (Wed, 09 Dec 2009)

Log Message:
-----------
Permission fixes merged in, UI fixes to list classes screen.

Modified Paths:
--------------
    addons/1.3/assets/trunk/UI/asset/search_class.html
    addons/1.3/assets/trunk/scripts/asset.pl
    addons/1.3/assets/trunk/sql/modules/Assets-Roles.sql

Modified: addons/1.3/assets/trunk/UI/asset/search_class.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/search_class.html	2009-12-08 20:24:16 UTC (rev 2809)
+++ addons/1.3/assets/trunk/UI/asset/search_class.html	2009-12-09 16:51:18 UTC (rev 2810)
@@ -66,7 +66,7 @@
 	type = "submit"
 	class = "submit"
 	name = "action"
-	value = "asset_class_results"
+	value = "asset_category_results"
 } ?>
 </div>
 </form>

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2009-12-08 20:24:16 UTC (rev 2809)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2009-12-09 16:51:18 UTC (rev 2810)
@@ -53,7 +53,10 @@
 sub asset_category_results {
     my ($request) = @_;
     my $ac = LedgerSMB::DBObject::Asset_Class->new(base => $request);
-    my @classes = $ac->search();
+    my @classes = $ac->list_asset_classes();
+    my $locale = $request->{_locale};
+    $ac->get_metadata;
+    $ac->debug({file => '/tmp/aclass'});
     my $template = LedgerSMB::Template->new(
         user =>$request->{_user}, 
         locale => $request->{_locale},
@@ -61,27 +64,49 @@
         template => 'form-dynatable',
         format => 'HTML'
     );
-    @$columns = qw(id label dep_method life_unit asset_account dep_account);
+    @$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 = [];
-
-    for my $ac (@classes) {
+    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 = "assets.pl?edit_asset_class";
         my $row = {
-             id            => $ac->{id},
+             id            => $aclass->{id},
              label         => {
-                               text => $ac->{label},
+                               text => $aclass->{label},
                                href => "$href&class_id=$ac->{id}",
                               },
-             dep_method    => $ac->{dep_method},
-             life_unit     => $ac->{life_unit}, 
-             asset_account => $ac->{asset_account_accno} . "--". 
-                              $ac->{asset_account_desciption,},
-             dep_account   => $ac->{dep_account_accno} . "--" . 
-                              $ac->{dep_account_description},
+             dep_method    => $aclass->{dep_method},
+             life_unit     => $aclass->{life_unit}, 
+             asset_account => $a_acc->{text},
+             dep_account   => $d_acc->{text},
 		};
-        push @$rows, @row;
+        push @$rows, $row;
     }
+    print STDERR "$#rows rows\n";
+    $template->render({
+         form    => $ac,
+         heading => $heading,
+         rows    => $rows,
+         columns => $columns,
+   });
 }
 
 sub asset_screen {

Modified: addons/1.3/assets/trunk/sql/modules/Assets-Roles.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets-Roles.sql	2009-12-08 20:24:16 UTC (rev 2809)
+++ addons/1.3/assets/trunk/sql/modules/Assets-Roles.sql	2009-12-09 16:51:18 UTC (rev 2810)
@@ -7,9 +7,12 @@
 
 CREATE ROLE "lsmb_<?lsmb dbname ?>__assets_enter" NOLOGIN INHERIT;
 
+GRANT ALL ON asset_item_id_seq TO "lsmb_<?lsmb dbname ?>__assets_enter";
 GRANT INSERT, UPDATE ON asset_item
 TO "lsmb_<?lsmb dbname ?>__assets_enter";
 
+GRANT INSERT, SELECT ON asset_note TO "lsmb_<?lsmb dbname ?>__assets_enter";
+
 CREATE ROLE "lsmb_<?lsmb dbname ?>__assets_depreciate" NOLOGIN INHERIT;
 GRANT SELECT, INSERT ON asset_report, asset_report_line, asset_item, asset_class
 TO "lsmb_<?lsmb dbname ?>__assets_depreciate";
@@ -19,6 +22,6 @@
 TO "lsmb_<?lsmb dbname ?>__assets_approve";
 GRANT EXECUTE ON FUNCTION  asset_report__approve(int)
 TO "lsmb_<?lsmb dbname ?>__assets_approve";
-
+GRANT SELECT ON asset_class, asset_item to public;
 GRANT SELECT ON asset_unit_class TO public;
 GRANT SELECT ON asset_dep_method TO public;


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