From d440aa097f47460e6022a88edf8f889db2ad0ad4 Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Thu, 3 Jan 2013 14:45:01 +0100 Subject: [PATCH] =?utf8?q?HTML=20aus=20der=20Funktion=20bin/ap.pl:form=5Ff?= =?utf8?q?ooter=20in=20ein=20Template=20=C3=BCbertragen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ar.pl | 88 ++++---------------------- templates/webpages/ar/form_footer.html | 52 +++++++++++++++ 2 files changed, 66 insertions(+), 74 deletions(-) create mode 100644 templates/webpages/ar/form_footer.html diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 6466aa24e..f8b4f0ba7 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -456,89 +456,29 @@ sub form_footer { my $locale = $main::locale; my $cgi = $::request->{cgi}; - my ($transdate, $closedto); - - my $follow_ups_block; - if ($form->{id}) { + 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|

|; + if ( @{ $follow_ups} ) { + $form->{follow_up_length} = scalar(@{$follow_ups}); + $form->{follow_up_due_length} = sum(map({ $_->{due} * 1 } @{ $follow_ups })); } } - print qq| - -$follow_ups_block - - - - -| -. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) -. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]) -. qq| - -
-|; - - if (!$form->{id} && $form->{draft_id}) { - print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft', - '-value' => 1, '-checked' => $form->{remove_draft}, - '-label' => '')) . - qq| 
|); - } - - $transdate = $form->datetonum($form->{transdate}, \%myconfig); - $closedto = $form->datetonum($form->{closedto}, \%myconfig); + my $transdate = $form->datetonum($form->{transdate}, \%myconfig); + my $closedto = $form->datetonum($form->{closedto}, \%myconfig); - print qq|\n|; + $form->{is_closed} = $transdate <= $closedto; # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it - print qq| | - if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq ""))); - - if ($form->{id}) { - if ($form->{radier}) { - print qq| - - |; - } - if ($transdate > $closedto) { - print qq| - |; - } - print qq| - - |; + $form->{show_storno_button} = + $form->{id} && + !IS->has_storno(\%myconfig, $form, 'ar') && + !IS->is_storno(\%myconfig, $form, 'ar') && + ($form->{totalpaid} == 0 || $form->{totalpaid} eq ""); - } else { - if ($transdate > $closedto) { - print qq| | . - NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit')); - } - } + $form->{show_mark_as_paid_button} = $form->{id} && $::instance_conf->get_ar_show_mark_as_paid(); - # button for saving history - if($form->{id} ne "") { - print qq| {id}); name=history id=history value=| . $locale->text('history') . qq|> |; - } - # /button for saving history - # mark_as_paid button - if(($form->{id} ne "") && $::instance_conf->get_ar_show_mark_as_paid) { - print qq||; - } - # /mark_as_paid button - - print " - -"; + print $::form->parse_html_template('ar/form_footer'); $main::lxdebug->leave_sub(); } diff --git a/templates/webpages/ar/form_footer.html b/templates/webpages/ar/form_footer.html new file mode 100644 index 000000000..6fa8b4441 --- /dev/null +++ b/templates/webpages/ar/form_footer.html @@ -0,0 +1,52 @@ +[% USE LxERP %] +[% USE T8 %] + + [% IF ( follow_up_length && follow_up_due_length ) %] + [% LxERP.t8('There are #1 unfinished follow-ups of which #2 are due.', follow_up_length , follow_up_due_length) %] + [% END %] + + + + + + +
+ + [% IF ( !id && draft_id ) %] + + + [% END %] + +
+ + + + [% IF ( show_storno_button ) %] + + [% END %] + + [% IF ( id ) %] + [% IF ( radier ) %] + + + [% END %] + + [% IF ( !is_closed ) %] + + [% END %] + + + + + [% ELSE %] + [% IF ( !is_closed ) %] + + + [% END %] + [% END %] + + [% IF ( show_mark_as_paid_button ) %] + + [% END %] + + -- 2.20.1