From: Sven Schöling Date: Thu, 17 Dec 2009 10:47:04 +0000 (+0100) Subject: T8 Filter für Templates und Anwendungsbeispiel _payments X-Git-Tag: release-2.6.1beta1~78 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c6f47607c5b8d926ca7abb222606e90313b7aaea;p=kivitendo-erp.git T8 Filter für Templates und Anwendungsbeispiel _payments --- diff --git a/SL/Template/Plugin/T8.pm b/SL/Template/Plugin/T8.pm new file mode 100644 index 000000000..79fab96bb --- /dev/null +++ b/SL/Template/Plugin/T8.pm @@ -0,0 +1,24 @@ +package SL::Template::Plugin::T8; + +use Template::Plugin::Filter; +use base qw( Template::Plugin::Filter ); + +my $locale = undef; + +sub init { + my $self = shift; + + $locale ||= Locale->new($main::myconfig{countrycode}, 'all'); + + # first arg can specify filter name + $self->install_filter($self->{ _ARGS }->[0] || 'T8'); + + return $self; +} + +sub filter { + my ($self, $text, $args) = @_; + return $locale->text($text, @{ $args || [] }); +} + +return 'SL::Template::Plugin::T8'; diff --git a/scripts/templ2t8.pl b/scripts/templ2t8.pl new file mode 100755 index 000000000..f1e5bf6b5 --- /dev/null +++ b/scripts/templ2t8.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -pli.orig + +# +# template converter -> T8 converter +# +# wanna get rid of those tags? +# no problem. use this script to fix most it. +# +# use: perl tmpl2t8.pl +# +# will save the original file as file.orig +# +s/$/[% USE T8 %]/ if $. == 1; +s/([^<]+)<\/translate>/[%- '$1' | \$T8 %]/xg; diff --git a/templates/webpages/is/_payments_de.html b/templates/webpages/is/_payments_de.html deleted file mode 100644 index aa83860f9..000000000 --- a/templates/webpages/is/_payments_de.html +++ /dev/null @@ -1,87 +0,0 @@ -[%- USE LxERP %] - - - - -[% IF is_type_credit_note %] - -[% ELSE %] - -[%- END %] - - - - - - - - -[% IF show_exchangerate %] - -[% END %] - - - - -[% FOREACH i = paid_indices %] - [% SET datepaid = 'datepaid_' _ i %] - [% SET source = 'source_' _ i %] - [% SET memo = 'memo_' _ i %] - [% SET paid = 'paid_' _ i %] - [% SET selectAR_paid_ref = 'selectAR_paid_' _ i %] - - - - - - - -[% IF show_exchangerate %] - -[% END %] - - - - - -[% END # foreach %] - - - - - - - - - - - - - - - - - - - -
ZahlungsausgängeZahlungseingänge
DatumBelegMemoBetragWechselkurs.Konto
- - - - [% SET forex = 'forex_' _ i %] - [% SET exchangerate = 'exchangerate_' _ i %] - [% IF forex %] - - [% LxERP.format_amount(exchangerate, 2) %] - [% ELSE %] - - [% END %] - ; -
Summe[% LxERP.foramt_amount(totalpaid, 2) | html %]
Fehlbetrag[% LxERP.format_amount(paid_missing, 2) | html %]
- - - diff --git a/templates/webpages/is/_payments_de.html b/templates/webpages/is/_payments_de.html new file mode 120000 index 000000000..d2ad321ac --- /dev/null +++ b/templates/webpages/is/_payments_de.html @@ -0,0 +1 @@ +_payments_master.html \ No newline at end of file diff --git a/templates/webpages/is/_payments_master.html b/templates/webpages/is/_payments_master.html index 521666192..1c39b20e3 100644 --- a/templates/webpages/is/_payments_master.html +++ b/templates/webpages/is/_payments_master.html @@ -1,25 +1,25 @@ -[%- USE LxERP %] +[%- USE LxERP %][% USE T8 %] [% IF is_type_credit_note %] - + [% ELSE %] - + [%- END %] - - - - + + + + [% IF show_exchangerate %] - + [% END %] - + @@ -66,13 +66,13 @@ - + - +
Payments[%- 'Payments' | $T8 %]Incoming Payments[%- 'Incoming Payments' | $T8 %]
DateSourceMemoAmount[%- 'Date' | $T8 %][%- 'Source' | $T8 %][%- 'Memo' | $T8 %][%- 'Amount' | $T8 %]Exch[%- 'Exch' | $T8 %]Account[%- 'Account' | $T8 %]
Total[%- 'Total' | $T8 %] [% LxERP.foramt_amount(totalpaid, 2) | html %]
Missing amount[%- 'Missing amount' | $T8 %] [% LxERP.format_amount(paid_missing, 2) | html %]