From cf0f9e1d0e7ac2f71137b20094f234f1bfafe40c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 24 Jan 2012 17:03:01 +0100 Subject: [PATCH] am/list_buchungsgruppe nach template ausgelagert --- bin/mozilla/am.pl | 183 +----------------- .../webpages/am/buchungsgruppe_list.html | 66 +++++++ 2 files changed, 76 insertions(+), 173 deletions(-) create mode 100644 templates/webpages/am/buchungsgruppe_list.html diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 10ab28005..8f01265ad 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -830,183 +830,20 @@ sub edit_buchungsgruppe { } sub list_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->buchungsgruppe(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_buchungsgruppe"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Buchungsgruppen'); - - my @column_index = qw(up down description inventory_accno - income_accno_0 expense_accno_0 - income_accno_1 expense_accno_1 - income_accno_2 expense_accno_2 - income_accno_3 expense_accno_3 ); - my %column_header; - $column_header{up} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{down} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{inventory_accno} = - qq|| - . $locale->text('Bestandskonto') - . qq||; - $column_header{income_accno_0} = - qq|| - . $locale->text('National Revenues') - . qq||; - $column_header{expense_accno_0} = - qq|| - . $locale->text('National Expenses') - . qq||; - $column_header{income_accno_1} = - qq|| - . $locale->text('Revenues EU with UStId') - . qq||; - $column_header{expense_accno_1} = - qq|| - . $locale->text('Expenses EU with UStId') - . qq||; - $column_header{income_accno_2} = - qq|| - . $locale->text('Revenues EU without UStId') - . qq||; - $column_header{expense_accno_2} = - qq|| - . $locale->text('Expenses EU without UStId') - . qq||; - $column_header{income_accno_3} = - qq|| - . $locale->text('Foreign Revenues') - . qq||; - $column_header{expense_accno_3} = - qq|| - . $locale->text('Foreign Expenses') - . qq||; - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|; - - my $row = 0; - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - if ($row) { - my $pref = $form->{ALL}->[$row - 1]; - $column_data{up} = - qq||; - } else { - $column_data{up} = qq||; - } - - if ($row == (scalar(@{ $form->{ALL} }) - 1)) { - $column_data{down} = qq||; - } else { - my $nref = $form->{ALL}->[$row + 1]; - $column_data{down} = - qq||; - } - - $column_data{description} = qq||; - $column_data{inventory_accno} = qq||; - $column_data{income_accno_0} = - qq||; - $column_data{expense_accno_0} = qq||; - $column_data{income_accno_1} = - qq||; - $column_data{expense_accno_1} = qq||; - $column_data{income_accno_2} = - qq||; - $column_data{expense_accno_2} = qq||; - $column_data{income_accno_3} = - qq||; - $column_data{expense_accno_3} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - - $row++; - } - - print qq| -
| . - qq|| . - qq|| . $locale->text(| . - qq|  | . - qq|| . - qq|| . $locale->text(| . - qq|$ref->{description}$ref->{inventory_accno}$ref->{income_accno_0}$ref->{expense_accno_0}$ref->{income_accno_1}$ref->{expense_accno_1}$ref->{income_accno_2}$ref->{expense_accno_2}$ref->{income_accno_3}$ref->{expense_accno_3}
-

- -
-
- - - - + $::lxdebug->enter_sub; + $::auth->assert('config'); - + AM->buchungsgruppe(\%::myconfig, $::form); -
+ $::form->{callback} = "am.pl?action=list_buchungsgruppe"; + $::form->{title} = $::locale->text('Buchungsgruppen'); + $::form->header; - - -|; + print $::form->parse_html_template('am/buchungsgruppe_list', { + swap_link => qq|am.pl?action=swap_buchungsgruppen&|, + }); - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub buchungsgruppe_header { diff --git a/templates/webpages/am/buchungsgruppe_list.html b/templates/webpages/am/buchungsgruppe_list.html new file mode 100644 index 000000000..bc4a8a28e --- /dev/null +++ b/templates/webpages/am/buchungsgruppe_list.html @@ -0,0 +1,66 @@ +[%- USE HTML %] +[%- USE L %] +[%- USE LxERP %] +[%- USE T8 %] + + +

[% title | html %]

+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + +[%- FOREACH row IN ALL %] + + + + + + + + + + + + + + +[%- END %] +
[% 'up' | $T8 %][% 'down' | $T8 %][% 'Description' | $T8 %][% 'Bestandskonto' | $T8 %][% 'National Revenues' | $T8 %][% 'National Expenses' | $T8 %][% 'Revenues EU with UStId' | $T8 %][% 'Expenses EU with UStId' | $T8 %][% 'Revenues EU without UStId' | $T8 %][% 'Expenses EU without UStId' | $T8 %][% 'Foreign Revenues' | $T8 %][% 'Foreign Expenses' | $T8 %]
[% IF !loop.first %][% 'up' | $T8 %][% ELSE %] [% END %][% IF !loop.last %][% 'down' | $T8 %][% ELSE %] [% END %][% row.description | html %][% row.inventory_accno | html %][% row.income_accno_0 | html %][% row.expense_accno_0 | html %][% row.income_accno_1 | html %][% row.expense_accno_1 | html %][% row.income_accno_2 | html %][% row.expense_accno_2 | html %][% row.income_accno_3 | html %][% row.expense_accno_3 | html %]
+

+ +
+
+ + + + + + + +
+ + + -- 2.20.1