X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FChart.pm;h=eb2b4739a369b4dc0f788523301f5c964a7aee66;hb=af0847405bd1a45eda7897a8bbfcb5b73a032580;hp=bd77e36890eb9335290fc7a1882ae97073fe282a;hpb=a18b9450d56727749a09c845204df2885a687fc2;p=kivitendo-erp.git diff --git a/SL/Controller/Chart.pm b/SL/Controller/Chart.pm index bd77e3689..eb2b4739a 100644 --- a/SL/Controller/Chart.pm +++ b/SL/Controller/Chart.pm @@ -4,6 +4,9 @@ use strict; use parent qw(SL::Controller::Base); use Clone qw(clone); +use List::UtilsBy qw(partition_by sort_by); + +use SL::AM; use SL::DB::Chart; use SL::Controller::Helper::GetModels; use SL::Locale::String qw(t8); @@ -29,6 +32,7 @@ sub action_ajax_autocomplete { if (1 == scalar @{ $exact_matches = SL::DB::Manager::Chart->get_all( query => [ SL::DB::Manager::Chart->type_filter($::form->{filter}{type}), + charttype => 'A', or => [ description => { ilike => $::form->{filter}{'all:substr:multi::ilike'} }, accno => { ilike => $::form->{filter}{'all:substr:multi::ilike'} }, @@ -81,6 +85,42 @@ sub action_show { } } +sub action_show_report_configuration_overview { + my ($self) = @_; + + my @all_charts = sort { $a->accno cmp $b->accno } @{ SL::DB::Manager::Chart->get_all(inject_results => 1) }; + my @types = qw(bilanz bwa er eur); + my %headings = ( + bilanz => t8('Balance'), + bwa => t8('BWA'), + er => t8('Erfolgsrechnung'), + eur => t8('EUER'), + ); + + my @data; + + foreach my $type (@types) { + my $method = "pos_${type}"; + my $names = $type eq 'bwa' ? AM->get_bwa_categories(\%::myconfig, $::form) + : $type eq 'eur' ? AM->get_eur_categories(\%::myconfig, $::form) + : {}; + my %charts = partition_by { $_->$method // '' } @all_charts; + delete $charts{''}; + + next if !%charts; + + push @data, { + type => $type, + heading => $headings{$type}, + charts => \%charts, + positions => [ sort { ($a * 1) <=> ($b * 1) } keys %charts ], + names => $names, + }; + } + + $self->render('chart/report_configuration_overview', DATA => \@data); +} + sub init_charts { # disable pagination when hiding chart details = paginate when showing chart details @@ -108,6 +148,9 @@ sub init_models { accno => t8('Account number'), description => t8('Description'), }, + query => [ + charttype => 'A', + ], ); }