From c6f47607c5b8d926ca7abb222606e90313b7aaea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 17 Dec 2009 11:47:04 +0100 Subject: [PATCH] =?utf8?q?T8=20Filter=20f=C3=BCr=20Templates=20und=20Anwen?= =?utf8?q?dungsbeispiel=20=5Fpayments?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Template/Plugin/T8.pm | 24 ++++++ scripts/templ2t8.pl | 14 ++++ templates/webpages/is/_payments_de.html | 88 +-------------------- templates/webpages/is/_payments_master.html | 22 +++--- 4 files changed, 50 insertions(+), 98 deletions(-) create mode 100644 SL/Template/Plugin/T8.pm create mode 100755 scripts/templ2t8.pl mode change 100644 => 120000 templates/webpages/is/_payments_de.html 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 @@ - + - + -- 2.20.1
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 %]