Revision 4fa00e30
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpecType.pm | ||
---|---|---|
1 |
package SL::Controller::RequirementSpecType; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(SL::Controller::Base); |
|
6 |
|
|
7 |
use SL::DB::RequirementSpecType; |
|
8 |
use SL::DB::Language; |
|
9 |
use SL::Helper::Flash; |
|
10 |
use SL::Locale::String; |
|
11 |
|
|
12 |
use Rose::Object::MakeMethods::Generic |
|
13 |
( |
|
14 |
scalar => [ qw(requirement_spec_type) ], |
|
15 |
); |
|
16 |
|
|
17 |
__PACKAGE__->run_before('check_auth'); |
|
18 |
__PACKAGE__->run_before('load_requirement_spec_type', only => [ qw(edit update destroy) ]); |
|
19 |
|
|
20 |
# |
|
21 |
# actions |
|
22 |
# |
|
23 |
|
|
24 |
sub action_list { |
|
25 |
my ($self) = @_; |
|
26 |
|
|
27 |
$self->render('requirement_spec_type/list', |
|
28 |
title => t8('Requirement Spec Types'), |
|
29 |
REQUIREMENT_SPEC_TYPES => SL::DB::Manager::RequirementSpecType->get_all_sorted); |
|
30 |
} |
|
31 |
|
|
32 |
sub action_new { |
|
33 |
my ($self) = @_; |
|
34 |
|
|
35 |
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->new; |
|
36 |
$self->render('requirement_spec_type/form', title => t8('Create a new requirement spec type')); |
|
37 |
} |
|
38 |
|
|
39 |
sub action_edit { |
|
40 |
my ($self) = @_; |
|
41 |
$self->render('requirement_spec_type/form', title => t8('Edit requirement spec type')); |
|
42 |
} |
|
43 |
|
|
44 |
sub action_create { |
|
45 |
my ($self) = @_; |
|
46 |
|
|
47 |
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->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_type}->delete; 1; }) { |
|
60 |
flash_later('info', t8('The requirement spec type has been deleted.')); |
|
61 |
} else { |
|
62 |
flash_later('error', t8('The requirement spec type 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::RequirementSpecType->reorder_list(@{ $::form->{requirement_spec_type_id} || [] }); |
|
72 |
|
|
73 |
$self->render('1;', { type => 'js', inline => 1 }); |
|
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_type}->id; |
|
91 |
my $params = delete($::form->{requirement_spec_type}) || { }; |
|
92 |
my $title = $is_new ? t8('Create a new requirement spec type') : t8('Edit requirement spec type'); |
|
93 |
|
|
94 |
$self->{requirement_spec_type}->assign_attributes(%{ $params }); |
|
95 |
|
|
96 |
my @errors = $self->{requirement_spec_type}->validate; |
|
97 |
|
|
98 |
if (@errors) { |
|
99 |
flash('error', @errors); |
|
100 |
$self->render('requirement_spec_type/form', title => $title); |
|
101 |
return; |
|
102 |
} |
|
103 |
|
|
104 |
$self->{requirement_spec_type}->save; |
|
105 |
|
|
106 |
flash_later('info', $is_new ? t8('The requirement spec type has been created.') : t8('The requirement spec type has been saved.')); |
|
107 |
$self->redirect_to(action => 'list'); |
|
108 |
} |
|
109 |
|
|
110 |
sub load_requirement_spec_type { |
|
111 |
my ($self) = @_; |
|
112 |
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->new(id => $::form->{id})->load; |
|
113 |
} |
|
114 |
|
|
115 |
1; |
SL/DB/RequirementSpecType.pm | ||
---|---|---|
11 | 11 |
my ($self) = @_; |
12 | 12 |
|
13 | 13 |
my @errors; |
14 |
push @errors, t8('The description is missing.') if !$self->description; |
|
14 |
push @errors, t8('The description is missing.') if !$self->description; |
|
15 |
push @errors, t8('The description is not unique.') if $self->get_first_conflicting('description'); |
|
15 | 16 |
|
16 | 17 |
return @errors; |
17 | 18 |
} |
locale/de/all | ||
---|---|---|
526 | 526 |
'Create a new printer' => 'Einen neuen Drucker anlegen', |
527 | 527 |
'Create a new project' => 'Neues Projekt anlegen', |
528 | 528 |
'Create a new project type' => 'Einen neuen Projekttypen anlegen', |
529 |
'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen', |
|
529 | 530 |
'Create a new user' => 'Einen neuen Benutzer anlegen', |
530 | 531 |
'Create a new user group' => 'Eine neue Benutzergruppe erfassen', |
531 | 532 |
'Create and edit RFQs' => 'Lieferantenanfragen erfassen und bearbeiten', |
... | ... | |
861 | 862 |
'Edit project' => 'Projekt bearbeiten', |
862 | 863 |
'Edit project #1' => 'Projekt #1 bearbeiten', |
863 | 864 |
'Edit project type' => 'Projekttypen bearbeiten', |
865 |
'Edit requirement spec type' => 'Pflichtenhefttypen bearbeiten', |
|
864 | 866 |
'Edit templates' => 'Vorlagen bearbeiten', |
865 | 867 |
'Edit the Delivery Order' => 'Lieferschein bearbeiten', |
866 | 868 |
'Edit the configuration for periodic invoices' => 'Konfiguration für wiederkehrende Rechnungen bearbeiten', |
... | ... | |
1410 | 1412 |
'No problems were recognized.' => 'Es wurden keine Probleme gefunden.', |
1411 | 1413 |
'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.', |
1412 | 1414 |
'No report with id #1' => 'Es gibt keinen Report mit der Id #1', |
1415 |
'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.', |
|
1413 | 1416 |
'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt', |
1414 | 1417 |
'No summary account' => 'Kein Sammelkonto', |
1415 | 1418 |
'No transaction selected!' => 'Keine Transaktion ausgewählt', |
... | ... | |
2251 | 2254 |
'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.', |
2252 | 2255 |
'The required information consists of the IBAN and the BIC.' => 'Die benötigten Informationen bestehen aus der IBAN und der BIC.', |
2253 | 2256 |
'The required information consists of the IBAN, the BIC, the mandator ID and the mandate\'s date of signature.' => 'Die benötigten Informationen bestehen aus IBAN, BIC, Mandanten-ID und dem Unterschriftsdatum des Mandates.', |
2257 |
'The requirement spec type has been created.' => 'Der Pflichtenhefttyp wurde angelegt.', |
|
2258 |
'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.', |
|
2259 |
'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.', |
|
2260 |
'The requirement spec type is in use and cannot be deleted.' => 'Der Pflichtenhefttyp wird verwendet und kann nicht gelöscht werden.', |
|
2254 | 2261 |
'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.', |
2255 | 2262 |
'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.', |
2256 | 2263 |
'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.', |
templates/webpages/requirement_spec_type/form.html | ||
---|---|---|
1 |
[% USE HTML %][% USE L %][% USE LxERP %] |
|
2 |
|
|
3 |
<form method="post" action="controller.pl"> |
|
4 |
<div class="listtop">[% FORM.title %]</div> |
|
5 |
|
|
6 |
[%- INCLUDE 'common/flash.html' %] |
|
7 |
|
|
8 |
<table> |
|
9 |
<tr> |
|
10 |
<td>[% LxERP.t8('Description') %]</td> |
|
11 |
<td>[% L.input_tag("requirement_spec_type.description", SELF.requirement_spec_type.description) %]</td> |
|
12 |
</tr> |
|
13 |
</table> |
|
14 |
|
|
15 |
<p> |
|
16 |
[% L.hidden_tag("id", SELF.requirement_spec_type.id) %] |
|
17 |
[% L.hidden_tag("action", "RequirementSpecType/dispatch") %] |
|
18 |
[% L.submit_tag("action_" _ (SELF.requirement_spec_type.id ? "update" : "create"), LxERP.t8('Save')) %] |
|
19 |
[%- IF SELF.requirement_spec_type.id %] |
|
20 |
[% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %] |
|
21 |
[%- END %] |
|
22 |
<a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a> |
|
23 |
</p> |
|
24 |
</form> |
templates/webpages/requirement_spec_type/list.html | ||
---|---|---|
1 |
[% USE HTML %][% USE L %][% USE LxERP %] |
|
2 |
|
|
3 |
<div class="listtop">[% FORM.title %]</div> |
|
4 |
|
|
5 |
[%- INCLUDE 'common/flash.html' %] |
|
6 |
|
|
7 |
<form method="post" action="controller.pl"> |
|
8 |
[% IF !REQUIREMENT_SPEC_TYPES.size %] |
|
9 |
<p> |
|
10 |
[%- LxERP.t8('No requirement spec type has been created yet.') %] |
|
11 |
</p> |
|
12 |
|
|
13 |
[%- ELSE %] |
|
14 |
<table id="requirement_spec_type_list"> |
|
15 |
<thead> |
|
16 |
<tr class="listheading"> |
|
17 |
<th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th> |
|
18 |
<th>[%- LxERP.t8('Description') %]</th> |
|
19 |
</tr> |
|
20 |
</thead> |
|
21 |
|
|
22 |
<tbody> |
|
23 |
[%- FOREACH requirement_spec_type = REQUIREMENT_SPEC_TYPES %] |
|
24 |
<tr class="listrow[% loop.count % 2 %]" id="requirement_spec_type_id_[% requirement_spec_type.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_type.id) %]"> |
|
28 |
[%- HTML.escape(requirement_spec_type.description) %] |
|
29 |
</a> |
|
30 |
</td> |
|
31 |
</tr> |
|
32 |
[%- END %] |
|
33 |
</tbody> |
|
34 |
</table> |
|
35 |
[%- END %] |
|
36 |
|
|
37 |
<p> |
|
38 |
<a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create a new requirement spec type') %]</a> |
|
39 |
</p> |
|
40 |
</form> |
|
41 |
|
|
42 |
[% L.sortable_element('#requirement_spec_type_list tbody', url => 'controller.pl?action=RequirementSpecType/reorder', with => 'requirement_spec_type_id') %] |
Auch abrufbar als: Unified diff
Verwaltung von Pflichtenhefttypen