Revision a3afc944
Von Moritz Bunkus vor mehr als 7 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
39 | 39 |
use SL::AM; |
40 | 40 |
use SL::CA; |
41 | 41 |
use SL::Form; |
42 |
use SL::Helper::Flash; |
|
42 | 43 |
use SL::User; |
43 | 44 |
use SL::USTVA; |
44 | 45 |
use SL::Iconv; |
... | ... | |
795 | 796 |
$main::lxdebug->leave_sub(); |
796 | 797 |
} |
797 | 798 |
|
799 |
sub add_unit { |
|
800 |
$::auth->assert('config'); |
|
801 |
|
|
802 |
# my $units = AM->retrieve_units(\%::myconfig, $::form, "resolved_"); |
|
803 |
# # AM->units_in_use(\%::myconfig, $::form, $units); |
|
804 |
|
|
805 |
# $units->{$_}->{BASE_UNIT_DDBOX} = AM->unit_select_data($units, $units->{$_}->{base_unit}, 1) for keys %{$units}; |
|
806 |
|
|
807 |
my @languages = @{ SL::DB::Manager::Language->get_all_sorted }; |
|
808 |
|
|
809 |
my $units = AM->retrieve_units(\%::myconfig, $::form); |
|
810 |
my $ddbox = AM->unit_select_data($units, undef, 1); |
|
811 |
|
|
812 |
setup_am_add_unit_action_bar(); |
|
813 |
|
|
814 |
$::form->{title} = $::locale->text("Add unit"); |
|
815 |
$::form->header(); |
|
816 |
print($::form->parse_html_template("am/add_unit", { |
|
817 |
NEW_BASE_UNIT_DDBOX => $ddbox, |
|
818 |
LANGUAGES => \@languages, |
|
819 |
})); |
|
820 |
} |
|
821 |
|
|
798 | 822 |
sub edit_units { |
799 | 823 |
$main::lxdebug->enter_sub(); |
800 | 824 |
|
... | ... | |
831 | 855 |
$units = AM->retrieve_units(\%myconfig, $form); |
832 | 856 |
my $ddbox = AM->unit_select_data($units, undef, 1); |
833 | 857 |
|
834 |
$form->{"title"} = $locale->text("Add and edit units"); |
|
858 |
setup_am_edit_units_action_bar(); |
|
859 |
|
|
860 |
$form->{"title"} = $locale->text("Edit units"); |
|
835 | 861 |
$form->header(); |
836 | 862 |
print($form->parse_html_template("am/edit_units", |
837 | 863 |
{ "UNITS" => \@unit_list, |
... | ... | |
842 | 868 |
$main::lxdebug->leave_sub(); |
843 | 869 |
} |
844 | 870 |
|
845 |
sub add_unit {
|
|
871 |
sub create_unit {
|
|
846 | 872 |
$main::lxdebug->enter_sub(); |
847 | 873 |
|
848 | 874 |
my $form = $main::form; |
... | ... | |
877 | 903 |
|
878 | 904 |
AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, \@languages); |
879 | 905 |
|
880 |
$form->{"saved_message"} = $locale->text("The unit has been saved.");
|
|
906 |
flash_later('info', $locale->text("The unit has been added."));
|
|
881 | 907 |
|
882 |
edit_units();
|
|
908 |
print $form->redirect_header('am.pl?action=edit_units');
|
|
883 | 909 |
|
884 | 910 |
$main::lxdebug->leave_sub(); |
885 | 911 |
} |
... | ... | |
983 | 1009 |
|
984 | 1010 |
AM->save_units(\%myconfig, $form, $new_units, \@delete_units); |
985 | 1011 |
|
986 |
$form->{"saved_message"} = $locale->text("The units have been saved.");
|
|
1012 |
flash_later('info', $locale->text("The units have been saved."));
|
|
987 | 1013 |
|
988 |
edit_units();
|
|
1014 |
print $form->redirect_header('am.pl?action=edit_units');
|
|
989 | 1015 |
|
990 | 1016 |
$main::lxdebug->leave_sub(); |
991 | 1017 |
} |
... | ... | |
1463 | 1489 |
); |
1464 | 1490 |
} |
1465 | 1491 |
} |
1492 |
|
|
1493 |
sub setup_am_add_unit_action_bar { |
|
1494 |
my %params = @_; |
|
1495 |
|
|
1496 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1497 |
$bar->add( |
|
1498 |
action => [ |
|
1499 |
t8('Save'), |
|
1500 |
submit => [ '#form', { action => "create_unit" } ], |
|
1501 |
accesskey => 'enter', |
|
1502 |
], |
|
1503 |
|
|
1504 |
'separator', |
|
1505 |
|
|
1506 |
link => [ |
|
1507 |
t8('Back'), |
|
1508 |
link => 'am.pl?action=edit_units', |
|
1509 |
], |
|
1510 |
); |
|
1511 |
} |
|
1512 |
} |
|
1513 |
|
|
1514 |
sub setup_am_edit_units_action_bar { |
|
1515 |
my %params = @_; |
|
1516 |
|
|
1517 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1518 |
$bar->add( |
|
1519 |
action => [ |
|
1520 |
t8('Save'), |
|
1521 |
submit => [ '#form', { action => "save_unit" } ], |
|
1522 |
accesskey => 'enter', |
|
1523 |
], |
|
1524 |
|
|
1525 |
'separator', |
|
1526 |
|
|
1527 |
link => [ |
|
1528 |
t8('Add'), |
|
1529 |
link => 'am.pl?action=add_unit', |
|
1530 |
], |
|
1531 |
); |
|
1532 |
} |
|
1533 |
} |
locale/de/all | ||
---|---|---|
190 | 190 |
'Add Vendor Invoice' => 'Einkaufsrechnung erfassen', |
191 | 191 |
'Add Warehouse' => 'Lager erfassen', |
192 | 192 |
'Add acceptance status' => 'Abnahmestatus hinzufügen', |
193 |
'Add and edit units' => 'Einheiten erfassen und bearbeiten', |
|
194 | 193 |
'Add bank account' => 'Bankkonto erfassen', |
195 | 194 |
'Add booking group' => 'Buchungsgruppe erfassen', |
196 | 195 |
'Add business' => 'Kunden-/Lieferantentyp hinzufügen', |
... | ... | |
3128 | 3127 |
'The transfer has been canceled by the user.' => 'Der Vorgang wurde durch den Benutzer abgebrochen.', |
3129 | 3128 |
'The transport cost article \'#1\' is missing. Do you want to continue anyway?' => 'Der Transportkostenartikel »#1« fehlt. Wollen Sie trotzdem fortfahren?', |
3130 | 3129 |
'The type is missing.' => 'Der Typ fehlt.', |
3131 |
'The unit has been saved.' => 'Die Einheit wurde gespeichert.',
|
|
3130 |
'The unit has been added.' => 'Die Einheit wurde erfasst.',
|
|
3132 | 3131 |
'The unit in row %d has been deleted in the meantime.' => 'Die Einheit in Zeile %d ist in der Zwischentzeit gelöscht worden.', |
3133 | 3132 |
'The unit in row %d has been used in the meantime and cannot be changed anymore.' => 'Die Einheit in Zeile %d wurde in der Zwischenzeit benutzt und kann nicht mehr geändert werden.', |
3134 | 3133 |
'The unit is missing.' => 'Die Einheit fehlt.', |
templates/webpages/am/_units_header_info.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE T8 -%] |
|
2 |
<p> |
|
3 |
[% LxERP.t8('All units have either no or exactly one base unit of which they are multiples.') %] |
|
4 |
[% LxERP.t8('If you select a base unit then you also have to enter a factor.') %] |
|
5 |
[% LxERP.t8('You have to define a unit as a multiple of a smaller unit.') %] |
|
6 |
[% LxERP.t8('Therefore the definition of "kg" with the base unit "g" and a factor of 1000 is valid while defining "g" with a base unit of "kg" and a factor of "0.001" is not.') %] |
|
7 |
</p> |
templates/webpages/am/add_unit.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE T8 -%] |
|
2 |
<h1>[% 'Add unit' | $T8 %]</h1> |
|
3 |
|
|
4 |
[% PROCESS "am/_units_header_info.html" %] |
|
5 |
|
|
6 |
<hr> |
|
7 |
|
|
8 |
<form method="post" action="[% HTML.escape(script) %]" id="form"> |
|
9 |
|
|
10 |
<input type="hidden" name="type" value="unit"> |
|
11 |
|
|
12 |
<table> |
|
13 |
<tr> |
|
14 |
<th align="right">[% 'Unit' | $T8 %]</th> |
|
15 |
<td><input name="new_name" size="20" maxlength="20"></td> |
|
16 |
</tr> |
|
17 |
<tr> |
|
18 |
<th align="right">[% 'Base unit' | $T8 %]</th> |
|
19 |
<td> |
|
20 |
<select name="new_base_unit"> |
|
21 |
[% FOREACH row = NEW_BASE_UNIT_DDBOX %]<option [% row.selected %]>[% row.name %]</option>[% END %] |
|
22 |
</select> |
|
23 |
</td> |
|
24 |
</tr> |
|
25 |
<tr> |
|
26 |
<th align="right">[% 'Factor' | $T8 %]</th> |
|
27 |
<td><input name="new_factor"></td> |
|
28 |
</tr> |
|
29 |
|
|
30 |
[% FOREACH language = LANGUAGES %] |
|
31 |
<tr> |
|
32 |
<th align="right">[% language.description %]</th> |
|
33 |
<td><input name="new_localized_[% language.id %]" size="20" maxlength="20"></td> |
|
34 |
<th align="right">[% 'Plural' | $T8 %]</th> |
|
35 |
<td><input name="new_localized_plural_[% language.id %]" size="20" maxlength="20"></td> |
|
36 |
</tr> |
|
37 |
[% END %] |
|
38 |
</table> |
|
39 |
</form> |
templates/webpages/am/edit_units.html | ||
---|---|---|
2 | 2 |
[% USE HTML %] |
3 | 3 |
<h1>[% title %]</h1> |
4 | 4 |
|
5 |
[% IF saved_message %] |
|
6 |
<p>[% saved_message %]</p> |
|
5 |
[% PROCESS "common/flash.html" %] |
|
7 | 6 |
|
8 |
<hr> |
|
9 |
[% END %] |
|
7 |
[% PROCESS "am/_units_header_info.html" %] |
|
10 | 8 |
|
11 |
<form method="post" action="[% HTML.escape(script) %]">
|
|
9 |
<hr>
|
|
12 | 10 |
|
13 |
<input type="hidden" name="type" value="unit"> |
|
14 |
|
|
15 |
<p> |
|
16 |
[% LxERP.t8('All units have either no or exactly one base unit of which they are multiples.') %] |
|
17 |
[% LxERP.t8('If you select a base unit then you also have to enter a factor.') %] |
|
18 |
[% LxERP.t8('You have to define a unit as a multiple of a smaller unit.') %] |
|
19 |
[% LxERP.t8('Therefore the definition of "kg" with the base unit "g" and a factor of 1000 is valid while defining "g" with a base unit of "kg" and a factor of "0.001" is not.') %] |
|
20 |
</p> |
|
11 |
<p> |
|
12 |
[% 'Units that have already been used (e.g. for parts and services or in invoices or warehouse transactions) cannot be changed.' | $T8 %] |
|
13 |
</p> |
|
21 | 14 |
|
22 |
<hr> |
|
15 |
<p> |
|
16 |
[% 'Units marked for deletion will be deleted upon saving.' | $T8 %] |
|
17 |
</p> |
|
23 | 18 |
|
24 |
<h2>[% 'Add unit' | $T8 %]</h2> |
|
19 |
<p> |
|
20 |
[% 'You can declare different translations for singular and plural for each unit (e.g. "day" and "days).' | $T8 %] |
|
21 |
</p> |
|
25 | 22 |
|
26 |
<table> |
|
27 |
<tr> |
|
28 |
<th align="right">[% 'Unit' | $T8 %]</th> |
|
29 |
<td><input name="new_name" size="20" maxlength="20"></td> |
|
30 |
</tr> |
|
31 |
<tr> |
|
32 |
<th align="right">[% 'Base unit' | $T8 %]</th> |
|
33 |
<td> |
|
34 |
<select name="new_base_unit"> |
|
35 |
[% FOREACH row = NEW_BASE_UNIT_DDBOX %]<option [% row.selected %]>[% row.name %]</option>[% END %] |
|
36 |
</select> |
|
37 |
</td> |
|
38 |
</tr> |
|
39 |
<tr> |
|
40 |
<th align="right">[% 'Factor' | $T8 %]</th> |
|
41 |
<td><input name="new_factor"></td> |
|
42 |
</tr> |
|
43 |
|
|
44 |
[% FOREACH language = LANGUAGES %] |
|
45 |
<tr> |
|
46 |
<th align="right">[% language.description %]</th> |
|
47 |
<td><input name="new_localized_[% language.id %]" size="20" maxlength="20"></td> |
|
48 |
<th align="right">[% 'Plural' | $T8 %]</th> |
|
49 |
<td><input name="new_localized_plural_[% language.id %]" size="20" maxlength="20"></td> |
|
50 |
</tr> |
|
51 |
[% END %] |
|
52 |
</table> |
|
23 |
<form method="post" action="[% HTML.escape(script) %]" id="form"> |
|
53 | 24 |
|
54 |
<input type="submit" class="submit" name="action" value="[% 'Add' | $T8 %]"> |
|
55 |
|
|
56 |
<hr> |
|
57 |
|
|
58 |
<h2>[% 'Edit units' | $T8 %]</h2> |
|
59 |
|
|
60 |
<p> |
|
61 |
[% 'Units that have already been used (e.g. for parts and services or in invoices or warehouse transactions) cannot be changed.' | $T8 %] |
|
62 |
</p> |
|
63 |
|
|
64 |
<p> |
|
65 |
[% 'Units marked for deletion will be deleted upon saving.' | $T8 %] |
|
66 |
</p> |
|
67 |
|
|
68 |
<p> |
|
69 |
[% 'You can declare different translations for singular and plural for each unit (e.g. "day" and "days).' | $T8 %] |
|
70 |
</p> |
|
25 |
<input type="hidden" name="type" value="unit"> |
|
71 | 26 |
|
72 | 27 |
<table id="unit_list"> |
73 | 28 |
<thead> |
... | ... | |
127 | 82 |
|
128 | 83 |
<input type="hidden" name="rowcount" value="[% UNITS.size %]"> |
129 | 84 |
|
130 |
<input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]"> |
|
131 |
|
|
132 | 85 |
</form> |
133 | 86 |
|
134 | 87 |
[% L.sortable_element('#unit_list tbody', url => 'controller.pl?action=Unit/reorder', with => 'unit_id') %] |
135 |
|
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »System« → »Einheiten bearbeiten«