From: Sven Schöling Date: Wed, 12 Oct 2011 14:55:54 +0000 (+0200) Subject: typ customer korrekt ans template system übergeben X-Git-Tag: release-2.7.0beta1~231 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d729e3287170e929ff0306855d33b823a692f62d;p=kivitendo-erp.git typ customer korrekt ans template system übergeben --- diff --git a/SL/CVar.pm b/SL/CVar.pm index 240822278..bd58cbd7e 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -716,6 +716,16 @@ sub parse { return $value; } +sub format_to_template { + my ($self, $value, $config) = @_; + # stupid template expects everything formated. except objects + # do not use outside of print routines for legacy templates + + return $::form->parse_amount(\%::myconfig, $value) if $config->{type} eq 'number'; + return $value->to_lxoffice if $config->{type} eq 'date' && blessed $value && $value->can('to_lxoffice'); + return $value; +} + 1; __END__ diff --git a/SL/DO.pm b/SL/DO.pm index f6c56b6f8..17d896f6e 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -888,7 +888,9 @@ sub order_details { } } - map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; + push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, + CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) + for @{ $ic_cvar_configs }; } $h_pg->finish(); diff --git a/SL/IS.pm b/SL/IS.pm index da801fd52..bd385ef7d 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -353,7 +353,9 @@ sub invoice_details { $sth->finish; } - map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; + push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, + CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) + for @{ $ic_cvar_configs }; } } @@ -877,7 +879,7 @@ sub post_invoice { # record payments and offsetting AR if (!$form->{storno}) { for my $i (1 .. $form->{paidaccounts}) { - + if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) { diff --git a/SL/OE.pm b/SL/OE.pm index 61360996b..cfe5e25b1 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1293,7 +1293,9 @@ sub order_details { $sth->finish; } - map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; + push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, + CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) + for @{ $ic_cvar_configs }; } }