Revision 5a0288d0
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/RequirementSpecStatus.pm | ||
---|---|---|
1 |
package SL::Controller::RequirementSpecStatus; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(SL::Controller::Base); |
|
6 |
|
|
7 |
use SL::DB::RequirementSpecStatus; |
|
8 |
use SL::Helper::Flash; |
|
9 |
use SL::Locale::String; |
|
10 |
|
|
11 |
use Rose::Object::MakeMethods::Generic |
|
12 |
( |
|
13 |
scalar => [ qw(requirement_spec_status valid_names) ], |
|
14 |
); |
|
15 |
|
|
16 |
__PACKAGE__->run_before('check_auth'); |
|
17 |
__PACKAGE__->run_before('load_requirement_spec_status', only => [ qw(edit update destroy) ]); |
|
18 |
__PACKAGE__->run_before(sub { $_[0]->valid_names(\@SL::DB::RequirementSpecStatus::valid_names) }); |
|
19 |
|
|
20 |
# |
|
21 |
# actions |
|
22 |
# |
|
23 |
|
|
24 |
sub action_list { |
|
25 |
my ($self) = @_; |
|
26 |
|
|
27 |
$self->render('requirement_spec_status/list', |
|
28 |
title => t8('Requirement Spec Statuses'), |
|
29 |
REQUIREMENT_SPEC_STATUSES => SL::DB::Manager::RequirementSpecStatus->get_all_sorted); |
|
30 |
} |
|
31 |
|
|
32 |
sub action_new { |
|
33 |
my ($self) = @_; |
|
34 |
|
|
35 |
$self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new; |
|
36 |
$self->render('requirement_spec_status/form', title => t8('Create a new requirement spec status')); |
|
37 |
} |
|
38 |
|
|
39 |
sub action_edit { |
|
40 |
my ($self) = @_; |
|
41 |
$self->render('requirement_spec_status/form', title => t8('Edit requirement spec status')); |
|
42 |
} |
|
43 |
|
|
44 |
sub action_create { |
|
45 |
my ($self) = @_; |
|
46 |
|
|
47 |
$self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new; |
|
48 |
$self->create_or_update; |
|
49 |
} |
|
50 |
|
|
51 |
sub action_update { |
|
52 |
my ($self) = @_; |
|
53 |
$self->create_or_update; |
|
54 |
} |
|
55 |
|
|
56 |
sub action_destroy { |
|
57 |
my ($self) = @_; |
|
58 |
|
|
59 |
if (eval { $self->{requirement_spec_status}->delete; 1; }) { |
|
60 |
flash_later('info', t8('The requirement spec status has been deleted.')); |
|
61 |
} else { |
|
62 |
flash_later('error', t8('The requirement spec status is in use and cannot be deleted.')); |
|
63 |
} |
|
64 |
|
|
65 |
$self->redirect_to(action => 'list'); |
|
66 |
} |
|
67 |
|
|
68 |
sub action_reorder { |
|
69 |
my ($self) = @_; |
|
70 |
|
|
71 |
SL::DB::RequirementSpecStatus->reorder_list(@{ $::form->{requirement_spec_status_id} || [] }); |
|
72 |
|
|
73 |
$self->render(\'', { type => 'json' }); |
|
74 |
} |
|
75 |
|
|
76 |
# |
|
77 |
# filters |
|
78 |
# |
|
79 |
|
|
80 |
sub check_auth { |
|
81 |
$::auth->assert('config'); |
|
82 |
} |
|
83 |
|
|
84 |
# |
|
85 |
# helpers |
|
86 |
# |
|
87 |
|
|
88 |
sub create_or_update { |
|
89 |
my $self = shift; |
|
90 |
my $is_new = !$self->{requirement_spec_status}->id; |
|
91 |
my $params = delete($::form->{requirement_spec_status}) || { }; |
|
92 |
my $title = $is_new ? t8('Create a new requirement spec status') : t8('Edit requirement spec status'); |
|
93 |
|
|
94 |
$self->{requirement_spec_status}->assign_attributes(%{ $params }); |
|
95 |
|
|
96 |
my @errors = $self->{requirement_spec_status}->validate; |
|
97 |
|
|
98 |
if (@errors) { |
|
99 |
flash('error', @errors); |
|
100 |
$self->render('requirement_spec_status/form', title => $title); |
|
101 |
return; |
|
102 |
} |
|
103 |
|
|
104 |
$self->{requirement_spec_status}->save; |
|
105 |
|
|
106 |
flash_later('info', $is_new ? t8('The requirement spec status has been created.') : t8('The requirement spec status has been saved.')); |
|
107 |
$self->redirect_to(action => 'list'); |
|
108 |
} |
|
109 |
|
|
110 |
sub load_requirement_spec_status { |
|
111 |
my ($self) = @_; |
|
112 |
$self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new(id => $::form->{id})->load; |
|
113 |
} |
|
114 |
|
|
115 |
1; |
SL/Controller/SimpleSystemSetting.pm | ||
---|---|---|
158 | 158 |
], |
159 | 159 |
}, |
160 | 160 |
|
161 |
requirement_spec_status => { |
|
162 |
# Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_status_form") |
|
163 |
class => 'RequirementSpecStatus', |
|
164 |
titles => { |
|
165 |
list => t8('Requirement Spec Statuses'), |
|
166 |
add => t8('Add requirement spec status'), |
|
167 |
edit => t8('Edit requirement spec status'), |
|
168 |
}, |
|
169 |
list_attributes => [ |
|
170 |
{ method => 'name', title => t8('Name') }, |
|
171 |
{ method => 'description', title => t8('Description') }, |
|
172 |
], |
|
173 |
}, |
|
174 |
|
|
161 | 175 |
requirement_spec_type => { |
162 | 176 |
# Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_type_form") |
163 | 177 |
class => 'RequirementSpecType', |
... | ... | |
324 | 338 |
# type-specific helper functions |
325 | 339 |
# |
326 | 340 |
|
341 |
sub setup_requirement_spec_status { |
|
342 |
my ($self) = @_; |
|
343 |
|
|
344 |
no warnings 'once'; |
|
345 |
$self->{valid_names} = \@SL::DB::RequirementSpecStatus::valid_names; |
|
346 |
} |
|
347 |
|
|
327 | 348 |
1; |
328 | 349 |
|
329 | 350 |
__END__ |
locale/de/all | ||
---|---|---|
215 | 215 |
'Add pricegroup' => 'Preisgruppe hinzufügen', |
216 | 216 |
'Add project status' => 'Projektstatus hinzufügen', |
217 | 217 |
'Add project type' => 'Projekttypen hinzufügen', |
218 |
'Add requirement spec status' => 'Pflichtenheftstatus hinzufügen', |
|
218 | 219 |
'Add requirement spec type' => 'Pflichtenhefttypen hinzufügen', |
219 | 220 |
'Add section' => 'Abschnitt hinzufügen', |
220 | 221 |
'Add sub function block' => 'Unterfunktionsblock hinzufügen', |
... | ... | |
676 | 677 |
'Create a new project and link to it.' => 'Neues Projekt anlegen und damit verknüpfen.', |
677 | 678 |
'Create a new purchase price rule' => 'Neue Einkaufspreisregel anlegen', |
678 | 679 |
'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen', |
679 |
'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen', |
|
680 | 680 |
'Create a new requirement spec template' => 'Eine neue Pflichtenheftvorlage erfassen', |
681 | 681 |
'Create a new risk level' => 'Einen neuen Risikograd anlegen', |
682 | 682 |
'Create a new sales price rule' => 'Neue Verkaufspreisregel anlegen', |
... | ... | |
1885 | 1885 |
'No problems were recognized.' => 'Es wurden keine Probleme gefunden.', |
1886 | 1886 |
'No quotations or orders have been created yet.' => 'Es wurden noch keine Angebote oder Aufträge angelegt.', |
1887 | 1887 |
'No report with id #1' => 'Es gibt keinen Report mit der Id #1', |
1888 |
'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.', |
|
1889 | 1888 |
'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlagen angelegt.', |
1890 | 1889 |
'No results.' => 'Keine Artikel', |
1891 | 1890 |
'No revert available.' => 'Dieser Vorgang kann nicht rückgängig gemacht werden, ggf. falsch erstellte Buchungen müssen einzeln manuell korrigiert werden.', |
... | ... | |
3088 | 3087 |
'The requirement spec has been reverted to version #1.' => 'Das Pflichtenheft wurde auf Version #1 zurückgesetzt.', |
3089 | 3088 |
'The requirement spec has been saved.' => 'Das Pflichtenheft wurde gespeichert.', |
3090 | 3089 |
'The requirement spec is in use and cannot be deleted.' => 'Das Pflichtenheft wird verwendet und kann nicht gelöscht werden.', |
3091 |
'The requirement spec status has been created.' => 'Der Pflichtenheftstatus wurde angelegt.', |
|
3092 |
'The requirement spec status has been deleted.' => 'Der Pflichtenheftstatus wurde gelöscht.', |
|
3093 |
'The requirement spec status has been saved.' => 'Der Pflichtenheftstatus wurde gespeichert.', |
|
3094 |
'The requirement spec status is in use and cannot be deleted.' => 'Der Pflichtenheftstatus wird verwendet und kann nicht gelöscht werden.', |
|
3095 | 3090 |
'The requirement spec template has been saved.' => 'Die Pflichtenheftvorlage wurde gespeichert.', |
3096 | 3091 |
'The risk level has been created.' => 'Der Risikograd wurde angelegt.', |
3097 | 3092 |
'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.', |
menus/user/00-erp.yaml | ||
---|---|---|
1154 | 1154 |
name: Requirement Spec Statuses |
1155 | 1155 |
order: 300 |
1156 | 1156 |
params: |
1157 |
action: RequirementSpecStatus/list |
|
1157 |
action: SimpleSystemSetting/list |
|
1158 |
type: requirement_spec_status |
|
1158 | 1159 |
- parent: system_requirement_specs |
1159 | 1160 |
id: system_requirement_specs_complexities |
1160 | 1161 |
name: Complexities |
templates/webpages/requirement_spec_status/form.html | ||
---|---|---|
1 |
[% USE HTML %][% USE L %][% USE LxERP %] |
|
2 |
<h1>[% FORM.title %]</h1> |
|
3 |
|
|
4 |
<form method="post" action="controller.pl"> |
|
5 |
|
|
6 |
[%- INCLUDE 'common/flash.html' %] |
|
7 |
|
|
8 |
<table> |
|
9 |
<tr> |
|
10 |
<td>[% LxERP.t8('Name') %]</td> |
|
11 |
<td>[% L.select_tag("requirement_spec_status.name", SELF.valid_names, default = SELF.requirement_spec_status.name) %]</td> |
|
12 |
</tr> |
|
13 |
|
|
14 |
<tr> |
|
15 |
<td>[% LxERP.t8('Description') %]</td> |
|
16 |
<td>[% L.input_tag("requirement_spec_status.description", SELF.requirement_spec_status.description) %]</td> |
|
17 |
</tr> |
|
18 |
</table> |
|
19 |
|
|
20 |
<p> |
|
21 |
[% L.hidden_tag("id", SELF.requirement_spec_status.id) %] |
|
22 |
[% L.hidden_tag("action", "RequirementSpecStatus/dispatch") %] |
|
23 |
[% L.submit_tag("action_" _ (SELF.requirement_spec_status.id ? "update" : "create"), LxERP.t8('Save')) %] |
|
24 |
[%- IF SELF.requirement_spec_status.id %] |
|
25 |
[% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %] |
|
26 |
[%- END %] |
|
27 |
<a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a> |
|
28 |
</p> |
|
29 |
</form> |
templates/webpages/requirement_spec_status/list.html | ||
---|---|---|
1 |
[% USE HTML %][% USE L %][% USE LxERP %] |
|
2 |
<h1>[% FORM.title %]</h1> |
|
3 |
|
|
4 |
[%- INCLUDE 'common/flash.html' %] |
|
5 |
|
|
6 |
<form method="post" action="controller.pl"> |
|
7 |
[% IF !REQUIREMENT_SPEC_STATUSES.size %] |
|
8 |
<p> |
|
9 |
[%- LxERP.t8('No requirement spec statuses has been created yet.') %] |
|
10 |
</p> |
|
11 |
|
|
12 |
[%- ELSE %] |
|
13 |
<table id="requirement_spec_status_list"> |
|
14 |
<thead> |
|
15 |
<tr class="listheading"> |
|
16 |
<th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th> |
|
17 |
<th>[%- LxERP.t8('Name') %]</th> |
|
18 |
<th>[%- LxERP.t8('Description') %]</th> |
|
19 |
</tr> |
|
20 |
</thead> |
|
21 |
|
|
22 |
<tbody> |
|
23 |
[%- FOREACH requirement_spec_status = REQUIREMENT_SPEC_STATUSES %] |
|
24 |
<tr class="listrow[% loop.count % 2 %]" id="requirement_spec_status_id_[% requirement_spec_status.id %]"> |
|
25 |
<td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td> |
|
26 |
<td> |
|
27 |
<a href="[% SELF.url_for(action => 'edit', id => requirement_spec_status.id) %]"> |
|
28 |
[%- HTML.escape(requirement_spec_status.name) %] |
|
29 |
</a> |
|
30 |
</td> |
|
31 |
|
|
32 |
<td>[%- HTML.escape(requirement_spec_status.description) %]</td> |
|
33 |
</tr> |
|
34 |
[%- END %] |
|
35 |
</tbody> |
|
36 |
</table> |
|
37 |
[%- END %] |
|
38 |
|
|
39 |
<p> |
|
40 |
<a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create a new requirement spec status') %]</a> |
|
41 |
</p> |
|
42 |
</form> |
|
43 |
|
|
44 |
[% L.sortable_element('#requirement_spec_status_list tbody', url => 'controller.pl?action=RequirementSpecStatus/reorder', with => 'requirement_spec_status_id') %] |
templates/webpages/simple_system_setting/_requirement_spec_status_form.html | ||
---|---|---|
1 |
[%- USE LxERP -%][%- USE L -%] |
|
2 |
[% SET style="width: 250px" %] |
|
3 |
<table> |
|
4 |
<tr> |
|
5 |
<td>[% LxERP.t8("Name") %]</td> |
|
6 |
<td>[% L.select_tag("object.name", SELF.valid_names, default=SELF.object.name, style=style) %]</td> |
|
7 |
</tr> |
|
8 |
|
|
9 |
<tr> |
|
10 |
<td>[% LxERP.t8("Description") %]</td> |
|
11 |
<td>[% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td> |
|
12 |
</tr> |
|
13 |
</table> |
Auch abrufbar als: Unified diff
SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Pflichtenheftstatus«