From: Sven Schöling Date: Wed, 18 Jan 2012 14:42:09 +0000 (+0100) Subject: gl::form_footer auf template umgeschrieben. X-Git-Tag: release-2.7.0beta1~33 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=750ac970f34b91bea202a177f9bd07e77476049d;p=kivitendo-erp.git gl::form_footer auf template umgeschrieben. --- diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index b42282947..a4f2d1dfe 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -897,99 +897,25 @@ sub form_header { } sub form_footer { - $main::lxdebug->enter_sub(); - - $main::auth->assert('general_ledger'); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - my $cgi = $::request->{cgi}; - - my $follow_ups_block; - if ($form->{id}) { - my $follow_ups = FU->follow_ups('trans_id' => $form->{id}); - - if (@{ $follow_ups} ) { - my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups }; - $follow_ups_block = qq|

| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|

|; - } - } - - my ($dec) = ($form->{totaldebit} =~ /\.(\d+)/); - $dec = length $dec; - my $decimalplaces = ($dec > 2) ? $dec : 2; - my $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; - - map { - $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, " ") - } qw(totaldebit totalcredit); - - print qq| - - $form->{totaldebit} - $form->{totalcredit} - - - - - - - - - -$follow_ups_block - -
-|; - - my $transdate = $form->datetonum($form->{transdate}, \%myconfig); - my $closedto = $form->datetonum($form->{closedto}, \%myconfig); - - if ($form->{id}) { - - if (!$form->{storno}) { - print qq||; - } - - # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich - if (!$form->{locked} && $radieren) { - print qq| - - |; - } - - print qq| - - |; + $::lxdebug->enter_sub; + $::auth->assert('general_ledger'); - } else { - if ($form->{draft_id}) { - my $remove_draft_checked = $form->{remove_draft} ? 'checked' : ''; - print qq|

\n| - . qq| | - . qq| \n| - . qq|

\n|; - } + my ($follow_ups, $follow_ups_due); - print qq| - - | - . NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit')) - . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) - . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]); + if ($::form->{id}) { + $follow_ups = FU->follow_ups('trans_id' => $::form->{id}); + $follow_ups_due = sum map { $_->{due} * 1 } @{ $follow_ups || [] }; } - print " - + my $radieren = $::form->current_date(\%::myconfig) eq $::form->{gldate}; - - -"; - $main::lxdebug->leave_sub(); + print $::form->parse_html_template('gl/form_footer', { + radieren => $radieren, + follow_ups => $follow_ups, + follow_ups_due => $follow_ups_due, + }); + $::lxdebug->leave_sub; } sub delete { diff --git a/templates/webpages/gl/form_footer.html b/templates/webpages/gl/form_footer.html new file mode 100644 index 000000000..48ad9952c --- /dev/null +++ b/templates/webpages/gl/form_footer.html @@ -0,0 +1,52 @@ +[%- USE HTML %] +[%- USE LxERP %] +[%- USE T8 %] +[%- USE L %] + + [% LxERP.format_amount(totaldebit, 2) | html %] + [% LxERP.format_amount(totalcredit, 2) | html %] + + + + + + + + + +[%- IF id && follow_ups.size %] +

[% LxERP.t8('There are #1 unfinished follow-ups of which #2 are due.', follow_ups.size , follow_ups_due) %]

+[%- END %] + +
+ +[%- IF id %] + + [%- IF !storno %] + [% L.submit_tag('action', LxERP.t8('Storno')) %] + [%- END %] + + [% IF !locked && radieren %] + [% L.submit_tag('action', LxERP.t8('Post'), accesskey='b') %] + [% L.submit_tag('action', LxERP.t8('Delete')) %] + [%- END %] + [% L.submit_tag('action', LxERP.t8('Update'), id='update_button') %] + [% L.submit_tag('action', LxERP.t8('Follow-Up'), onclick='follow_up_window()') %] + +[%- ELSE %] + + [%- IF draft_id %] +

[% L.checkbox_tag('remove_draft', checked=remove_draft, label=LxERP.t8('Remove Draft')) %]

+ [%- END %] + + [% L.submit_tag('action', LxERP.t8('Update'), id='update_button') %] + [% L.submit_tag('action', LxERP.t8('Post')) %] + [% L.submit_tag('action', LxERP.t8('Save Draft')) %] + [% L.hidden_tag('draft_id', draft_id) %] + [% L.hidden_tag('draft_description', draft_description) %] +[%- END %] + + + + +