--- /dev/null
+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;
'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
'Create a new printer' => 'Einen neuen Drucker anlegen',
'Create a new project' => 'Neues Projekt anlegen',
+ 'Create a new project status' => 'Einen neuen Projektstatus anlegen',
'Create a new project type' => 'Einen neuen Projekttypen anlegen',
'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen',
'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
'Edit project' => 'Projekt bearbeiten',
'Edit project #1' => 'Projekt #1 bearbeiten',
+ 'Edit project status' => 'Projektstatus bearbeiten',
'Edit project type' => 'Projekttypen bearbeiten',
'Edit requirement spec' => 'Pflichtenheft bearbeiten',
'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
'No print templates have been created for this client yet. Please do so in the client configuration.' => 'Für diesen Mandanten wurden noch keine Druckvorlagen angelegt. Bitte holen Sie dies in der Mandantenkonfiguration nach.',
'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.',
'No problems were recognized.' => 'Es wurden keine Probleme gefunden.',
+ 'No project status has been created yet.' => 'Es wurde noch kein Projektstatus angelegt.',
'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.',
'No quotations or orders have been created yet.' => 'Es wurden noch keine Angebote oder Aufträge angelegt.',
'No report with id #1' => 'Es gibt keinen Report mit der Id #1',
'The project is in use and cannot be deleted.' => 'Das Projekt ist in Verwendung und kann nicht gelöscht werden.',
'The project number is already in use.' => 'Die Projektnummer wird bereits verwendet.',
'The project number is missing.' => 'Die Projektnummer fehlt.',
+ 'The project status has been created.' => 'Der Projektstatus wurde angelegt.',
+ 'The project status has been deleted.' => 'Der Projektstatus wurde gelöscht.',
+ 'The project status has been saved.' => 'Der Projektstatus wurde gespeichert.',
+ 'The project status is in use and cannot be deleted.' => 'Der Projektstatus wird verwendet und kann nicht gelöscht werden.',
'The project type has been created.' => 'Der Projekttyp wurde angelegt.',
'The project type has been deleted.' => 'Der Projekttyp wurde gelöscht.',
'The project type has been saved.' => 'Der Projekttyp wurde gespeichert.',
module=controller.pl
action=ProjectType/list
+[System--Project Status]
+module=controller.pl
+action=ProjectStatus/list
+
[System--Requirement specs]
module=menu.pl
action=acc_menu
--- /dev/null
+[% USE HTML %][% USE L %][% USE LxERP %]
+
+ <form method="post" action="controller.pl">
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <table>
+ <tr>
+ <td>[% LxERP.t8('Name') %]</td>
+ <td>[% L.input_tag("project_status.name" SELF.project_status.name) %]</td>
+ </tr>
+ <tr>
+ <td>[% LxERP.t8('Description') %]</td>
+ <td>[% L.input_tag("project_status.description" SELF.project_status.description) %]</td>
+ </tr>
+ </table>
+
+ <p>
+ [% L.hidden_tag("id", SELF.project_status.id) %]
+ [% L.hidden_tag("action", "ProjectStatus/dispatch") %]
+ [% L.submit_tag("action_" _ (SELF.project_status.id ? 'update' : 'create'), LxERP.t8('Save')) %]
+ [%- IF SELF.project_status.id %]
+ [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
+ [%- END %]
+ <a href="[% SELF.url_for(action => 'list') %]">[% LxERP.t8('Abort') %]</a>
+ </p>
+
+ </form>
--- /dev/null
+[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% IF !PROJECT_STATUS.size %]
+ <p>
+ [%- 'No project status has been created yet.' | $T8 %]
+ </p>
+
+ [%- ELSE %]
+ <table id="project_status_list">
+ <thead>
+ <tr class="listheading">
+ <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+ <th>[%- 'Name' | $T8 %]</th>
+ <th>[%- 'Description' | $T8 %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH project_status = PROJECT_STATUS %]
+ <tr class="listrow[% loop.count % 2 %]" id="project_status_id_[% project_status.id %]">
+ <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+ <td><a href="[% SELF.url_for(action => 'edit', id => project_status.id) %]">[% project_status.name | html %]</a></td>
+ <td><a href="[% SELF.url_for(action => 'edit', id => project_status.id) %]">[% project_status.description | html %]</a></td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <p>
+ <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create a new project status' | $T8 %]</a>
+ </p>
+ </form>
+
+ [% L.sortable_element('#project_status_list tbody', url => 'controller.pl?action=ProjectStatus/reorder', with => 'project_status_id') %]