From ea1f139071a3ba20d0defdf9f5bf01c2127ca18d Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Tue, 13 Jan 2015 22:55:59 +0100 Subject: [PATCH] Mandantenkonfiguration: Standardkonten als Chartpicker MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Statt Dropdown werden die Standardkonten nun per Chartpicker ausgewählt. Die Kontenlogik welche Konten als Standardkonten vorgeschlagen werden steckt jetzt im Template in der Konfiguration des Chartpickers, nicht mehr im ClientConfig Controller. --- SL/Controller/ClientConfig.pm | 25 +------------------ .../client_config/_default_accounts.html | 17 +++++++------ 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index eac695617..ded1a33fb 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -21,7 +21,7 @@ __PACKAGE__->run_before('check_auth'); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name - posting_options payment_options accounting_options inventory_options profit_options accounts balance_startdate_method_options) ], + posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options) ], ); sub action_edit { @@ -182,29 +182,6 @@ sub init_balance_startdate_method_options { { title => t8("Last opening balance or start of year"), value => "last_ob_or_start_of_year" }, ] } -sub init_accounts { - my %accounts; - - foreach my $chart (@{ SL::DB::Manager::Chart->get_all(where => [ link => { like => '%IC%' } ], sort_by => 'accno ASC') }) { - my %added; - - foreach my $link (split m/:/, $chart->link) { - my $key = lc($link =~ /cogs/ ? 'IC_expense' : $link =~ /sale/ ? 'IC_income' : $link); - next if $added{$key}; - - $added{$key} = 1; - $accounts{$key} ||= []; - push @{ $accounts{$key} }, $chart; - } - } - - $accounts{fx_gain} = SL::DB::Manager::Chart->get_all(where => [ category => 'I', charttype => 'A' ], sort_by => 'accno ASC'); - $accounts{fx_loss} = SL::DB::Manager::Chart->get_all(where => [ category => 'E', charttype => 'A' ], sort_by => 'accno ASC'); - $accounts{ar_paid} = SL::DB::Manager::Chart->get_all(where => [ link => { like => '%AR_paid%' } ], sort_by => 'accno ASC'); - - return \%accounts; -} - sub init_all_price_sources { my @classes = SL::PriceSource::ALL->all_price_sources; diff --git a/templates/webpages/client_config/_default_accounts.html b/templates/webpages/client_config/_default_accounts.html index f893f5481..0a6ec1e31 100644 --- a/templates/webpages/client_config/_default_accounts.html +++ b/templates/webpages/client_config/_default_accounts.html @@ -1,35 +1,38 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%] -[% SET style="width: 600px" %] +[% SET style="width: 500px" %] +[%# L.dump( SELF.defaults ) %]
- + - + - + - + - + - +
[% LxERP.t8("Inventory Account") %][% L.select_tag('defaults.inventory_accno_id', SELF.accounts.ic, default=SELF.defaults.inventory_accno_id, title_sub=\make_chart_title, style=style) %] + [% L.chart_picker('defaults.inventory_accno_id', SELF.defaults.inventory_accno_id, type='IC', choose=1, style=style) %] +
[% LxERP.t8("Revenue Account") %][% L.select_tag('defaults.income_accno_id', SELF.accounts.ic_income, default=SELF.defaults.income_accno_id, title_sub=\make_chart_title, style=style) %][% L.chart_picker('defaults.income_accno_id', SELF.defaults.income_accno_id, type='IC_income,IC_sale', choose=1, style=style) %]
[% LxERP.t8("Expense Account") %][% L.select_tag('defaults.expense_accno_id', SELF.accounts.ic_expense, default=SELF.defaults.expense_accno_id, title_sub=\make_chart_title, style=style) %][% L.chart_picker('defaults.expense_accno_id', SELF.defaults.expense_accno_id, type='IC_expense,IC_cogs', choose=1, style=style) %]
[% LxERP.t8("Foreign Exchange Gain") %][% L.select_tag('defaults.fxgain_accno_id', SELF.accounts.fx_gain, default=SELF.defaults.fxgain_accno_id, title_sub=\make_chart_title, style=style) %][% L.chart_picker('defaults.fxgain_accno_id', SELF.defaults.fxgain_accno_id, category='I,A', choose=1, style=style) %]
[% LxERP.t8("Foreign Exchange Loss") %][% L.select_tag('defaults.fxloss_accno_id', SELF.accounts.fx_loss, default=SELF.defaults.fxloss_accno_id, title_sub=\make_chart_title, style=style) %][% L.chart_picker('defaults.fxloss_accno_id', SELF.defaults.fxloss_accno_id, category='E,A', choose=1, style=style) %]
[% LxERP.t8("Current assets account") %][% L.select_tag('defaults.ar_paid_accno_id', SELF.accounts.ar_paid, default=SELF.defaults.ar_paid_accno_id, title_sub=\make_chart_title, style=style) %][% L.chart_picker('defaults.ar_paid_accno_id', SELF.defaults.ar_paid_accno_id, type='AR_paid', choose=1, style=style) %]
-- 2.20.1