Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c6f47607

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID c6f47607c5b8d926ca7abb222606e90313b7aaea
  • Vorgänger 1465da30
  • Nachfolger c1bdb003

T8 Filter für Templates und Anwendungsbeispiel _payments

Unterschiede anzeigen:

SL/Template/Plugin/T8.pm
1
package SL::Template::Plugin::T8;
2

  
3
use Template::Plugin::Filter;
4
use base qw( Template::Plugin::Filter );
5

  
6
my $locale = undef;
7

  
8
sub init {
9
    my $self = shift;
10

  
11
    $locale ||= Locale->new($main::myconfig{countrycode}, 'all');
12

  
13
    # first arg can specify filter name
14
    $self->install_filter($self->{ _ARGS }->[0] || 'T8');
15

  
16
    return $self;
17
}
18

  
19
sub filter {
20
    my ($self, $text, $args) = @_;
21
    return $locale->text($text, @{ $args || [] });
22
}
23

  
24
return 'SL::Template::Plugin::T8';
scripts/templ2t8.pl
1
#!/usr/bin/perl -pli.orig
2

  
3
#
4
# template converter -> T8 converter
5
#
6
# wanna get rid of those <translate> tags?
7
# no problem. use this script to fix most it.
8
#
9
# use: perl tmpl2t8.pl <file>
10
#
11
# will save the original file as file.orig
12
#
13
s/$/[% USE T8 %]/ if $. == 1;
14
s/<translate>([^<]+)<\/translate>/[%- '$1' | \$T8 %]/xg;
templates/webpages/is/_payments_de.html
1
[%- USE LxERP %]
2
  <tr>
3
   <td>
4
    <table width="100%">
5
     <tr class="listheading">
6
[% IF is_type_credit_note %]
7
      <th colspan="6" class="listheading">Zahlungsausg?nge</th>
8
[% ELSE %]
9
      <th colspan="6" class="listheading">Zahlungseing?nge</th>
10
[%- END %]
11
     </tr>
12

  
13

  
14
     <tr>
15
      <th>Datum</th>
16
      <th>Beleg</th>
17
      <th>Memo</th>
18
      <th>Betrag</th>
19
[% IF show_exchangerate %]
20
      <th>Wechselkurs.</th>
21
[% END %]
22
      <th>Konto</th>
23
     </tr>
24

  
25

  
26
[% FOREACH i = paid_indices %]
27
  [% SET datepaid      = 'datepaid_'      _ i %]
28
  [% SET source        = 'source_'        _ i %]
29
  [% SET memo          = 'memo_'          _ i %]
30
  [% SET paid          = 'paid_'          _ i %]
31
  [% SET selectAR_paid_ref = 'selectAR_paid_' _ i %]
32

  
33
     <tr>
34

  
35
    <td align="center">
36
      <input id="datepaid_[% i %]" name="datepaid_[% i %]" size="11" title="[% dateformat %]" value="[% $datepaid %]">
37
      <input type="button" name="datepaid_[% i %]" id="trigger_datepaid_[% i %]" value="?">
38
     </td>
39
     <td align=center><input name="source_[% i %]" size="11" value="[% $source %]"></td>
40
     <td align="center"><input name="memo_[% i %]" size="11" value="[% $memo %]"></td>
41
     <td align="center"><input name="paid_[% i %]" size="11" value="[% LxERP.format_amount($paid, 2, 1) %]"></td>
42
[% IF show_exchangerate %]
43
     <td align="center">
44
  [% SET forex        = 'forex_'        _ i %]
45
  [% SET exchangerate = 'exchangerate_' _ i %]
46
  [% IF forex %]
47
        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 2) %]">
48
        [% LxERP.format_amount(exchangerate, 2) %]
49
  [% ELSE %]
50
        <input name="exchangerate_[% i %]" size="10" value="[% LxERP.format_amount($exchangerate, 2, 1) %]">
51
  [% END %]
52
        <input type="hidden" name="forex_[% i %]" value="[% $forex %]">;
53
     </td>
54
[% END %]
55
     <td align="center"><select name="AR_paid_[% i %]">[% $selectAR_paid_ref %]</select></td>
56

  
57
    </tr>
58
    <script type='text/javascript'>
59
     Calendar.setup({ inputField : "datepaid_[% i %]", ifFormat :"[% myconfig_jsc_dateformat %]", align : "TR", button : "trigger_datepaid_[% i %]" });
60
     $('input[name="paid_[% i %]"]').blur(function(){ check_right_number_format(this) });
61
     $('#datepaid_[% i %]').blur(function(){ check_right_date_format(this) });
62
    </script>
63

  
64
[% END # foreach %]
65

  
66
    <tr>
67
      <td></td>
68
      <td></td>
69
      <td align="center">Summe</td>
70
      <td align="center">[% LxERP.foramt_amount(totalpaid, 2) | html %]</td>
71
    </tr>
72
    <tr>
73
      <td></td>
74
      <td></td>
75
      <td align="center">Fehlbetrag</td>
76
      <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
77
    </tr>
78

  
79
     <input type="hidden" name="paidaccounts" value="[% paidaccounts %]">
80
     <input type="hidden" name="selectAR_paid" value="[% selectAR_paid %]">
81
     <input type="hidden" name="oldinvtotal" value="[% oldinvtotal %]">
82

  
83
     <input type="hidden" name="oldtotalpaid" value="[% totalpaid %]">
84
    </table>
85

  
86
    </td>
87
  </tr>
templates/webpages/is/_payments_de.html
1
_payments_master.html
templates/webpages/is/_payments_master.html
1
[%- USE LxERP %]
1
[%- USE LxERP %][% USE T8 %]
2 2
  <tr>
3 3
   <td>
4 4
    <table width="100%">
5 5
     <tr class="listheading">
6 6
[% IF is_type_credit_note %]
7
      <th colspan="6" class="listheading"><translate>Payments</translate></th>
7
      <th colspan="6" class="listheading">[%- 'Payments' | $T8 %]</th>
8 8
[% ELSE %]
9
      <th colspan="6" class="listheading"><translate>Incoming Payments</translate></th>
9
      <th colspan="6" class="listheading">[%- 'Incoming Payments' | $T8 %]</th>
10 10
[%- END %]
11 11
     </tr>
12 12

  
13 13

  
14 14
     <tr>
15
      <th><translate>Date</translate></th>
16
      <th><translate>Source</translate></th>
17
      <th><translate>Memo</translate></th>
18
      <th><translate>Amount</translate></th>
15
      <th>[%- 'Date' | $T8 %]</th>
16
      <th>[%- 'Source' | $T8 %]</th>
17
      <th>[%- 'Memo' | $T8 %]</th>
18
      <th>[%- 'Amount' | $T8 %]</th>
19 19
[% IF show_exchangerate %]
20
      <th><translate>Exch</translate></th>
20
      <th>[%- 'Exch' | $T8 %]</th>
21 21
[% END %]
22
      <th><translate>Account</translate></th>
22
      <th>[%- 'Account' | $T8 %]</th>
23 23
     </tr>
24 24

  
25 25

  
......
66 66
    <tr>
67 67
      <td></td>
68 68
      <td></td>
69
      <td align="center"><translate>Total</translate></td>
69
      <td align="center">[%- 'Total' | $T8 %]</td>
70 70
      <td align="center">[% LxERP.foramt_amount(totalpaid, 2) | html %]</td>
71 71
    </tr>
72 72
    <tr>
73 73
      <td></td>
74 74
      <td></td>
75
      <td align="center"><translate>Missing amount</translate></td>
75
      <td align="center">[%- 'Missing amount' | $T8 %]</td>
76 76
      <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
77 77
    </tr>
78 78

  

Auch abrufbar als: Unified diff