Revision db7c3a52
Von Sven Schöling vor etwa 13 Jahren hinzugefügt
SL/CVar.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
|
5 | 5 |
use List::Util qw(first); |
6 |
use Scalar::Util qw(blessed); |
|
6 | 7 |
use Data::Dumper; |
7 | 8 |
|
8 | 9 |
use SL::DBUtils; |
... | ... | |
706 | 707 |
return sub { !$invalids{+shift} }; |
707 | 708 |
} |
708 | 709 |
|
710 |
sub parse { |
|
711 |
my ($self, $value, $config) = @_; |
|
712 |
|
|
713 |
return $::form->parse_amount(\%::myconfig, $value) if $config->{type} eq 'number'; |
|
714 |
return DateTime->from_lxoffice($value) if $config->{type} eq 'date'; |
|
715 |
return !ref $value ? SL::DB::Manager::Customer->find_by(id => $value * 1) : $value if $config->{type} eq 'customer'; |
|
716 |
return $value; |
|
717 |
} |
|
718 |
|
|
709 | 719 |
1; |
710 | 720 |
|
711 | 721 |
__END__ |
bin/mozilla/io.pl | ||
---|---|---|
1796 | 1796 |
$description = $cvar->{description} . ' '; |
1797 | 1797 |
} |
1798 | 1798 |
|
1799 |
my $form_key = "ic_cvar_" . $cvar->{name} . "_$params{row}"; |
|
1800 |
|
|
1799 | 1801 |
push @{ $params{ROW2} }, { |
1800 | 1802 |
line_break => $num_visible_cvars == 1, |
1801 | 1803 |
description => $description, |
... | ... | |
1806 | 1808 |
name_prefix => 'ic_', |
1807 | 1809 |
name_postfix => "_$params{row}", |
1808 | 1810 |
valid => $cvar->{valid}, |
1809 |
value => $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"},
|
|
1811 |
value => CVar->parse($::form->{$form_key}, $cvar),
|
|
1810 | 1812 |
} |
1811 | 1813 |
}; |
1812 | 1814 |
} |
templates/webpages/amcvar/render_inputs_block.html | ||
---|---|---|
1 | 1 |
[%- USE T8 %] |
2 | 2 |
[%- USE HTML %] |
3 | 3 |
[%- USE L %] |
4 |
[%- USE LxERP %] |
|
4 | 5 |
[%- BLOCK cvar_name %][% HTML.escape(cvar.name_prefix) _ "cvar_" _ HTML.escape(cvar.var.name) _ HTML.escape(cvar.name_postfix) -%][% END %] |
5 | 6 |
[%- BLOCK cvar_inputs %] |
6 | 7 |
[% render_input_blocks__cvar_name = PROCESS cvar_name %] |
... | ... | |
27 | 28 |
[%- END %] |
28 | 29 |
</select> |
29 | 30 |
[%- ELSIF cvar.var.type == 'customer' %] |
30 |
[% render_input_blocks__cvar_name = PROCESS cvar_name %][% L.customer_picker(render_input_blocks__cvar_name, cvar.value) %] |
|
31 |
[%- L.customer_picker(render_input_blocks__cvar_name, cvar.value) %] |
|
32 |
|
|
33 |
[%- ELSIF cvar.var.type == 'number' %] |
|
34 |
[%- L.input_tag(render_input_blocks__cvar_name, LxERP.format_amount(cvar.value, -2)) %] |
|
35 |
|
|
31 | 36 |
[%- ELSE %] |
32 | 37 |
<input name="[% PROCESS cvar_name %]" value="[% HTML.escape(cvar.value) %]" [%- IF cvar.var.maxlength %] maxlength="[% HTML.escape(cvar.var.maxlength) %]"[% END -%]> |
33 | 38 |
[%- END %] |
Auch abrufbar als: Unified diff
cvars in aufträgen bei update korrekt parsen und formatieren