From 5a0288d0a911692670707444f64e9ae74a8632b0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 1 Feb 2017 15:39:30 +0100 Subject: [PATCH] =?utf8?q?SimpleSystemSetting:=20Umstellung=20von=20=C2=BB?= =?utf8?q?Pflichtenhefte=C2=AB=20=E2=86=92=20=C2=BBPflichtenheftstatus?= =?utf8?q?=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpecStatus.pm | 115 ------------------ SL/Controller/SimpleSystemSetting.pm | 21 ++++ locale/de/all | 7 +- menus/user/00-erp.yaml | 3 +- .../requirement_spec_status/form.html | 29 ----- .../requirement_spec_status/list.html | 44 ------- .../_requirement_spec_status_form.html | 13 ++ 7 files changed, 37 insertions(+), 195 deletions(-) delete mode 100644 SL/Controller/RequirementSpecStatus.pm delete mode 100755 templates/webpages/requirement_spec_status/form.html delete mode 100644 templates/webpages/requirement_spec_status/list.html create mode 100644 templates/webpages/simple_system_setting/_requirement_spec_status_form.html diff --git a/SL/Controller/RequirementSpecStatus.pm b/SL/Controller/RequirementSpecStatus.pm deleted file mode 100644 index 12d5a653e..000000000 --- a/SL/Controller/RequirementSpecStatus.pm +++ /dev/null @@ -1,115 +0,0 @@ -package SL::Controller::RequirementSpecStatus; - -use strict; - -use parent qw(SL::Controller::Base); - -use SL::DB::RequirementSpecStatus; -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(\'', { type => 'json' }); -} - -# -# 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; diff --git a/SL/Controller/SimpleSystemSetting.pm b/SL/Controller/SimpleSystemSetting.pm index 6bb1b1fca..e18a0a5d3 100644 --- a/SL/Controller/SimpleSystemSetting.pm +++ b/SL/Controller/SimpleSystemSetting.pm @@ -158,6 +158,20 @@ my %supported_types = ( ], }, + requirement_spec_status => { + # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_status_form") + class => 'RequirementSpecStatus', + titles => { + list => t8('Requirement Spec Statuses'), + add => t8('Add requirement spec status'), + edit => t8('Edit requirement spec status'), + }, + list_attributes => [ + { method => 'name', title => t8('Name') }, + { method => 'description', title => t8('Description') }, + ], + }, + requirement_spec_type => { # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_type_form") class => 'RequirementSpecType', @@ -324,6 +338,13 @@ sub render_form { # type-specific helper functions # +sub setup_requirement_spec_status { + my ($self) = @_; + + no warnings 'once'; + $self->{valid_names} = \@SL::DB::RequirementSpecStatus::valid_names; +} + 1; __END__ diff --git a/locale/de/all b/locale/de/all index 80e528667..9c1ba7082 100755 --- a/locale/de/all +++ b/locale/de/all @@ -215,6 +215,7 @@ $self->{texts} = { 'Add pricegroup' => 'Preisgruppe hinzufügen', 'Add project status' => 'Projektstatus hinzufügen', 'Add project type' => 'Projekttypen hinzufügen', + 'Add requirement spec status' => 'Pflichtenheftstatus hinzufügen', 'Add requirement spec type' => 'Pflichtenhefttypen hinzufügen', 'Add section' => 'Abschnitt hinzufügen', 'Add sub function block' => 'Unterfunktionsblock hinzufügen', @@ -676,7 +677,6 @@ $self->{texts} = { 'Create a new project and link to it.' => 'Neues Projekt anlegen und damit verknüpfen.', 'Create a new purchase price rule' => 'Neue Einkaufspreisregel anlegen', 'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen', - 'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen', 'Create a new requirement spec template' => 'Eine neue Pflichtenheftvorlage erfassen', 'Create a new risk level' => 'Einen neuen Risikograd anlegen', 'Create a new sales price rule' => 'Neue Verkaufspreisregel anlegen', @@ -1885,7 +1885,6 @@ $self->{texts} = { 'No problems were recognized.' => 'Es wurden keine Probleme gefunden.', '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', - 'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.', 'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlagen angelegt.', 'No results.' => 'Keine Artikel', 'No revert available.' => 'Dieser Vorgang kann nicht rückgängig gemacht werden, ggf. falsch erstellte Buchungen müssen einzeln manuell korrigiert werden.', @@ -3088,10 +3087,6 @@ $self->{texts} = { 'The requirement spec has been reverted to version #1.' => 'Das Pflichtenheft wurde auf Version #1 zurückgesetzt.', 'The requirement spec has been saved.' => 'Das Pflichtenheft wurde gespeichert.', 'The requirement spec is in use and cannot be deleted.' => 'Das Pflichtenheft wird verwendet und kann nicht gelöscht werden.', - '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 template has been saved.' => 'Die Pflichtenheftvorlage wurde gespeichert.', 'The risk level has been created.' => 'Der Risikograd wurde angelegt.', 'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 45cb20989..d8ae569eb 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -1154,7 +1154,8 @@ name: Requirement Spec Statuses order: 300 params: - action: RequirementSpecStatus/list + action: SimpleSystemSetting/list + type: requirement_spec_status - parent: system_requirement_specs id: system_requirement_specs_complexities name: Complexities diff --git a/templates/webpages/requirement_spec_status/form.html b/templates/webpages/requirement_spec_status/form.html deleted file mode 100755 index 8b034f98e..000000000 --- a/templates/webpages/requirement_spec_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_status.name", SELF.valid_names, default = SELF.requirement_spec_status.name) %]
[% LxERP.t8('Description') %][% L.input_tag("requirement_spec_status.description", SELF.requirement_spec_status.description) %]
- -

- [% 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 %] - [%- LxERP.t8('Abort') %] -

-
diff --git a/templates/webpages/requirement_spec_status/list.html b/templates/webpages/requirement_spec_status/list.html deleted file mode 100644 index 6c2d0e47f..000000000 --- a/templates/webpages/requirement_spec_status/list.html +++ /dev/null @@ -1,44 +0,0 @@ -[% USE HTML %][% USE L %][% USE LxERP %] -

[% FORM.title %]

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

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

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

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

-
- - [% L.sortable_element('#requirement_spec_status_list tbody', url => 'controller.pl?action=RequirementSpecStatus/reorder', with => 'requirement_spec_status_id') %] diff --git a/templates/webpages/simple_system_setting/_requirement_spec_status_form.html b/templates/webpages/simple_system_setting/_requirement_spec_status_form.html new file mode 100644 index 000000000..472c1aaef --- /dev/null +++ b/templates/webpages/simple_system_setting/_requirement_spec_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")) %]
-- 2.20.1