456 |
456 |
my $locale = $main::locale;
|
457 |
457 |
my $cgi = $::request->{cgi};
|
458 |
458 |
|
459 |
|
my ($transdate, $closedto);
|
460 |
|
|
461 |
|
my $follow_ups_block;
|
462 |
|
if ($form->{id}) {
|
|
459 |
if ( $form->{id} ) {
|
463 |
460 |
my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
|
464 |
|
|
465 |
|
if (@{ $follow_ups} ) {
|
466 |
|
my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups };
|
467 |
|
$follow_ups_block = qq|<p>| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|</p>|;
|
|
461 |
if ( @{ $follow_ups} ) {
|
|
462 |
$form->{follow_up_length} = scalar(@{$follow_ups});
|
|
463 |
$form->{follow_up_due_length} = sum(map({ $_->{due} * 1 } @{ $follow_ups }));
|
468 |
464 |
}
|
469 |
465 |
}
|
470 |
466 |
|
471 |
|
print qq|
|
472 |
|
|
473 |
|
$follow_ups_block
|
474 |
|
|
475 |
|
<input name=gldate type=hidden value="| . Q($form->{gldate}) . qq|">
|
476 |
|
|
477 |
|
<input name=callback type=hidden value="$form->{callback}">
|
478 |
|
|
|
479 |
|
. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
|
480 |
|
. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
|
481 |
|
. qq|
|
482 |
|
|
483 |
|
<br>
|
484 |
|
|;
|
485 |
|
|
486 |
|
if (!$form->{id} && $form->{draft_id}) {
|
487 |
|
print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
|
488 |
|
'-value' => 1, '-checked' => $form->{remove_draft},
|
489 |
|
'-label' => '')) .
|
490 |
|
qq| <label for="remove_draft">| .
|
491 |
|
$locale->text("Remove draft when posting") .
|
492 |
|
qq|</label><br>|);
|
493 |
|
}
|
494 |
|
|
495 |
|
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
496 |
|
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
|
467 |
my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
|
468 |
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
497 |
469 |
|
498 |
|
print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">\n|;
|
|
470 |
$form->{is_closed} = $transdate <= $closedto;
|
499 |
471 |
|
500 |
472 |
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
|
501 |
|
print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
|
502 |
|
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq "")));
|
503 |
|
|
504 |
|
if ($form->{id}) {
|
505 |
|
if ($form->{radier}) {
|
506 |
|
print qq|
|
507 |
|
<input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">
|
508 |
|
<input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|"> |;
|
509 |
|
}
|
510 |
|
if ($transdate > $closedto) {
|
511 |
|
print qq|
|
512 |
|
<input class=submit type=submit name=action value="| . $locale->text('Use As New') . qq|"> |;
|
513 |
|
}
|
514 |
|
print qq|
|
515 |
|
<input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
|
516 |
|
<input type="button" class="submit" onclick="follow_up_window()" value="|
|
517 |
|
. $locale->text('Follow-Up')
|
518 |
|
. qq|"> |;
|
|
473 |
$form->{show_storno_button} =
|
|
474 |
$form->{id} &&
|
|
475 |
!IS->has_storno(\%myconfig, $form, 'ar') &&
|
|
476 |
!IS->is_storno(\%myconfig, $form, 'ar') &&
|
|
477 |
($form->{totalpaid} == 0 || $form->{totalpaid} eq "");
|
519 |
478 |
|
520 |
|
} else {
|
521 |
|
if ($transdate > $closedto) {
|
522 |
|
print qq| <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> | .
|
523 |
|
NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
|
524 |
|
}
|
525 |
|
}
|
|
479 |
$form->{show_mark_as_paid_button} = $form->{id} && $::instance_conf->get_ar_show_mark_as_paid();
|
526 |
480 |
|
527 |
|
# button for saving history
|
528 |
|
if($form->{id} ne "") {
|
529 |
|
print qq| <input type=button class=submit onclick=set_history_window($form->{id}); name=history id=history value=| . $locale->text('history') . qq|> |;
|
530 |
|
}
|
531 |
|
# /button for saving history
|
532 |
|
# mark_as_paid button
|
533 |
|
if(($form->{id} ne "") && $::instance_conf->get_ar_show_mark_as_paid) {
|
534 |
|
print qq|<input type="submit" class="submit" name="action" value="|
|
535 |
|
. $locale->text('mark as paid') . qq|">|;
|
536 |
|
}
|
537 |
|
# /mark_as_paid button
|
538 |
|
|
539 |
|
print "
|
540 |
|
</form>
|
541 |
|
";
|
|
481 |
print $::form->parse_html_template('ar/form_footer');
|
542 |
482 |
|
543 |
483 |
$main::lxdebug->leave_sub();
|
544 |
484 |
}
|
HTML aus der Funktion bin/ap.pl:form_footer in ein Template übertragen.