From d1123673cfe71c596e4518f8fd1f93916010717d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 18 Jan 2012 14:57:07 +0100 Subject: [PATCH] gl::form_header auf template umgeschrieben --- bin/mozilla/gl.pl | 286 +++---------------------- templates/webpages/gl/form_header.html | 157 ++++++++++++++ 2 files changed, 181 insertions(+), 262 deletions(-) create mode 100644 templates/webpages/gl/form_header.html diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f4f87cc8f..b42282947 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -849,288 +849,50 @@ sub display_rows { } sub form_header { - my ($init) = @_; - $main::lxdebug->enter_sub(); - - $main::auth->assert('general_ledger'); + $::lxdebug->enter_sub; + $::auth->assert('general_ledger'); - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; + my ($init) = @_; - my @old_project_ids = (); - map({ push(@old_project_ids, $form->{"project_id_$_"}) - if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + my @old_project_ids = grep { $_ } map{ $::form->{"project_id_$_"} } 1..$::form->{rowcount}; - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + $::form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, "charts" => { "key" => "ALL_CHARTS", - "transdate" => $form->{transdate} }, + "transdate" => $::form->{transdate} }, "taxcharts" => "ALL_TAXCHARTS"); - GL->get_chart_balances('charts' => $form->{ALL_CHARTS}); - - my $title = $form->{title}; - $form->{title} = $locale->text("$title General Ledger Transaction"); - my $readonly = ($form->{id}) ? "readonly" : ""; - - my $show_details_checked = $form->{show_details} ? "checked" : ''; - my $ob_transaction_checked = $form->{ob_transaction} ? "checked" : ''; - my $cb_transaction_checked = $form->{cb_transaction} ? "checked" : ''; + GL->get_chart_balances('charts' => $::form->{ALL_CHARTS}); + my $title = $::form->{title}; + $::form->{title} = $::locale->text("$title General Ledger Transaction"); # $locale->text('Add General Ledger Transaction') # $locale->text('Edit General Ledger Transaction') - map { $form->{$_} =~ s/\"/"/g } - qw(reference description chart taxchart); - - $form->{javascript} = qq| - - -|; - - $form->{selectdepartment} =~ s/ selected//; - $form->{selectdepartment} =~ - s/option>\Q$form->{department}\E/option selected>$form->{department}/; - - my $description; - if ((my $rows = $form->numtextrows($form->{description}, 50)) > 1) { - $description = - qq||; - } else { - $description = - qq||; - } - - my $taxincluded = ($form->{taxincluded}) ? "checked" : ""; + $::form->{selectdepartment} =~ s/ selected//; + $::form->{selectdepartment} =~ + s/option>\Q$::form->{department}\E/option selected>$::form->{department}/; if ($init) { - $taxincluded = "checked"; - } - - my $department; - $department = qq| - - | . $locale->text('Department') . qq| - - - -| if $form->{selectdepartment}; - if ($init) { - $form->{fokus} = "gl.reference"; - } else { - $form->{fokus} = qq|gl.accno_$form->{rowcount}|; - } - - # use JavaScript Calendar or not - $form->{jsscript} = 1; - my $jsscript = ""; - my ($button1, $button2); - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1"); - } else { - - # without JavaScript Calendar - $button1 = - qq||; - } - - $form->{previous_id} ||= "--"; - $form->{previous_gldate} ||= "--"; - - $jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js'); - - $form->header; - - print qq| - - - - -
-|; - - $form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate)); - - print qq| - - - - - - - - - - - | . - - ($form->{saved_message} ? qq| - - | : '') . - -qq| - - -
$form->{title}
$form->{saved_message} -
- - - - - - - - - |; - if ($form->{id}) { - print qq| - - - - - |; - } - print qq| - $department|; - if ($form->{id}) { - print qq| - - - - - - |; + $::form->{fokus} = "gl.reference"; + $::form->{taxincluded} = "1"; } else { - print qq| - - - - - |; + $::form->{fokus} = qq|gl.accno_$::form->{rowcount}|; } - print qq| - - - - - - |; + $::form->{previous_id} ||= "--"; + $::form->{previous_gldate} ||= "--"; - print qq| - -
| - . $locale->text("Previous transnumber text") - . " $form->{previous_id} " - . $locale->text("Previous transdate text") - . " $form->{previous_gldate}" - . qq|
| . $locale->text('Reference') . qq| - - - - $button1 - -
| . $locale->text('Date') . qq|
-
| . $locale->text('Belegnummer') . qq| - - - - - -
| . $locale->text('Buchungsdatum') . qq|{gldate} $readonly onBlur=\"check_right_date_format(this)\">
-
| . $locale->text('Description') . qq|$description - - - - - -
| . $locale->text('MwSt. inkl.') . qq|
-
- - - - - -
| . $locale->text('Mitarbeiter') . qq|
-
| . $locale->text('Description') . qq|$description - - - - - -
| . $locale->text('MwSt. inkl.') . qq|
-
- - -
- | . $locale->text('OB Transaction') . qq| - - | . $locale->text('CB Transaction') . qq| -
| . $locale->text('Show details') . qq|
- - - - - - - - |; - - if ($form->{show_details}) { - print qq| - - - -|; - } - - print qq| - + $::form->header; + print $::form->parse_html_template('gl/form_header', { + hide_title => $title, + }); -$jsscript -|; - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } diff --git a/templates/webpages/gl/form_header.html b/templates/webpages/gl/form_header.html new file mode 100644 index 000000000..e6ba49e19 --- /dev/null +++ b/templates/webpages/gl/form_header.html @@ -0,0 +1,157 @@ +[%- USE HTML %] +[%- USE LxERP %] +[%- USE T8 %] +[%- USE L %] + + + + + + + + +[% FOREACH name IN [ 'id', 'closedto', 'locked', 'storno', 'storno_id', 'previous_id', 'previous_gldate' ] %] +[% L.hidden_tag(name, $name) %] +[%- END %] + + + + + + + + +
| - . $locale->text('Account') . qq|| . $locale->text('Chart balance') . qq|| - . $locale->text('Debit') . qq|| - . $locale->text('Credit') . qq|| - . $locale->text('Tax') . qq|| - . $locale->text('Taxkey') . qq|| . $locale->text('Source') . qq|| . $locale->text('Memo') . qq|| . $locale->text('Project Number') . qq|
+ + + +[%- IF saved_message %] + + +[%- END %] + + + +
[% title | html %]
[% saved_message | html %] +
+ + + + + + + + + +[%- IF id %] + + + + + +[%- END %] + +[%- IF selectdepartment %] + + + + + +[%- END %] + + + + + +[%- IF id %] + +[%- END %] + + + + + + + + + + + +
[% 'Previous transnumber text' | $T8 %] [% previous_id %] . [% 'Previous transdate text' | $T8 %] [% previous_gldate %]
[% 'Reference' | $T8 %][% L.input_tag('reference', reference, size=20, readonly=id) %] + + + + + +
[% 'Date' | $T8 %][% L.date_tag('transdate', transdate, readonly=id) %]
+
[% 'Belegnummer' | $T8 %][% L.input_tag('id', id, size=20, readonly=id) %] + + + + + +
[% 'Buchungsdatum' | $T8 %][% L.date_tag('gldate', gldate, readonly=id) %]
+
[% 'Department' | $T8 %]
[% 'Description' | $T8 %][% L.areainput_tag('description', description, cols=50, readonly=id) %] + + + + + +
[% 'MwSt. inkl.' | $T8 %][% L.checkbox_tag('taxincluded', checked=taxincluded) %]
+
+ + + + + +
[% 'Mitarbeiter' | $T8 %][% L.input_tag('employee', employee, size=20, readonly=id) %]
+
+ + + + + +
[% 'OB Transaction' | $T8 %] [% L.checkbox_tag('ob_transaction' checked=ob_transaction) %][% 'CB Transaction' | $T8 %] [% L.checkbox_tag('cb_transaction' checked=cb_transaction) %]
+
[% 'Show details' | $T8 %][% L.checkbox_tag('show_details', checked=show_details, onclick='show_form_details();') %]
+ + + + + + + + + +[%- IF show_details %] + + + +[%- END %] + + + +[%- PROCESS 'gl/form_header_chart_balances_js.html' %] -- 2.20.1
[% 'Account' | $T8 %][% 'Chart balance' | $T8 %][% 'Debit' | $T8 %][% 'Credit' | $T8 %][% 'Tax' | $T8 %][% 'Taxkey' | $T8 %][% 'Source' | $T8 %][% 'Memo' | $T8 %][% 'Project Number' | $T8 %]