X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FController%2FProjectStatus.pm;fp=SL%2FController%2FProjectStatus.pm;h=0000000000000000000000000000000000000000;hp=686f75c0b06e1a5468105536734bebe4dff7c7e8;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/SL/Controller/ProjectStatus.pm b/SL/Controller/ProjectStatus.pm deleted file mode 100644 index 686f75c0b..000000000 --- a/SL/Controller/ProjectStatus.pm +++ /dev/null @@ -1,112 +0,0 @@ -package SL::Controller::ProjectStatus; - -use strict; - -use parent qw(SL::Controller::Base); - -use SL::DB::ProjectStatus; -use SL::Helper::Flash; - -use Rose::Object::MakeMethods::Generic -( - scalar => [ qw(project_status) ], -); - -__PACKAGE__->run_before('check_auth'); -__PACKAGE__->run_before('load_project_status', only => [ qw(edit update destroy) ]); - -# -# actions -# - -sub action_list { - my ($self) = @_; - - $self->render('project_status/list', - title => $::locale->text('Project Status'), - PROJECT_STATUS => SL::DB::Manager::ProjectStatus->get_all_sorted); -} - -sub action_new { - my ($self) = @_; - - $self->{project_status} = SL::DB::ProjectStatus->new; - $self->render('project_status/form', title => $::locale->text('Create a new project status')); -} - -sub action_edit { - my ($self) = @_; - $self->render('project_status/form', title => $::locale->text('Edit project status')); -} - -sub action_create { - my ($self) = @_; - - $self->{project_status} = SL::DB::ProjectStatus->new; - $self->create_or_update; -} - -sub action_update { - my ($self) = @_; - $self->create_or_update; -} - -sub action_destroy { - my ($self) = @_; - - if (eval { $self->{project_status}->delete; 1; }) { - flash_later('info', $::locale->text('The project status has been deleted.')); - } else { - flash_later('error', $::locale->text('The project status is in use and cannot be deleted.')); - } - - $self->redirect_to(action => 'list'); -} - -sub action_reorder { - my ($self) = @_; - - SL::DB::ProjectStatus->reorder_list(@{ $::form->{project_status_id} || [] }); - - $self->render(\'', { type => 'json' }); -} - -# -# filters -# - -sub check_auth { - $::auth->assert('config'); -} - -# -# helpers -# - -sub create_or_update { - my $self = shift; - my $is_new = !$self->{project_status}->id; - my $params = delete($::form->{project_status}) || { }; - - $self->{project_status}->assign_attributes(%{ $params }); - - my @errors = $self->{project_status}->validate; - - if (@errors) { - flash('error', @errors); - $self->render('project_status/form', title => $is_new ? $::locale->text('Create a new project status') : $::locale->text('Edit project status')); - return; - } - - $self->{project_status}->save; - - flash_later('info', $is_new ? $::locale->text('The project status has been created.') : $::locale->text('The project status has been saved.')); - $self->redirect_to(action => 'list'); -} - -sub load_project_status { - my ($self) = @_; - $self->{project_status} = SL::DB::ProjectStatus->new(id => $::form->{id})->load; -} - -1;