X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=a05a9717869dd96aa7471b0ab4be194de897089a;hb=42dfa9a7030e7d06288385076e348d34ec809128;hp=6466aa24e03f018cc93027b0c9c41bb812967e56;hpb=4486e3bc8eb00c37cf8029e663eb94b4b9c5346a;p=kivitendo-erp.git
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index 6466aa24e..a05a97178 100644
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -146,18 +146,13 @@ sub create_links {
my $form = $main::form;
my %myconfig = %main::myconfig;
- my ($duedate, $taxincluded);
-
$form->create_links("AR", \%myconfig, "customer");
- $duedate = $form->{duedate};
- $taxincluded = $form->{taxincluded};
- my $id = $form->{id};
+ my %saved = map { ($_ => $form->{$_}) } qw(direct_debit duedate id taxincluded);
+
IS->get_customer(\%myconfig, \%$form);
- $form->{taxincluded} = $taxincluded;
- $form->{id} = $id;
- $form->{duedate} = $duedate if $duedate;
+ $form->{$_} = $saved{$_} for keys %saved;
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
$form->{rowcount} = 1;
@@ -456,89 +451,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|
-
- |;
-
- } else {
- if ($transdate > $closedto) {
- print qq| | .
- NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
- }
- }
+ $form->{show_storno_button} =
+ $form->{id} &&
+ !IS->has_storno(\%myconfig, $form, 'ar') &&
+ !IS->is_storno(\%myconfig, $form, 'ar') &&
+ ($form->{totalpaid} == 0 || $form->{totalpaid} eq "");
- # 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
+ $form->{show_mark_as_paid_button} = $form->{id} && $::instance_conf->get_ar_show_mark_as_paid();
- print "
-
-";
+ print $::form->parse_html_template('ar/form_footer');
$main::lxdebug->leave_sub();
}