From: Sven Schöling Date: Tue, 7 May 2013 09:51:32 +0000 (+0200) Subject: Projektsuche auf simpel+filter umgestellt X-Git-Tag: release-3.2.0beta~467^2~170 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bcb43619d8eb7088e0b6975d356c569d167f505c;p=kivitendo-erp.git Projektsuche auf simpel+filter umgestellt --- diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index c14f62e01..9b34a5aa9 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -30,8 +30,8 @@ use Rose::Object::MakeMethods::Generic __PACKAGE__->run_before('check_auth'); __PACKAGE__->run_before('load_project', only => [ qw(edit update destroy) ]); -__PACKAGE__->run_before('load_project_types', only => [ qw(search edit new) ]); -__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new) ]); +__PACKAGE__->run_before('load_project_types', only => [ qw(search edit new list) ]); +__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new list) ]); # # actions @@ -54,7 +54,7 @@ sub action_search { sub action_list { my ($self) = @_; - # $self->make_filter_summary; + $self->make_filter_summary; my $projects = $self->models->get; @@ -228,7 +228,8 @@ sub prepare_report { std_column_visibility => 1, controller_class => 'Project', output_format => 'HTML', - top_info_text => $::locale->text('Projects'), + raw_top_info_text => $self->render('project/report_top', { output => 0 }), + raw_bottom_info_text => $self->render('project/report_bottom', { output => 0 }), title => $::locale->text('Projects'), allow_pdf_export => 1, allow_csv_export => 1, @@ -262,6 +263,38 @@ sub init_models { ); } +sub make_filter_summary { + my ($self) = @_; + + my $filter = $::form->{filter} || {}; + my @filter_strings; + + my @filters = ( + [ $filter->{"projectnumber:substr::ilike"}, t8('Project Number') ], + [ $filter->{"description:substr::ilike"}, t8('Description') ], + [ $filter->{customer}{"name:substr::ilike"}, t8('Customer') ], + [ $filter->{"project_type_id"}, t8('Project Type'), sub { SL::DB::Manager::ProjectType->find_by(id => $filter->{"project_type_id"})->description } ], + [ $filter->{"project_status_id"}, t8('Project Status'), sub { SL::DB::Manager::ProjectStatus->find_by(id => $filter->{"project_status_id"})->description } ], + ); + + my @flags = ( + [ $filter->{active} eq 'active', $::locale->text('Active') ], + [ $filter->{active} eq 'inactive', $::locale->text('Inactive') ], + [ $filter->{valid} eq 'valid', $::locale->text('Valid') ], + [ $filter->{valid} eq 'invalid', $::locale->text('Invalid') ], + [ $filter->{orphaned}, $::locale->text('Orphaned') ], + ); + + for (@flags) { + push @filter_strings, "$_->[1]" if $_->[0]; + } + for (@filters) { + push @filter_strings, "$_->[1]: " . ($_->[2] ? $_->[2]->() : $_->[0]) if $_->[0]; + } + + $self->{filter_summary} = join ', ', @filter_strings; +} + sub load_project_types { $_[0]{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; } diff --git a/menus/erp.ini b/menus/erp.ini index 5f73f1a05..a03f150bb 100644 --- a/menus/erp.ini +++ b/menus/erp.ini @@ -85,7 +85,9 @@ searchitems=assembly [Master Data--Reports--Projects] ACCESS=project_edit module=controller.pl -action=Project/search +action=Project/list +filter.active=active +filter.valid=valid [AR] diff --git a/templates/webpages/project/_filter.html b/templates/webpages/project/_filter.html new file mode 100644 index 000000000..27fb84b84 --- /dev/null +++ b/templates/webpages/project/_filter.html @@ -0,0 +1,55 @@ +[%- USE T8 %] +[%- USE HTML %] +[%- USE L %] +[%- USE LxERP %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% CUSTOM_VARIABLES_FILTER_CODE %] + + + + + +
[% 'Number' | $T8 %][% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]
[% 'Description' | $T8 %][% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60) %]
[% 'Customer' | $T8 %][% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, size=60) %]
[% 'Project Type' | $T8 %][% L.select_tag('filter.project_type_id', SELF.ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %]
[% 'Project Status' | $T8 %][% L.select_tag('filter.project_status_id', SELF.ALL_PROJECT_STATUS, default=filter.project_status_id, title_key='description', with_empty=1) %]
[% 'Include in Report' | $T8 %] + + + + + + + + + + + + + + [% CUSTOM_VARIABLES_INCLUSION_CODE %] + +
[% L.select_tag('filter.active', [ [ 'active', LxERP.t8('Active') ], [ 'inactive', LxERP.t8('Inactive') ], [ 'both', LxERP.t8('Both') ] ], default=filter.active, style="width: 200px") %]
[% L.select_tag('filter.valid', [ [ 'valid', LxERP.t8('Valid') ], [ 'invalid', LxERP.t8('Invalid') ], [ 'both', LxERP.t8('Both') ] ], default=filter.valid, style="width: 200px") %]
[% L.select_tag('filter.status', [ [ 'all', LxERP.t8('All') ], [ 'orphaned', LxERP.t8('Orphaned') ] ], default=filter.status, style="width: 200px") %]
+
diff --git a/templates/webpages/project/report_top.html b/templates/webpages/project/report_top.html new file mode 100644 index 000000000..df03f9ebe --- /dev/null +++ b/templates/webpages/project/report_top.html @@ -0,0 +1,26 @@ +[%- USE L %] +[%- USE T8 %] +[%- USE LxERP %] +[%- USE HTML %] +
+
+[% 'Show Filter' | $T8 %] + [% SELF.filter_summary | html %] +
+ + +
+