From 3a75595770104d5884cab26c57f00e33535ba050 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 6 May 2013 17:52:22 +0200 Subject: [PATCH] Status in der Projektverwaltung --- SL/Controller/Project.pm | 21 ++++++++++++++++----- locale/de/all | 1 + templates/webpages/project/_basic_data.html | 7 ++++++- templates/webpages/project/search.html | 7 ++++++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index 64e33a036..c14f62e01 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -15,6 +15,8 @@ use SL::DB::DeliveryOrder; use SL::DB::Invoice; use SL::DB::Order; use SL::DB::Project; +use SL::DB::ProjectType; +use SL::DB::ProjectStatus; use SL::DB::PurchaseInvoice; use SL::DB::ProjectType; use SL::Helper::Flash; @@ -27,7 +29,9 @@ 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', 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) ]); # # actions @@ -38,7 +42,6 @@ sub action_search { my %params; - $params{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; $params{CUSTOM_VARIABLES} = CVar->get_configs(module => 'Projects'); ($params{CUSTOM_VARIABLES_FILTER_CODE}, $params{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options(variables => $params{CUSTOM_VARIABLES}, @@ -116,7 +119,6 @@ sub display_form { my ($self, %params) = @_; $params{ALL_CUSTOMERS} = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $self->project->customer_id ]]); - $params{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; $params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'Projects', trans_id => $self->project->id); if ($params{keep_cvars}) { @@ -202,13 +204,14 @@ sub prepare_report { my $report = SL::ReportGenerator->new(\%::myconfig, $::form); $self->{report} = $report; - my @columns = qw(projectnumber description customer active valid project_type); - my @sortable = qw(projectnumber description customer project_type); + my @columns = qw(projectnumber description customer active valid project_type project_status); + my @sortable = qw(projectnumber description customer project_type project_status); my %column_defs = ( projectnumber => { obj_link => sub { $self->url_for(action => 'edit', id => $_[0]->id, callback => $callback) } }, description => { obj_link => sub { $self->url_for(action => 'edit', id => $_[0]->id, callback => $callback) } }, project_type => { sub => sub { $_[0]->project_type->description } }, + project_status => { sub => sub { $_[0]->project_status->description }, text => t8('Project Status') }, customer => { sub => sub { $_[0]->customer ? $_[0]->customer->name : '' } }, active => { sub => sub { $_[0]->active ? $::locale->text('Active') : $::locale->text('Inactive') }, text => $::locale->text('Active') }, @@ -259,4 +262,12 @@ sub init_models { ); } +sub load_project_types { + $_[0]{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; +} + +sub load_project_status { + $_[0]{ALL_PROJECT_STATUS} = SL::DB::Manager::ProjectStatus->get_all_sorted; +} + 1; diff --git a/locale/de/all b/locale/de/all index 77e9eb0f2..5c154307b 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1761,6 +1761,7 @@ $self->{texts} = { 'Project Description' => 'Projektbeschreibung', 'Project Number' => 'Projektnummer', 'Project Numbers' => 'Projektnummern', + 'Project Status' => 'Projektstatus', 'Project Transactions' => 'Projektbuchungen', 'Project Type' => 'Projekttyp', 'Project Types' => 'Projekttypen', diff --git a/templates/webpages/project/_basic_data.html b/templates/webpages/project/_basic_data.html index a278356a7..a0982f171 100644 --- a/templates/webpages/project/_basic_data.html +++ b/templates/webpages/project/_basic_data.html @@ -23,7 +23,12 @@ [% 'Project Type' | $T8 %] - [% L.select_tag('project.project_type_id', ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %] + [% L.select_tag('project.project_type_id', SELF.ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %] + + + + [% 'Project Status' | $T8 %] + [% L.select_tag('project.project_status_id', SELF.ALL_PROJECT_STATUS, default=SELF.project.project_status_id, title_key='description', style='width: 300px') %] diff --git a/templates/webpages/project/search.html b/templates/webpages/project/search.html index 1f3e33b3d..23c9fe8de 100644 --- a/templates/webpages/project/search.html +++ b/templates/webpages/project/search.html @@ -28,7 +28,12 @@ [% 'Project Type' | $T8 %] - [% L.select_tag('filter.project_type_id', ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %] + [% 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) %] [% CUSTOM_VARIABLES_FILTER_CODE %] -- 2.20.1