--- /dev/null
+package SL::Controller::RequirementSpecRisk;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::DB::RequirementSpecRisk;
+use SL::DB::Language;
+use SL::Helper::Flash;
+use SL::Locale::String;
+
+use Rose::Object::MakeMethods::Generic
+(
+ scalar => [ qw(requirement_spec_risk) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_requirement_spec_risk', only => [ qw(edit update destroy) ]);
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('requirement_spec_risk/list',
+ title => t8('Risk levels'),
+ REQUIREMENT_SPEC_RISKS => SL::DB::Manager::RequirementSpecRisk->get_all_sorted);
+}
+
+sub action_new {
+ my ($self) = @_;
+
+ $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new;
+ $self->render('requirement_spec_risk/form', title => t8('Create a new risk level'));
+}
+
+sub action_edit {
+ my ($self) = @_;
+ $self->render('requirement_spec_risk/form', title => t8('Edit risk level'));
+}
+
+sub action_create {
+ my ($self) = @_;
+
+ $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new;
+ $self->create_or_update;
+}
+
+sub action_update {
+ my ($self) = @_;
+ $self->create_or_update;
+}
+
+sub action_destroy {
+ my ($self) = @_;
+
+ if (eval { $self->{requirement_spec_risk}->delete; 1; }) {
+ flash_later('info', t8('The risk level has been deleted.'));
+ } else {
+ flash_later('error', t8('The risk level is in use and cannot be deleted.'));
+ }
+
+ $self->redirect_to(action => 'list');
+}
+
+sub action_reorder {
+ my ($self) = @_;
+
+ SL::DB::RequirementSpecRisk->reorder_list(@{ $::form->{requirement_spec_risk_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_risk}->id;
+ my $params = delete($::form->{requirement_spec_risk}) || { };
+ my $title = $is_new ? t8('Create a new risk level') : t8('Edit risk level');
+
+ $self->{requirement_spec_risk}->assign_attributes(%{ $params });
+
+ my @errors = $self->{requirement_spec_risk}->validate;
+
+ if (@errors) {
+ flash('error', @errors);
+ $self->render('requirement_spec_risk/form', title => $title);
+ return;
+ }
+
+ $self->{requirement_spec_risk}->save;
+
+ flash_later('info', $is_new ? t8('The risk level has been created.') : t8('The risk level has been saved.'));
+ $self->redirect_to(action => 'list');
+}
+
+sub load_requirement_spec_risk {
+ my ($self) = @_;
+ $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new(id => $::form->{id})->load;
+}
+
+1;
my ($self) = @_;
my @errors;
- push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The description is not unique.') if $self->get_first_conflicting('description');
return @errors;
}
'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 risk level' => 'Einen neuen Risikograd anlegen',
'Create a new user' => 'Einen neuen Benutzer anlegen',
'Create a new user group' => 'Eine neue Benutzergruppe erfassen',
'Create and edit RFQs' => 'Lieferantenanfragen erfassen und bearbeiten',
'Edit project type' => 'Projekttypen bearbeiten',
'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
'Edit requirement spec type' => 'Pflichtenhefttypen bearbeiten',
+ 'Edit risk level' => 'Risikograd bearbeiten',
'Edit templates' => 'Vorlagen bearbeiten',
'Edit the Delivery Order' => 'Lieferschein bearbeiten',
'Edit the configuration for periodic invoices' => 'Konfiguration für wiederkehrende Rechnungen bearbeiten',
'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 risks level has been created yet.' => 'Es wurden noch keine Risikograde angelegt.',
'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt',
'No summary account' => 'Kein Sammelkonto',
'No transaction selected!' => 'Keine Transaktion ausgewählt',
'Revenues EU without UStId' => 'Erlöse EU o. UStId',
'Review of Aging list' => 'Altersstrukturliste',
'Right' => 'Rechts',
+ 'Risk levels' => 'Risikograde',
'Risks' => 'Risikograde',
'Row' => 'Zeile',
'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.',
'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
'The requirement spec type is in use and cannot be deleted.' => 'Der Pflichtenhefttyp wird verwendet und kann nicht gelöscht werden.',
+ 'The risk level has been created.' => 'Der Risikograd wurde angelegt.',
+ 'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.',
+ 'The risk level has been saved.' => 'Der Risikograd wurde gespeichert.',
+ 'The risk level is in use and cannot be deleted.' => 'Der Risikograd wird verwendet und kann nicht gelöscht werden.',
'The second reason is that kivitendo allowed the user to enter the tax amount manually regardless of the taxkey used.' => 'Der zweite Grund war, dass kivitendo zuließ, dass die Benutzer beliebige, von den tatsächlichen Steuerschlüsseln unabhängige Steuerbeträge eintrugen.',
'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul für Sie installieren zu lassen.',
'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.',
--- /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("Description") %]</td>
+ <td>[% L.input_tag("requirement_spec_risk.description", SELF.requirement_spec_risk.description) %]</td>
+ </tr>
+ </table>
+
+ <p>
+ [% L.hidden_tag("id", SELF.requirement_spec_risk.id) %]
+ [% L.hidden_tag("action", "RequirementSpecRisk/dispatch") %]
+ [% L.submit_tag("action_" _ (SELF.requirement_spec_risk.id ? "update" : "create"), LxERP.t8('Save')) %]
+ [%- IF SELF.requirement_spec_risk.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_RISKS.size %]
+ <p>
+ [%- LxERP.t8("No risks level has been created yet.") %]
+ </p>
+
+ [%- ELSE %]
+ <table id="requirement_spec_risk_list">
+ <thead>
+ <tr class="listheading">
+ <th align="center"><img src="image/updown.png" alt="[ LxERP.t8("reorder item") %]"></th>
+ <th>[%- LxERP.t8("Description") %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH requirement_spec_risk = REQUIREMENT_SPEC_RISKS %]
+ <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_risk_id_[% requirement_spec_risk.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_risk.id) %]">
+ [%- HTML.escape(requirement_spec_risk.description) %]
+ </a>
+ </td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <p>
+ <a href="[% SELF.url_for(action => "new") %]">[%- LxERP.t8("Create a new risk level") %]</a>
+ </p>
+ </form>
+
+ [% L.sortable_element("#requirement_spec_risk_list tbody", url => "controller.pl?action=RequirementSpecRisk/reorder", with => "requirement_spec_risk_id") %]