Revision 9380035c
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/Department.pm | ||
---|---|---|
1 |
package SL::Controller::Department; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(SL::Controller::Base); |
|
6 |
|
|
7 |
use SL::DB::Department; |
|
8 |
use SL::Helper::Flash; |
|
9 |
|
|
10 |
use Rose::Object::MakeMethods::Generic |
|
11 |
( |
|
12 |
scalar => [ qw(department) ], |
|
13 |
); |
|
14 |
|
|
15 |
__PACKAGE__->run_before('check_auth'); |
|
16 |
__PACKAGE__->run_before('load_department', only => [ qw(edit update destroy) ]); |
|
17 |
|
|
18 |
# |
|
19 |
# actions |
|
20 |
# |
|
21 |
|
|
22 |
sub action_list { |
|
23 |
my ($self) = @_; |
|
24 |
|
|
25 |
$self->render('department/list', |
|
26 |
title => $::locale->text('Departments'), |
|
27 |
DEPARTMENTS => SL::DB::Manager::Department->get_all_sorted); |
|
28 |
} |
|
29 |
|
|
30 |
sub action_new { |
|
31 |
my ($self) = @_; |
|
32 |
|
|
33 |
$self->render('department/form', title => $::locale->text('Create a new department')); |
|
34 |
} |
|
35 |
|
|
36 |
sub action_edit { |
|
37 |
my ($self) = @_; |
|
38 |
$self->render('department/form', title => $::locale->text('Edit department')); |
|
39 |
} |
|
40 |
|
|
41 |
sub action_create { |
|
42 |
my ($self) = @_; |
|
43 |
|
|
44 |
$self->{department} = SL::DB::Department->new; |
|
45 |
$self->create_or_update; |
|
46 |
} |
|
47 |
|
|
48 |
sub action_update { |
|
49 |
my ($self) = @_; |
|
50 |
$self->create_or_update; |
|
51 |
} |
|
52 |
|
|
53 |
sub action_destroy { |
|
54 |
my ($self) = @_; |
|
55 |
|
|
56 |
if (eval { $self->{department}->delete; 1; }) { |
|
57 |
flash_later('info', $::locale->text('The department has been deleted.')); |
|
58 |
} else { |
|
59 |
flash_later('error', $::locale->text('The department is in use and cannot be deleted.')); |
|
60 |
} |
|
61 |
|
|
62 |
$self->redirect_to(action => 'list'); |
|
63 |
} |
|
64 |
|
|
65 |
# |
|
66 |
# filters |
|
67 |
# |
|
68 |
|
|
69 |
sub check_auth { |
|
70 |
$::auth->assert('config'); |
|
71 |
} |
|
72 |
|
|
73 |
# |
|
74 |
# helpers |
|
75 |
# |
|
76 |
|
|
77 |
sub create_or_update { |
|
78 |
my $self = shift; |
|
79 |
my $is_new = !$self->{department}->id; |
|
80 |
my $params = delete($::form->{department}) || { }; |
|
81 |
|
|
82 |
$self->{department}->assign_attributes(%{ $params }); |
|
83 |
|
|
84 |
my @errors = $self->{department}->validate; |
|
85 |
|
|
86 |
if (@errors) { |
|
87 |
flash('error', @errors); |
|
88 |
$self->render('department/form', title => $is_new ? $::locale->text('Create a new department') : $::locale->text('Edit department')); |
|
89 |
return; |
|
90 |
} |
|
91 |
$self->{department}->save; |
|
92 |
|
|
93 |
flash_later('info', $is_new ? $::locale->text('The department has been created.') : $::locale->text('The department has been saved.')); |
|
94 |
$self->redirect_to(action => 'list'); |
|
95 |
} |
|
96 |
|
|
97 |
sub load_department { |
|
98 |
my ($self) = @_; |
|
99 |
$self->{department} = SL::DB::Department->new(id => $::form->{id})->load; |
|
100 |
} |
|
101 |
|
|
102 |
1; |
SL/Controller/SimpleSystemSetting.pm | ||
---|---|---|
40 | 40 |
], |
41 | 41 |
}, |
42 | 42 |
|
43 |
department => { |
|
44 |
class => 'Department', |
|
45 |
titles => { |
|
46 |
list => t8('Departments'), |
|
47 |
add => t8('Add department'), |
|
48 |
edit => t8('Edit department'), |
|
49 |
}, |
|
50 |
}, |
|
51 |
|
|
43 | 52 |
part_classification => { |
44 | 53 |
# Make locales.pl happy: $self->render("simple_system_setting/_part_classification_form") |
45 | 54 |
class => 'PartClassification', |
locale/de/all | ||
---|---|---|
191 | 191 |
'Add bank account' => 'Bankkonto erfassen', |
192 | 192 |
'Add booking group' => 'Buchungsgruppe erfassen', |
193 | 193 |
'Add custom variable' => 'Benutzerdefinierte Variable erfassen', |
194 |
'Add department' => 'Abteilung hinzufügen', |
|
194 | 195 |
'Add empty line (csv_import)' => 'Leere Zeile einfügen', |
195 | 196 |
'Add function block' => 'Funktionsblock hinzufügen', |
196 | 197 |
'Add headers from last uploaded file (csv_import)' => 'Spalten aus der hochgeladenen Datei einfügen', |
... | ... | |
292 | 293 |
'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?', |
293 | 294 |
'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?', |
294 | 295 |
'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', |
295 |
'Are you sure you want to delete this department?' => 'Sind Sie sicher, dass Sie diese Abteilung löschen wollen?', |
|
296 | 296 |
'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', |
297 | 297 |
'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?', |
298 | 298 |
'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?', |
... | ... | |
665 | 665 |
'Create a new client' => 'Einen neuen Mandanten anlegen', |
666 | 666 |
'Create a new complexity' => 'Einen Komplexitätsgrad anlegen', |
667 | 667 |
'Create a new delivery term' => 'Neue Lieferbedingungen anlegen', |
668 |
'Create a new department' => 'Eine neue Abteilung erfassen', |
|
669 | 668 |
'Create a new group' => 'Neue Benutzergruppe erfassen', |
670 | 669 |
'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen', |
671 | 670 |
'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen', |
... | ... | |
713 | 712 |
'Create new business' => 'Kunden-/Lieferantentyp erfassen', |
714 | 713 |
'Create new client #1' => 'Neuen Mandanten #1 anlegen', |
715 | 714 |
'Create new delivery term' => 'Neue Lieferbedingungen anlegen', |
716 |
'Create new department' => 'Neue Abteilung erfassen', |
|
717 | 715 |
'Create new payment term' => 'Neue Zahlungsbedingung anlegen', |
718 | 716 |
'Create new project type' => 'Neuen Projekttypen anlegen', |
719 | 717 |
'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen', |
... | ... | |
1865 | 1863 |
'No delievery orders selected, please set one checkbox!' => 'Kein Lieferschein selektiert, bitte eine Box anklicken!', |
1866 | 1864 |
'No delivery orders have been selected.' => 'Es wurden keine Lieferscheine ausgewählt.', |
1867 | 1865 |
'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt', |
1868 |
'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.', |
|
1869 | 1866 |
'No document' => 'Kein Datei mitschicken (ggf. Anhänge)', |
1870 | 1867 |
'No draft was found.' => 'Kein Entwurf gefunden.', |
1871 | 1868 |
'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', |
... | ... | |
2976 | 2973 |
'The delivery term has been deleted.' => 'Die Lieferbedingungen wurden gelöscht.', |
2977 | 2974 |
'The delivery term has been saved.' => 'Die Lieferbedingungen wurden gespeichert.', |
2978 | 2975 |
'The delivery term is in use and cannot be deleted.' => 'Die Lieferbedingungen werden bereits verwendet und können nicht gelöscht werden.', |
2979 |
'The department has been created.' => 'Die Abteilung wurde angelegt.', |
|
2980 |
'The department has been deleted.' => 'Die Abteilung wurde gelöscht.', |
|
2981 |
'The department has been saved.' => 'Die Abteilung wurde gespeichert.', |
|
2982 |
'The department is in use and cannot be deleted.' => 'Die Abteilung wird benutzt und kann nicht gelöscht werden.', |
|
2983 | 2976 |
'The description is missing.' => 'Die Beschreibung fehlt.', |
2984 | 2977 |
'The description is not unique.' => 'Die Beschreibung ist nicht eindeutig.', |
2985 | 2978 |
'The description is shown on the form. Chose something short and descriptive.' => 'Die Beschreibung wird in der jeweiligen Maske angezeigt. Sie sollte kurz und prägnant sein.', |
menus/user/00-erp.yaml | ||
---|---|---|
1108 | 1108 |
name: Departments |
1109 | 1109 |
order: 1300 |
1110 | 1110 |
params: |
1111 |
action: Department/list |
|
1111 |
action: SimpleSystemSetting/list |
|
1112 |
type: department |
|
1112 | 1113 |
- parent: system |
1113 | 1114 |
id: system_types_of_business |
1114 | 1115 |
name: Types of Business |
templates/webpages/department/form.html | ||
---|---|---|
1 |
[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] |
|
2 |
[% SET is_used = SELF.department.is_used %] |
|
3 |
<h1>[% FORM.title %]</h1> |
|
4 |
|
|
5 |
<form method="post" action="controller.pl"> |
|
6 |
|
|
7 |
[%- INCLUDE 'common/flash.html' %] |
|
8 |
|
|
9 |
<table> |
|
10 |
<tr> |
|
11 |
<td>[%- 'Description' | $T8 %]</td> |
|
12 |
<td>[% L.input_tag("department.description", SELF.department.description) %]</td> |
|
13 |
</tr> |
|
14 |
</table> |
|
15 |
|
|
16 |
<p> |
|
17 |
[% L.hidden_tag("id", SELF.department.id) %] |
|
18 |
[% L.hidden_tag("action", "Department/dispatch") %] |
|
19 |
[% L.submit_tag("action_" _ (SELF.department.id ? "update" : "create"), LxERP.t8('Save')) %] |
|
20 |
[%- IF SELF.department.id && !is_used %] |
|
21 |
[% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this department?")) %] |
|
22 |
[%- END %] |
|
23 |
<a href="[% SELF.url_for(action => 'list') %]">[%- 'Abort' | $T8 %]</a> |
|
24 |
</p> |
|
25 |
</form> |
templates/webpages/department/list.html | ||
---|---|---|
1 |
[% USE HTML %][% USE T8 %][% 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 !DEPARTMENTS.size %] |
|
8 |
<p> |
|
9 |
[%- 'No department has been created yet.' | $T8 %] |
|
10 |
</p> |
|
11 |
|
|
12 |
[%- ELSE %] |
|
13 |
<table id="department_list" width="100%"> |
|
14 |
<thead> |
|
15 |
<tr class="listheading"> |
|
16 |
<th width="100%">[%- 'Description' | $T8 %]</th> |
|
17 |
</tr> |
|
18 |
</thead> |
|
19 |
|
|
20 |
<tbody> |
|
21 |
[%- FOREACH department = DEPARTMENTS %] |
|
22 |
<tr class="listrow[% loop.count % 2 %]" id="department_id_[% department.id %]"> |
|
23 |
<td> |
|
24 |
<a href="[% SELF.url_for(action => 'edit', id => department.id) %]"> |
|
25 |
[%- HTML.escape(department.description) %] |
|
26 |
</a> |
|
27 |
</td> |
|
28 |
</tr> |
|
29 |
[%- END %] |
|
30 |
</tbody> |
|
31 |
</table> |
|
32 |
[%- END %] |
|
33 |
|
|
34 |
<hr size="3" noshade> |
|
35 |
|
|
36 |
<p> |
|
37 |
<a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new department' | $T8 %]</a> |
|
38 |
</p> |
|
39 |
</form> |
Auch abrufbar als: Unified diff
SimpleSystemSetting: Umstellung von »Abteilungen«