Revision eb9291da
Von Jan Büren vor etwa 13 Jahren hinzugefügt
SL/Controller/Department.pm | ||
---|---|---|
30 | 30 |
sub action_new { |
31 | 31 |
my ($self) = @_; |
32 | 32 |
|
33 |
$self->{department} = SL::DB::Department->new(role => 'P'); |
|
34 | 33 |
$self->render('department/form', title => $::locale->text('Create a new department')); |
35 | 34 |
} |
36 | 35 |
|
... | ... | |
89 | 88 |
$self->render('department/form', title => $is_new ? $::locale->text('Create a new department') : $::locale->text('Edit department')); |
90 | 89 |
return; |
91 | 90 |
} |
92 |
|
|
93 | 91 |
$self->{department}->save; |
94 | 92 |
|
95 | 93 |
flash_later('info', $is_new ? $::locale->text('The department has been created.') : $::locale->text('The department has been saved.')); |
SL/DB/MetaSetup/Department.pm | ||
---|---|---|
12 | 12 |
columns => [ |
13 | 13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
14 | 14 |
description => { type => 'text' }, |
15 |
role => { type => 'character', default => 'P', length => 1 }, |
|
16 | 15 |
itime => { type => 'timestamp', default => 'now()' }, |
17 | 16 |
mtime => { type => 'timestamp' }, |
18 | 17 |
], |
19 | 18 |
|
20 | 19 |
primary_key_columns => [ 'id' ], |
21 |
|
|
22 |
allow_inline_column_values => 1, |
|
23 | 20 |
); |
24 | 21 |
|
25 | 22 |
1; |
SL/Form.pm | ||
---|---|---|
2757 | 2757 |
@{ $self->{all_employees} } = |
2758 | 2758 |
sort { $a->{name} cmp $b->{name} } @{ $self->{all_employees} }; |
2759 | 2759 |
|
2760 |
if ($module eq 'AR') { |
|
2761 | 2760 |
|
2762 | 2761 |
# prepare query for departments |
2763 | 2762 |
$query = qq|SELECT id, description |
2764 | 2763 |
FROM department |
2765 |
WHERE role = 'P' |
|
2766 | 2764 |
ORDER BY description|; |
2767 | 2765 |
|
2768 |
} else { |
|
2769 |
$query = qq|SELECT id, description |
|
2770 |
FROM department |
|
2771 |
ORDER BY description|; |
|
2772 |
} |
|
2773 |
|
|
2774 | 2766 |
$self->{all_departments} = selectall_hashref_query($self, $dbh, $query); |
2775 | 2767 |
|
2776 | 2768 |
# get languages |
... | ... | |
2840 | 2832 |
my ($self, $myconfig, $table) = @_; |
2841 | 2833 |
|
2842 | 2834 |
my $dbh = $self->get_standard_dbh($myconfig); |
2843 |
my $where; |
|
2844 |
|
|
2845 |
if ($table eq 'customer') { |
|
2846 |
$where = "WHERE role = 'P' "; |
|
2847 |
} |
|
2848 | 2835 |
|
2849 | 2836 |
my $query = qq|SELECT id, description |
2850 | 2837 |
FROM department |
2851 |
$where |
|
2852 | 2838 |
ORDER BY description|; |
2853 | 2839 |
$self->{all_departments} = selectall_hashref_query($self, $dbh, $query); |
2854 | 2840 |
|
sql/Pg-upgrade2/department_drop_role.sql | ||
---|---|---|
1 |
-- @tag: department_drop_role |
|
2 |
-- @description: Kosten- und Erfolgstellen zu unterscheiden, macht(e) mittlerweile keinen Sinn mehr, da man ja entsprechend Kosten als Erfolg auf eine Kostenstelle buchen möchte. Ferner wird auch die Auswahlliste schon länger nicht mehr unterschieden |
|
3 |
-- @depends: release_2_6_3 |
|
4 |
-- @charset: utf-8 |
|
5 |
-- @ignore: 0 |
|
6 |
|
|
7 |
|
|
8 |
ALTER TABLE department DROP COLUMN role; |
templates/webpages/department/form.html | ||
---|---|---|
12 | 12 |
<td>[%- 'Description' | $T8 %]</td> |
13 | 13 |
<td>[% L.input_tag("department.description", SELF.department.description) %]</td> |
14 | 14 |
</tr> |
15 |
|
|
16 |
<tr> |
|
17 |
<td valign="top">[%- 'Type' | $T8 %]</td> |
|
18 |
<td valign="top"> |
|
19 |
[%- IF is_used %] |
|
20 |
[% L.hidden_tag("role", SELF.department.role) %] |
|
21 |
[%- IF SELF.department.role == "C" %][%- LxERP.t8('Cost Center') %][%- ELSE %][%- LxERP.t8('Profit Center') %][%- END %] |
|
22 |
[%- ELSE %] |
|
23 |
[% L.radio_button_tag("department.role", "value", "C", "label", LxERP.t8("Cost Center"), "checked", SELF.department.role == "C") %] |
|
24 |
<br> |
|
25 |
[% L.radio_button_tag("department.role", "value", "P", "label", LxERP.t8("Profit Center"), "checked", SELF.department.role == "P") %] |
|
26 |
[%- END %] |
|
27 |
</td> |
|
28 |
</tr> |
|
29 | 15 |
</table> |
30 | 16 |
|
31 | 17 |
<p> |
templates/webpages/department/list.html | ||
---|---|---|
16 | 16 |
<thead> |
17 | 17 |
<tr class="listheading"> |
18 | 18 |
<th width="100%">[%- 'Description' | $T8 %]</th> |
19 |
<th>[%- 'Cost Center' | $T8 %]</th> |
|
20 |
<th>[%- 'Profit Center' | $T8 %]</th> |
|
21 | 19 |
</tr> |
22 | 20 |
</thead> |
23 | 21 |
|
... | ... | |
29 | 27 |
[%- HTML.escape(department.description) %] |
30 | 28 |
</a> |
31 | 29 |
</td> |
32 |
<td align="center">[%- IF department.role == 'C' %]X[%- END %]</td> |
|
33 |
<td align="center">[%- IF department.role == 'P' %]X[%- END %]</td> |
|
34 | 30 |
</tr> |
35 | 31 |
[%- END %] |
36 | 32 |
</tbody> |
Auch abrufbar als: Unified diff
Kosten- und Erfolgstellen zu unterscheiden macht(e) mittlerweile keinen Sinn mehr, da man ja entsprechend Kosten als Erfolg auf eine Kostenstelle buchen möchte. Ferner wird auch die Auswahlliste schon länger nicht mehr unterschieden.
Entsprechend die letzten Rudimente in der Form.pm entfernt und das Datenmodell für Rose angepasst, sowie natürlich die Tabelle