--- /dev/null
+package SL::Controller::RequirementSpecStatus;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::DB::RequirementSpecStatus;
+use SL::DB::Language;
+use SL::Helper::Flash;
+use SL::Locale::String;
+
+use Rose::Object::MakeMethods::Generic
+(
+ scalar => [ qw(requirement_spec_status valid_names) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_requirement_spec_status', only => [ qw(edit update destroy) ]);
+__PACKAGE__->run_before(sub { $_[0]->valid_names(\@SL::DB::RequirementSpecStatus::valid_names) });
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('requirement_spec_status/list',
+ title => t8('Requirement Spec Statuses'),
+ REQUIREMENT_SPEC_STATUSES => SL::DB::Manager::RequirementSpecStatus->get_all_sorted);
+}
+
+sub action_new {
+ my ($self) = @_;
+
+ $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new;
+ $self->render('requirement_spec_status/form', title => t8('Create a new requirement spec status'));
+}
+
+sub action_edit {
+ my ($self) = @_;
+ $self->render('requirement_spec_status/form', title => t8('Edit requirement spec status'));
+}
+
+sub action_create {
+ my ($self) = @_;
+
+ $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new;
+ $self->create_or_update;
+}
+
+sub action_update {
+ my ($self) = @_;
+ $self->create_or_update;
+}
+
+sub action_destroy {
+ my ($self) = @_;
+
+ if (eval { $self->{requirement_spec_status}->delete; 1; }) {
+ flash_later('info', t8('The requirement spec status has been deleted.'));
+ } else {
+ flash_later('error', t8('The requirement spec status is in use and cannot be deleted.'));
+ }
+
+ $self->redirect_to(action => 'list');
+}
+
+sub action_reorder {
+ my ($self) = @_;
+
+ SL::DB::RequirementSpecStatus->reorder_list(@{ $::form->{requirement_spec_status_id} || [] });
+
+ $self->render('1;', { type => 'js', inline => 1 });
+}
+
+#
+# filters
+#
+
+sub check_auth {
+ $::auth->assert('config');
+}
+
+#
+# helpers
+#
+
+sub create_or_update {
+ my $self = shift;
+ my $is_new = !$self->{requirement_spec_status}->id;
+ my $params = delete($::form->{requirement_spec_status}) || { };
+ my $title = $is_new ? t8('Create a new requirement spec status') : t8('Edit requirement spec status');
+
+ $self->{requirement_spec_status}->assign_attributes(%{ $params });
+
+ my @errors = $self->{requirement_spec_status}->validate;
+
+ if (@errors) {
+ flash('error', @errors);
+ $self->render('requirement_spec_status/form', title => $title);
+ return;
+ }
+
+ $self->{requirement_spec_status}->save;
+
+ flash_later('info', $is_new ? t8('The requirement spec status has been created.') : t8('The requirement spec status has been saved.'));
+ $self->redirect_to(action => 'list');
+}
+
+sub load_requirement_spec_status {
+ my ($self) = @_;
+ $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new(id => $::form->{id})->load;
+}
+
+1;
use strict;
+use List::MoreUtils qw(none);
+
use SL::DB::MetaSetup::RequirementSpecAcceptanceStatus;
use SL::DB::Manager::RequirementSpecAcceptanceStatus;
use SL::DB::Helper::ActsAsList;
use SL::Locale::String;
+our @valid_names = qw(accepted accepted_with_defects accepted_with_defects_to_be_fixed not_accepted);
+
sub validate {
my ($self) = @_;
my @errors;
- push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The name is missing.') if !$self->name;
+ push @errors, t8('The name and description are not unique.') if $self->get_first_conflicting('name', 'description');
+ push @errors, t8('The name is invalid.') if none { $_ eq $self->name } @valid_names;
+ push @errors, t8('The description is missing.') if !$self->description;
return @errors;
}
use strict;
+use List::MoreUtils qw(none);
+
use SL::DB::MetaSetup::RequirementSpecStatus;
use SL::DB::Manager::RequirementSpecStatus;
use SL::DB::Helper::ActsAsList;
use SL::Locale::String;
+our @valid_names = qw(planning running done);
+
sub validate {
my ($self) = @_;
my @errors;
- push @errors, t8('The name is missing.') if !$self->name;
- push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The name is missing.') if !$self->name;
+ push @errors, t8('The name and description are not unique.') if $self->get_first_conflicting('name', 'description');
+ push @errors, t8('The name is invalid.') if none { $_ eq $self->name } @valid_names;
+ push @errors, t8('The description is missing.') if !$self->description;
return @errors;
}
'Create a new printer' => 'Einen neuen Drucker anlegen',
'Create a new project' => 'Neues Projekt anlegen',
'Create a new project type' => 'Einen neuen Projekttypen anlegen',
+ 'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen',
'Create a new user' => 'Einen neuen Benutzer anlegen',
'Create a new user group' => 'Eine neue Benutzergruppe erfassen',
'Edit project' => 'Projekt bearbeiten',
'Edit project #1' => 'Projekt #1 bearbeiten',
'Edit project type' => 'Projekttypen bearbeiten',
+ 'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
'Edit requirement spec type' => 'Pflichtenhefttypen bearbeiten',
'Edit templates' => 'Vorlagen bearbeiten',
'Edit the Delivery Order' => 'Lieferschein bearbeiten',
'No problems were recognized.' => 'Es wurden keine Probleme gefunden.',
'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.',
'No report with id #1' => 'Es gibt keinen Report mit der Id #1',
+ 'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.',
'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt',
'No summary account' => 'Kein Sammelkonto',
'The login is not unique.' => 'Der Loginname ist nicht eindeutig.',
'The long description is missing.' => 'Der Langtext fehlt.',
'The master templates where not found.' => 'Der Vorlagensatz wurde nicht gefunden.',
+ 'The name and description are not unique.' => 'Name und Beschreibung sind nicht einmalig.',
'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.',
+ 'The name is invalid.' => 'Der Name ist ungültigt.',
'The name is missing in row %d.' => 'Der Name fehlt in Zeile %d.',
'The name is missing.' => 'Der Name fehlt.',
'The name is not unique.' => 'Der Name ist nicht eindeutig.',
'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.',
'The required information consists of the IBAN and the BIC.' => 'Die benötigten Informationen bestehen aus der IBAN und der BIC.',
'The required information consists of the IBAN, the BIC, the mandator ID and the mandate\'s date of signature.' => 'Die benötigten Informationen bestehen aus IBAN, BIC, Mandanten-ID und dem Unterschriftsdatum des Mandates.',
+ 'The requirement spec status has been created.' => 'Der Pflichtenheftstatus wurde angelegt.',
+ 'The requirement spec status has been deleted.' => 'Der Pflichtenheftstatus wurde gelöscht.',
+ 'The requirement spec status has been saved.' => 'Der Pflichtenheftstatus wurde gespeichert.',
+ 'The requirement spec status is in use and cannot be deleted.' => 'Der Pflichtenheftstatus wird verwendet und kann nicht gelöscht werden.',
'The requirement spec type has been created.' => 'Der Pflichtenhefttyp wurde angelegt.',
'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
--- /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') %]</sup></td>
+ <td>[% L.select_tag("requirement_spec_status.name", SELF.valid_names, default = SELF.requirement_spec_status.name) %]</td>
+ </tr>
+
+ <tr>
+ <td>[% LxERP.t8('Description') %]</td>
+ <td>[% L.input_tag("requirement_spec_status.description", SELF.requirement_spec_status.description) %]</td>
+ </tr>
+ </table>
+
+ <p>
+ [% L.hidden_tag("id", SELF.requirement_spec_status.id) %]
+ [% L.hidden_tag("action", "RequirementSpecStatus/dispatch") %]
+ [% L.submit_tag("action_" _ (SELF.requirement_spec_status.id ? "update" : "create"), LxERP.t8('Save')) %]
+ [%- IF SELF.requirement_spec_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 L %][% USE LxERP %]
+
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% IF !REQUIREMENT_SPEC_STATUSES.size %]
+ <p>
+ [%- LxERP.t8('No requirement spec statuses has been created yet.') %]
+ </p>
+
+ [%- ELSE %]
+ <table id="requirement_spec_status_list">
+ <thead>
+ <tr class="listheading">
+ <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+ <th>[%- LxERP.t8('Name') %]</th>
+ <th>[%- LxERP.t8('Description') %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH requirement_spec_status = REQUIREMENT_SPEC_STATUSES %]
+ <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_status_id_[% requirement_spec_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 => requirement_spec_status.id) %]">
+ [%- HTML.escape(requirement_spec_status.name) %]
+ </a>
+ </td>
+
+ <td>[%- HTML.escape(requirement_spec_status.description) %]</td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <p>
+ <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create a new requirement spec status') %]</a>
+ </p>
+ </form>
+
+ [% L.sortable_element('#requirement_spec_status_list tbody', url => 'controller.pl?action=RequirementSpecStatus/reorder', with => 'requirement_spec_status_id') %]