[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3045] addons/1.3/assets/trunk
- Subject: SF.net SVN: ledger-smb:[3045] addons/1.3/assets/trunk
- From: ..hidden..
- Date: Tue, 10 Aug 2010 21:46:25 +0000
Revision: 3045
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3045&view=rev
Author: einhverfr
Date: 2010-08-10 21:46:25 +0000 (Tue, 10 Aug 2010)
Log Message:
-----------
correcting parse issues with file import, fixing quote/comma handling case
Modified Paths:
--------------
addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
addons/1.3/assets/trunk/scripts/asset.pl
Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm 2010-08-09 21:51:46 UTC (rev 3044)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm 2010-08-10 21:46:25 UTC (rev 3045)
@@ -36,6 +36,7 @@
for my $line (split /\n/, $contents){
next if ($line !~ /,/);
my @fields;
+ $line =~ s/[^"]"",/"/g;
while ($line ne '') {
if ($line =~ /^"/){
$line =~ s/"(.*?)"(,|$)//;
Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl 2010-08-09 21:51:46 UTC (rev 3044)
+++ addons/1.3/assets/trunk/scripts/asset.pl 2010-08-10 21:46:25 UTC (rev 3045)
@@ -12,8 +12,9 @@
use strict;
my @file_columns = qw(tag purchase_date description asset_class location vendor
- invoice department GL asset_account purchase_value
- accum_depreciation nbv);
+ invoice department asset_account purchase_value
+ accum_depreciation nbv start_depreciation usable_life
+ usable_life_remaining);
sub begin_depreciation_all {
@@ -851,7 +852,6 @@
$asset->{report_date}]
);
my $report_results = shift @rresults;
-
my $department = {};
my $location = {};
my $class = {};
@@ -873,13 +873,19 @@
for (0 .. $#file_columns){
$ai->{$file_columns[$_]} = $ail->[$_];
}
- next if $ai->{tag} !~ /\d/;
+ next if $ai->{purchase_value} !~ /\d/;
+ if (!$ai->{start_depreciation}){
+ $ai->{start_depreciation} = $ai->{purchase_date};
+ }
+ if ($ai->{asset_class} !~ /Leasehold/i){
+ $ai->{usable_life} = $ai->{usable_life}/12;
+ }
$ai->{dep_report_id} = $report_results->{id};
$ai->{location} = $location->{"$ai->{location}"};
$ai->{department} = $department->{"$ai->{department}"};
$ai->{asset_class} = $class->{"$ai->{asset_class}"}->{id};
$ai->{dep_account_id} = $class->{"$ai->{asset_class}"}->{dep_account_id};
- $ai->{asset_account_id} = $asset_account->{"$ai->{asset_account}"}->{id};
+ $ai->{asset_account} = $asset_account->{"$ai->{asset_account}"}->{id};
for my $l (@{$asset->{locations}}){
if ($ai->{location} eq $l->{description}){
@@ -907,4 +913,5 @@
begin_import($request);
}
+
1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.