[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4240] branches/1.3
- Subject: SF.net SVN: ledger-smb:[4240] branches/1.3
- From: ..hidden..
- Date: Mon, 26 Dec 2011 14:53:30 +0000
Revision: 4240
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4240&view=rev
Author: ehuelsmann
Date: 2011-12-26 14:53:29 +0000 (Mon, 26 Dec 2011)
Log Message:
-----------
Name the defaults screen elements like the database elements:
change FX_loss, FX_gain, IC, IC_income and IC_expense.
Modified Paths:
--------------
branches/1.3/LedgerSMB/AM.pm
branches/1.3/UI/am-defaults.html
branches/1.3/bin/am.pl
Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm 2011-12-26 11:12:06 UTC (rev 4239)
+++ branches/1.3/LedgerSMB/AM.pm 2011-12-26 14:53:29 UTC (rev 4240)
@@ -1668,8 +1668,8 @@
my ( $self, $myconfig, $form, $defaults) = @_;
- for (qw(IC IC_income IC_expense FX_gain FX_loss)) {
- ( $form->{$_} ) = split /--/, $form->{$_};
+ for (qw(inventory income expense fxgain fxloss)) {
+ ( $form->{$_ . "_accno_id"} ) = split /--/, $form->{$_ . "_accno_id"};
}
my @a;
@@ -1689,13 +1689,6 @@
WHERE accno = ?)
WHERE setting_key = ?|
);
- my %translation = (
- inventory_accno_id => 'IC',
- income_accno_id => 'IC_income',
- expense_accno_id => 'IC_expense',
- fxgain_accno_id => 'FX_gain',
- fxloss_accno_id => 'FX_loss'
- );
if (..hidden..){
$defaults = qw(inventory_accno_id income_accno_id expense_accno_id
fxgain_accno_id fxloss_accno_id glnumber sinumber vinumber
@@ -1772,17 +1765,9 @@
my $ref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- $form->{ $ref->{setting_key} } = $ref->{value};
+ $form->{defaults}{ $ref->{setting_key} } = $ref->{value};
}
- $form->{defaults}{IC} = $form->{inventory_accno_id};
- $form->{defaults}{IC_income} = $form->{income_accno_id};
- $form->{defaults}{IC_sale} = $form->{income_accno_id};
- $form->{defaults}{IC_expense} = $form->{expense_accno_id};
- $form->{defaults}{IC_cogs} = $form->{expense_accno_id};
- $form->{defaults}{FX_gain} = $form->{fxgain_accno_id};
- $form->{defaults}{FX_loss} = $form->{fxloss_accno_id};
-
$sth->finish;
$query = qq|
@@ -1794,21 +1779,18 @@
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- my $nkey;
+ my %link_map = (
+ IC => 'inventory',
+ IC_income => 'income',
+ IC_sale => 'income',
+ IC_expense => 'expense',
+ IC_cogs => 'expense'
+ );
+
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
foreach my $key ( split( /:/, $ref->{link} ) ) {
- if ( $key =~ /IC/ ) {
- $nkey = $key;
-
- if ( $key =~ /cogs/ ) {
- $nkey = "IC_expense";
- }
-
- if ( $key =~ /sale/ ) {
- $nkey = "IC_income";
- }
-
- %{ $form->{accno}{$nkey}{ $ref->{accno} } } = (
+ if ( exists $link_map{$key} ) {
+ %{ $form->{accno}{"$link_map{$key}_accno_id"}{ $ref->{accno} } } = (
id => $ref->{id},
description => $ref->{description}
);
@@ -1829,12 +1811,12 @@
$sth->execute || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- %{ $form->{accno}{FX_gain}{ $ref->{accno} } } = (
+ %{ $form->{accno}{fxgain_accno_id}{ $ref->{accno} } } = (
id => $ref->{id},
description => $ref->{description}
);
- %{ $form->{accno}{FX_loss}{ $ref->{accno} } } = (
+ %{ $form->{accno}{fxloss_accno_id}{ $ref->{accno} } } = (
id => $ref->{id},
description => $ref->{description}
);
Modified: branches/1.3/UI/am-defaults.html
===================================================================
--- branches/1.3/UI/am-defaults.html 2011-12-26 11:12:06 UTC (rev 4239)
+++ branches/1.3/UI/am-defaults.html 2011-12-26 14:53:29 UTC (rev 4240)
@@ -52,31 +52,31 @@
<tr>
<th align="right" nowrap="nowrap"><?lsmb text('Inventory') ?></th>
<td>
-<?lsmb PROCESS select element_data=selects.IC ?>
+<?lsmb PROCESS select element_data=selects.inventory_accno_id ?>
</td>
</tr>
<tr>
<th align="right" nowrap="nowrap"><?lsmb text('Income') ?></th>
<td>
-<?lsmb PROCESS select element_data=selects.IC_income ?>
+<?lsmb PROCESS select element_data=selects.income_accno_id ?>
</td>
</tr>
<tr>
<th align="right" nowrap="nowrap"><?lsmb text('Expense') ?></th>
<td>
-<?lsmb PROCESS select element_data=selects.IC_expense ?>
+<?lsmb PROCESS select element_data=selects.expense_accno_id ?>
</td>
</tr>
<tr>
<th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Gain') ?></th>
<td>
-<?lsmb PROCESS select element_data=selects.FX_gain ?>
+<?lsmb PROCESS select element_data=selects.fxgain_accno_id ?>
</td>
</tr>
<tr>
<th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Loss') ?></th>
<td>
-<?lsmb PROCESS select element_data=selects.FX_loss ?>
+<?lsmb PROCESS select element_data=selects.fxloss_accno_id ?>
</td>
</tr>
<tr>
Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl 2011-12-26 11:12:06 UTC (rev 4239)
+++ branches/1.3/bin/am.pl 2011-12-26 14:53:29 UTC (rev 4240)
@@ -78,7 +78,7 @@
);
my @default_others = qw(businessnumber weightunit separate_duties default_language
- IC IC_income IC_expense
+ inventory_accno_id income_accno_id expense_accno_id
fxgain_accno_id fxloss_accno_id default_country
templates curr);
@@ -1432,12 +1432,11 @@
# get defaults for account numbers and last numbers
AM->get_all_defaults( \%$form );
my %selects = (
- 'FX_loss' => {name => 'FX_loss', options => []},
- 'FX_gain' => {name => 'FX_gain', options => []},
- 'IC_expense' => {name => 'IC_expense', options => []},
- 'IC_income' => {name => 'IC_income', options => []},
- 'IC_inventory' => {name => 'IC_inventory', options => []},
- 'IC' => {name => 'IC', options => []},
+ 'fxloss_accno_id' => {name => 'fxloss_accno_id', options => []},
+ 'fxgain_accno_id' => {name => 'fxgain_accno_id', options => []},
+ 'expense_accno_id' => {name => 'expense_accno_id', options => []},
+ 'income_accno_id' => {name => 'income_accno_id', options => []},
+ 'inventory_accno_id' => {name => 'inventory_accno_id', options => []},
'default_country' => {name => 'default_country',
options => $form->{countries},
default_values => [$form->{'default_country'}],
@@ -1453,13 +1452,16 @@
'templates' => {name => 'templates', options => []}
);
foreach $key ( keys %{ $form->{accno} } ) {
+ print STDERR "$key\n";
foreach $accno ( sort keys %{ $form->{accno}{$key} } ) {
push @{$selects{$key}{options}}, {
text => "$accno--$form->{accno}{$key}{$accno}{description}",
value => "$accno--$form->{accno}{$key}{$accno}{description}",
};
- $selects{$key}{default_values} = "$accno--$form->{accno}{$key}{$accno}{description}" if
+ $selects{$key}{default_values} = ["$accno--$form->{accno}{$key}{$accno}{description}"] if
($form->{defaults}{$key} == $form->{accno}{$key}{$accno}{id});
+ print STDERR "$key $accno--$form->{accno}{$key}{$accno}{description}\n" if
+ ($form->{defaults}{$key} == $form->{accno}{$key}{$accno}{id});
}
}
for (qw(accno defaults)) { delete $form->{$_} }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.