From 21f24006746e89bd2481c5c9d14f04978b7403e3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 30 Jan 2013 19:06:45 +0100 Subject: [PATCH] =?utf8?q?Verwaltung=20von=20Pflichtenheftkomplexit=C3=A4t?= =?utf8?q?sgraden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpecComplexity.pm | 115 ++++++++++++++++++ SL/DB/RequirementSpecComplexity.pm | 3 +- locale/de/all | 7 ++ .../requirement_spec_complexity/form.html | 24 ++++ .../requirement_spec_complexity/list.html | 42 +++++++ .../requirement_spec_status/form.html | 2 +- 6 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 SL/Controller/RequirementSpecComplexity.pm create mode 100755 templates/webpages/requirement_spec_complexity/form.html create mode 100644 templates/webpages/requirement_spec_complexity/list.html diff --git a/SL/Controller/RequirementSpecComplexity.pm b/SL/Controller/RequirementSpecComplexity.pm new file mode 100644 index 000000000..e07362993 --- /dev/null +++ b/SL/Controller/RequirementSpecComplexity.pm @@ -0,0 +1,115 @@ +package SL::Controller::RequirementSpecComplexity; + +use strict; + +use parent qw(SL::Controller::Base); + +use SL::DB::RequirementSpecComplexity; +use SL::DB::Language; +use SL::Helper::Flash; +use SL::Locale::String; + +use Rose::Object::MakeMethods::Generic +( + scalar => [ qw(requirement_spec_complexity) ], +); + +__PACKAGE__->run_before('check_auth'); +__PACKAGE__->run_before('load_requirement_spec_complexity', only => [ qw(edit update destroy) ]); + +# +# actions +# + +sub action_list { + my ($self) = @_; + + $self->render('requirement_spec_complexity/list', + title => t8('Complexities'), + REQUIREMENT_SPEC_COMPLEXITIES => SL::DB::Manager::RequirementSpecComplexity->get_all_sorted); +} + +sub action_new { + my ($self) = @_; + + $self->{requirement_spec_complexity} = SL::DB::RequirementSpecComplexity->new; + $self->render('requirement_spec_complexity/form', title => t8('Create a new complexity')); +} + +sub action_edit { + my ($self) = @_; + $self->render('requirement_spec_complexity/form', title => t8('Edit complexity')); +} + +sub action_create { + my ($self) = @_; + + $self->{requirement_spec_complexity} = SL::DB::RequirementSpecComplexity->new; + $self->create_or_update; +} + +sub action_update { + my ($self) = @_; + $self->create_or_update; +} + +sub action_destroy { + my ($self) = @_; + + if (eval { $self->{requirement_spec_complexity}->delete; 1; }) { + flash_later('info', t8('The complexity has been deleted.')); + } else { + flash_later('error', t8('The complexity is in use and cannot be deleted.')); + } + + $self->redirect_to(action => 'list'); +} + +sub action_reorder { + my ($self) = @_; + + SL::DB::RequirementSpecComplexity->reorder_list(@{ $::form->{requirement_spec_complexity_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_complexity}->id; + my $params = delete($::form->{requirement_spec_complexity}) || { }; + my $title = $is_new ? t8('Create a new complexity') : t8('Edit complexity'); + + $self->{requirement_spec_complexity}->assign_attributes(%{ $params }); + + my @errors = $self->{requirement_spec_complexity}->validate; + + if (@errors) { + flash('error', @errors); + $self->render('requirement_spec_complexity/form', title => $title); + return; + } + + $self->{requirement_spec_complexity}->save; + + flash_later('info', $is_new ? t8('The complexity has been created.') : t8('The complexity has been saved.')); + $self->redirect_to(action => 'list'); +} + +sub load_requirement_spec_complexity { + my ($self) = @_; + $self->{requirement_spec_complexity} = SL::DB::RequirementSpecComplexity->new(id => $::form->{id})->load; +} + +1; diff --git a/SL/DB/RequirementSpecComplexity.pm b/SL/DB/RequirementSpecComplexity.pm index 279a9c9ec..2ec63feff 100644 --- a/SL/DB/RequirementSpecComplexity.pm +++ b/SL/DB/RequirementSpecComplexity.pm @@ -11,7 +11,8 @@ sub validate { 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; } diff --git a/locale/de/all b/locale/de/all index a8c40012c..f830c13a5 100755 --- a/locale/de/all +++ b/locale/de/all @@ -520,6 +520,7 @@ $self->{texts} = { 'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', 'Create a new business' => 'Einen neuen Kunden-/Lieferantentyp erfassen', 'Create a new client' => 'Einen neuen Mandanten anlegen', + 'Create a new complexity' => 'Einen Komplexitätsgrad anlegen', 'Create a new delivery term' => 'Neue Lieferbedingungen anlegen', 'Create a new department' => 'Eine neue Abteilung erfassen', 'Create a new group' => 'Neue Benutzergruppe erfassen', @@ -854,6 +855,7 @@ $self->{texts} = { 'Edit background job' => 'Hintergrund-Job bearbeiten', 'Edit bank account' => 'Bankkonto bearbeiten', 'Edit business' => 'Kunden-/Lieferantentyp bearbeiten', + 'Edit complexity' => 'Komplexitätsgrad bearbeiten', 'Edit custom variable' => 'Benutzerdefinierte Variable bearbeiten', 'Edit delivery term' => 'Lieferbedingungen bearbeiten', 'Edit department' => 'Abteilung bearbeiten', @@ -1399,6 +1401,7 @@ $self->{texts} = { 'No bins have been added to this warehouse yet.' => 'Es wurden zu diesem Lager noch keine Lagerplätze angelegt.', 'No business has been created yet.' => 'Es wurden noch kein Kunden-/Lieferantentyp erfasst.', 'No clients have been created yet.' => 'Es wurden noch keine Mandanten angelegt.', + 'No complexities has been created yet.' => 'Es wurden noch keine Komplexitätsgrade angelegt.', 'No contact selected to delete' => 'Keine Ansprechperson zum Löschen ausgewählt', 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.', 'No data was found.' => 'Es wurden keine Daten gefunden.', @@ -2153,6 +2156,10 @@ $self->{texts} = { 'The columns "Dunning Duedate", "Total Fees" and "Interest" show data for the previous dunning created for this invoice.' => 'Die Spalten "Zahlbar bis", "Kumulierte Gebühren" und "Zinsen" zeigen Daten der letzten für diese Rechnung erzeugten Mahnung.', 'The combination of database host, port and name is not unique.' => 'Die Kombination aus Datenbankhost, -port und -name ist nicht eindeutig.', 'The command is missing.' => 'Der Befehl fehlt.', + 'The complexity has been created.' => 'Der Komplexitätsgrad wurde angelegt.', + 'The complexity has been deleted.' => 'Der Komplexitätsgrad wurde gelöscht.', + 'The complexity has been saved.' => 'Der Komplexitätsgrad wurde gespeichert.', + 'The complexity is in use and cannot be deleted.' => 'Der Komplexitätsgrad wird verwendet und kann nicht gelöscht werden.', 'The connection to the LDAP server cannot be encrypted (SSL/TLS startup failure). Please check config/kivitendo.conf.' => 'Die Verbindung zum LDAP-Server kann nicht verschlüsselt werden (Fehler bei SSL/TLS-Initialisierung). Bitte überprüfen Sie die Angaben in config/kivitendo.conf.', 'The connection to the authentication database failed:' => 'Die Verbindung zur Authentifizierungsdatenbank schlug fehl:', 'The connection to the configured client database "#1" on host "#2:#3" failed.' => 'Die Verbindung zur konfigurierten Datenbank "#1" auf Host "#2:#3" schlug fehl.', diff --git a/templates/webpages/requirement_spec_complexity/form.html b/templates/webpages/requirement_spec_complexity/form.html new file mode 100755 index 000000000..994fb9464 --- /dev/null +++ b/templates/webpages/requirement_spec_complexity/form.html @@ -0,0 +1,24 @@ +[% USE HTML %][% USE L %][% USE LxERP %] + +
+
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + + + + + + +
[% LxERP.t8("Description") %][% L.input_tag("requirement_spec_complexity.description", SELF.requirement_spec_complexity.description) %]
+ +

+ [% L.hidden_tag("id", SELF.requirement_spec_complexity.id) %] + [% L.hidden_tag("action", "RequirementSpecComplexity/dispatch") %] + [% L.submit_tag("action_" _ (SELF.requirement_spec_complexity.id ? "update" : "create"), LxERP.t8('Save')) %] + [%- IF SELF.requirement_spec_complexity.id %] + [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %] + [%- END %] + [%- LxERP.t8('Abort') %] +

+
diff --git a/templates/webpages/requirement_spec_complexity/list.html b/templates/webpages/requirement_spec_complexity/list.html new file mode 100644 index 000000000..32ef57495 --- /dev/null +++ b/templates/webpages/requirement_spec_complexity/list.html @@ -0,0 +1,42 @@ +[% USE HTML %][% USE L %][% USE LxERP %] + +
[% FORM.title %]
+ +[%- INCLUDE "common/flash.html" %] + +
+ [% IF !REQUIREMENT_SPEC_COMPLEXITIES.size %] +

+ [%- LxERP.t8("No complexities has been created yet.") %] +

+ + [%- ELSE %] + + + + + + + + + + [%- FOREACH requirement_spec_complexity = REQUIREMENT_SPEC_COMPLEXITIES %] + + + + + [%- END %] + +
[ LxERP.t8([%- LxERP.t8("Description") %]
[ LxERP.t8( + requirement_spec_complexity.id) %]"> + [%- HTML.escape(requirement_spec_complexity.description) %] + +
+ [%- END %] + +

+ [%- LxERP.t8("Create a new complexity") %] +

+
+ + [% L.sortable_element("#requirement_spec_complexity_list tbody", url => "controller.pl?action=RequirementSpecComplexity/reorder", with => "requirement_spec_complexity_id") %] diff --git a/templates/webpages/requirement_spec_status/form.html b/templates/webpages/requirement_spec_status/form.html index 3b28c002e..599389d52 100755 --- a/templates/webpages/requirement_spec_status/form.html +++ b/templates/webpages/requirement_spec_status/form.html @@ -7,7 +7,7 @@ - + -- 2.20.1
[% LxERP.t8('Name') %][% LxERP.t8('Name') %] [% L.select_tag("requirement_spec_status.name", SELF.valid_names, default = SELF.requirement_spec_status.name) %]