From: Moritz Bunkus Date: Wed, 1 Feb 2017 14:45:07 +0000 (+0100) Subject: SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Abnahmestatus« X-Git-Tag: release-3.5.4~1551 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6761a7c1fdf3074ac5a16dccf04d40dbc64f6b5f;p=kivitendo-erp.git SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Abnahmestatus« --- diff --git a/SL/Controller/RequirementSpecAcceptanceStatus.pm b/SL/Controller/RequirementSpecAcceptanceStatus.pm deleted file mode 100644 index f9fcad852..000000000 --- a/SL/Controller/RequirementSpecAcceptanceStatus.pm +++ /dev/null @@ -1,116 +0,0 @@ -package SL::Controller::RequirementSpecAcceptanceStatus; - -use strict; - -use parent qw(SL::Controller::Base); - -use SL::DB::RequirementSpecAcceptanceStatus; -use SL::DB::Language; -use SL::Helper::Flash; -use SL::Locale::String; - -use Rose::Object::MakeMethods::Generic -( - scalar => [ qw(requirement_spec_acceptance_status valid_names) ], -); - -__PACKAGE__->run_before('check_auth'); -__PACKAGE__->run_before('load_requirement_spec_acceptance_status', only => [ qw(edit update destroy) ]); -__PACKAGE__->run_before(sub { $_[0]->valid_names(\@SL::DB::RequirementSpecAcceptanceStatus::valid_names) }); - -# -# actions -# - -sub action_list { - my ($self) = @_; - - $self->render('requirement_spec_acceptance_status/list', - title => t8('Acceptance Statuses'), - REQUIREMENT_SPEC_ACCEPTANCE_STATUSES => SL::DB::Manager::RequirementSpecAcceptanceStatus->get_all_sorted); -} - -sub action_new { - my ($self) = @_; - - $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new; - $self->render('requirement_spec_acceptance_status/form', title => t8('Create a new acceptance status')); -} - -sub action_edit { - my ($self) = @_; - $self->render('requirement_spec_acceptance_status/form', title => t8('Edit acceptance status')); -} - -sub action_create { - my ($self) = @_; - - $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new; - $self->create_or_update; -} - -sub action_update { - my ($self) = @_; - $self->create_or_update; -} - -sub action_destroy { - my ($self) = @_; - - if (eval { $self->{requirement_spec_acceptance_status}->delete; 1; }) { - flash_later('info', t8('The acceptance status has been deleted.')); - } else { - flash_later('error', t8('The acceptance status is in use and cannot be deleted.')); - } - - $self->redirect_to(action => 'list'); -} - -sub action_reorder { - my ($self) = @_; - - SL::DB::RequirementSpecAcceptanceStatus->reorder_list(@{ $::form->{requirement_spec_acceptance_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->{requirement_spec_acceptance_status}->id; - my $params = delete($::form->{requirement_spec_acceptance_status}) || { }; - my $title = $is_new ? t8('Create a new acceptance status') : t8('Edit acceptance status'); - - $self->{requirement_spec_acceptance_status}->assign_attributes(%{ $params }); - - my @errors = $self->{requirement_spec_acceptance_status}->validate; - - if (@errors) { - flash('error', @errors); - $self->render('requirement_spec_acceptance_status/form', title => $title); - return; - } - - $self->{requirement_spec_acceptance_status}->save; - - flash_later('info', $is_new ? t8('The acceptance status has been created.') : t8('The acceptance status has been saved.')); - $self->redirect_to(action => 'list'); -} - -sub load_requirement_spec_acceptance_status { - my ($self) = @_; - $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new(id => $::form->{id})->load; -} - -1; diff --git a/SL/Controller/SimpleSystemSetting.pm b/SL/Controller/SimpleSystemSetting.pm index e18a0a5d3..5660f22c2 100644 --- a/SL/Controller/SimpleSystemSetting.pm +++ b/SL/Controller/SimpleSystemSetting.pm @@ -141,6 +141,20 @@ my %supported_types = ( }, }, + requirement_spec_acceptance_status => { + # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_acceptance_status_form") + class => 'RequirementSpecAcceptanceStatus', + titles => { + list => t8('Acceptance Statuses'), + add => t8('Add acceptance status'), + edit => t8('Edit acceptance status'), + }, + list_attributes => [ + { method => 'name', title => t8('Name') }, + { method => 'description', title => t8('Description') }, + ], + }, + requirement_spec_predefined_text => { # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_predefined_text_form") class => 'RequirementSpecPredefinedText', @@ -338,6 +352,13 @@ sub render_form { # type-specific helper functions # +sub setup_requirement_spec_acceptance_status { + my ($self) = @_; + + no warnings 'once'; + $self->{valid_names} = \@SL::DB::RequirementSpecAcceptanceStatus::valid_names; +} + sub setup_requirement_spec_status { my ($self) = @_; diff --git a/locale/de/all b/locale/de/all index 9c1ba7082..8b40876e2 100755 --- a/locale/de/all +++ b/locale/de/all @@ -187,6 +187,7 @@ $self->{texts} = { 'Add Vendor' => 'Lieferant erfassen', 'Add Vendor Invoice' => 'Einkaufsrechnung erfassen', 'Add Warehouse' => 'Lager erfassen', + 'Add acceptance status' => 'Abnahmestatus hinzufügen', 'Add and edit units' => 'Einheiten erfassen und bearbeiten', 'Add bank account' => 'Bankkonto erfassen', 'Add booking group' => 'Buchungsgruppe erfassen', @@ -664,7 +665,6 @@ $self->{texts} = { 'Create Date' => 'Erstelldatum', 'Create HTML' => 'HTML erzeugen', 'Create PDF' => 'PDF erzeugen', - 'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen', 'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', 'Create a new client' => 'Einen neuen Mandanten anlegen', 'Create a new complexity' => 'Einen Komplexitätsgrad anlegen', @@ -1841,7 +1841,6 @@ $self->{texts} = { 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', 'No Journal' => 'Kein Journal', 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', - 'No acceptance statuses has been created yet.' => 'Es wurde noch kein Abnahmestatus angelegt.', 'No action defined.' => 'Keine Aktion definiert.', 'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.', 'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.', @@ -2878,10 +2877,6 @@ $self->{texts} = { 'The SEPA strings have been saved.' => 'Die bei SEPA-Überweisungen verwendeten Begriffe wurden gespeichert.', 'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.', 'The abbreviation is missing.' => 'Abkürzung fehlt', - 'The acceptance status has been created.' => 'Der Abnahmestatus wurde angelegt.', - 'The acceptance status has been deleted.' => 'Der Abnahmestatus wurde gelöscht.', - 'The acceptance status has been saved.' => 'Der Abnahmestatus wurde gespeichert.', - 'The acceptance status is in use and cannot be deleted.' => 'Der Abnahmestatus wird verwendet und kann nicht gelöscht werden.', 'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.', 'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.', 'The account #1 is already being used by bank account #2.' => 'Das Konto #1 wird schon von Bankkonto #2 benutzt.', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index d8ae569eb..79522ba5b 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -1173,7 +1173,8 @@ name: Acceptance Statuses order: 600 params: - action: RequirementSpecAcceptanceStatus/list + action: SimpleSystemSetting/list + type: requirement_spec_acceptance_status - parent: system id: system_languages_and_translations name: Languages and translations diff --git a/templates/webpages/requirement_spec_acceptance_status/form.html b/templates/webpages/requirement_spec_acceptance_status/form.html deleted file mode 100755 index 299326c41..000000000 --- a/templates/webpages/requirement_spec_acceptance_status/form.html +++ /dev/null @@ -1,29 +0,0 @@ -[% USE HTML %][% USE L %][% USE LxERP %] -

[% FORM.title %]

- -
- -[%- INCLUDE 'common/flash.html' %] - - - - - - - - - - - -
[% LxERP.t8('Name') %][% L.select_tag("requirement_spec_acceptance_status.name", SELF.valid_names, default = SELF.requirement_spec_acceptance_status.name) %]
[% LxERP.t8('Description') %][% L.input_tag("requirement_spec_acceptance_status.description", SELF.requirement_spec_acceptance_status.description) %]
- -

- [% L.hidden_tag("id", SELF.requirement_spec_acceptance_status.id) %] - [% L.hidden_tag("action", "RequirementSpecAcceptanceStatus/dispatch") %] - [% L.submit_tag("action_" _ (SELF.requirement_spec_acceptance_status.id ? "update" : "create"), LxERP.t8('Save')) %] - [%- IF SELF.requirement_spec_acceptance_status.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_acceptance_status/list.html b/templates/webpages/requirement_spec_acceptance_status/list.html deleted file mode 100644 index c06e54413..000000000 --- a/templates/webpages/requirement_spec_acceptance_status/list.html +++ /dev/null @@ -1,44 +0,0 @@ -[% USE HTML %][% USE L %][% USE LxERP %] -

[% FORM.title %]

- -[%- INCLUDE 'common/flash.html' %] - -
- [% IF !REQUIREMENT_SPEC_ACCEPTANCE_STATUSES.size %] -

- [%- LxERP.t8('No acceptance statuses has been created yet.') %] -

- - [%- ELSE %] - - - - - - - - - - - [%- FOREACH requirement_spec_acceptance_status = REQUIREMENT_SPEC_ACCEPTANCE_STATUSES %] - - - - - - - [%- END %] - -
[%- LxERP.t8('reorder item') %][%- LxERP.t8('Name') %][%- LxERP.t8('Description') %]
[%- LxERP.t8('reorder item') %] - - [%- HTML.escape(requirement_spec_acceptance_status.name) %] - - [%- HTML.escape(requirement_spec_acceptance_status.description) %]
- [%- END %] - -

- [%- LxERP.t8('Create a new acceptance status') %] -

-
- - [% L.sortable_element('#requirement_spec_acceptance_status_list tbody', url => 'controller.pl?action=RequirementSpecAcceptanceStatus/reorder', with => 'requirement_spec_acceptance_status_id') %] diff --git a/templates/webpages/simple_system_setting/_requirement_spec_acceptance_status_form.html b/templates/webpages/simple_system_setting/_requirement_spec_acceptance_status_form.html new file mode 100644 index 000000000..472c1aaef --- /dev/null +++ b/templates/webpages/simple_system_setting/_requirement_spec_acceptance_status_form.html @@ -0,0 +1,13 @@ +[%- USE LxERP -%][%- USE L -%] +[% SET style="width: 250px" %] + + + + + + + + + + +
[% LxERP.t8("Name") %][% L.select_tag("object.name", SELF.valid_names, default=SELF.object.name, style=style) %]
[% LxERP.t8("Description") %][% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]