X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FChart.pm;h=0e3e2b6fc2a46e701baade1b676c71f948e1bbd5;hb=5a392100ac0460c91f1d231530621fb02878b552;hp=68c75bf0fcfd06687ea94ca80efd8686615c61ea;hpb=4f152ed21fb137de6d6f4d48ec28d67055bcf965;p=kivitendo-erp.git diff --git a/SL/Controller/Chart.pm b/SL/Controller/Chart.pm index 68c75bf0f..0e3e2b6fc 100644 --- a/SL/Controller/Chart.pm +++ b/SL/Controller/Chart.pm @@ -6,12 +6,11 @@ use parent qw(SL::Controller::Base); use Clone qw(clone); use SL::DB::Chart; use SL::Controller::Helper::GetModels; -use SL::DB::Helper::Paginated; use SL::Locale::String qw(t8); use SL::JSON; use Rose::Object::MakeMethods::Generic ( - 'scalar --get_set_init' => [ qw(charts models chart) ], + 'scalar --get_set_init' => [ qw(charts models chart filter) ], ); sub action_ajax_autocomplete { @@ -30,6 +29,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'} }, @@ -55,7 +55,7 @@ sub action_ajax_autocomplete { } sub action_test_page { - $_[0]->render('chart/test_page'); + $_[0]->render('chart/test_page', pre_filled_chart => SL::DB::Manager::Chart->get_first); } sub action_chart_picker_search { @@ -74,9 +74,8 @@ sub action_show { if (!$self->chart) { # TODO error } else { - require Rose::DB::Object::Helpers; - $chart_hash = $self->chart->as_tree; - $chart_hash->{displayable_name} = $self->chart->displayable_name; + $chart_hash = $self->chart->as_tree; + $chart_hash->{displayable_name} = $self->chart->displayable_name; } $self->render(\ SL::JSON::to_json($chart_hash), { layout => 0, type => 'json', process => 0 }); @@ -110,7 +109,12 @@ sub init_models { accno => t8('Account number'), description => t8('Description'), }, + query => [ + charttype => 'A', + ], ); } +sub init_filter { $_[0]->models->filtered->laundered } + 1;