Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d440aa09

Von Thomas Heck vor fast 12 Jahren hinzugefügt

  • ID d440aa097f47460e6022a88edf8f889db2ad0ad4
  • Vorgänger 8b8f7572
  • Nachfolger 2da79284

HTML aus der Funktion bin/ap.pl:form_footer in ein Template übertragen.

Unterschiede anzeigen:

bin/mozilla/ar.pl
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|&nbsp;<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
}
templates/webpages/ar/form_footer.html
1
[% USE LxERP %]
2
[% USE T8 %]
3

  
4
  [% IF ( follow_up_length && follow_up_due_length ) %]
5
    [% LxERP.t8('There are #1 unfinished follow-ups of which #2 are due.', follow_up_length , follow_up_due_length) %]
6
  [% END %]
7

  
8
  <input type="hidden" name="gldate" value="[% gldate | html %]">
9
  <input type="hidden" name="callback" value="[% callback | html %]">
10
  <input type="hidden" name="draft_id" value="[% draft_id | html %]">
11
  <input type="hidden" name="draft_description" value="[% draft_description | html %]">
12

  
13
  <br>
14

  
15
  [% IF ( !id && draft_id ) %]
16
    <input type="checkbox" name="remove_draft" id="remove_draft" value="1" [% IF ( remove_draft ) %]checked[% END %]>
17
    <label for="remove_draft">[% 'Remove draft when posting' | $T8 %]</label>
18
  [% END %]
19

  
20
  <br>
21

  
22
  <input class="submit" type="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
23

  
24
  [% IF ( show_storno_button ) %]
25
    <input class="submit" type="submit" name="action" value="[% 'Storno' | $T8 %]">
26
  [% END %]
27

  
28
  [% IF ( id ) %]
29
    [% IF ( radier ) %]
30
      <input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
31
      <input class="submit" type="submit" name="action" value="[% 'Delete' | $T8 %]">
32
    [% END %]
33

  
34
    [% IF ( !is_closed ) %]
35
      <input class="submit" type="submit" name="action" value="[% 'Use As New' | $T8 %]">
36
    [% END %]
37

  
38
    <input class="submit" type="submit" name="action" value="[% 'Post Payment' | $T8 %]">
39
    <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
40
    <input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
41
  [% ELSE %]
42
    [% IF ( !is_closed ) %]
43
      <input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
44
      <input class="submit" type="submit" name="action" value="[% 'Save draft' | $T8 %]">
45
    [% END %]
46
  [% END %]
47

  
48
  [% IF ( show_mark_as_paid_button ) %]
49
    <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
50
  [% END %]
51

  
52
</form>

Auch abrufbar als: Unified diff