X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FCVar.pm;fp=SL%2FCVar.pm;h=637f129c880481d0b281461b6679255d8ad4d605;hp=a905edee7b7d70fd203dfc8aaec66ec734f4bf2f;hb=b293ff8ad52fc76ba0c44783e3982418114d6b08;hpb=d4925a8b60f04674885e30d9316dc0263f8b9a84 diff --git a/SL/CVar.pm b/SL/CVar.pm index a905edee7..637f129c8 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -10,6 +10,7 @@ use Data::Dumper; use SL::DBUtils; use SL::MoreCommon qw(listify); +use SL::Presenter::Text; use SL::Util qw(trim); use SL::DB; @@ -46,7 +47,7 @@ SQL } elsif ($config->{type} eq 'number') { $config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i); - } elsif ($config->{type} eq 'textfield') { + } elsif ($config->{type} =~ m{^(?:html|text)field$}) { $config->{width} = 30; $config->{height} = 5; $config->{width} = $1 if ($config->{options} =~ m/width=(\d+)/i); @@ -112,7 +113,7 @@ sub get_custom_variables { my $custom_variables = $self->get_configs(module => $params{module}); foreach my $cvar (@{ $custom_variables }) { - if ($cvar->{type} eq 'textfield') { + if ($cvar->{type} =~ m{^(?:html|text)field}) { $cvar->{width} = 30; $cvar->{height} = 5; @@ -271,7 +272,7 @@ sub _save_custom_variables { my $value = $params{variables}->{"$params{name_prefix}cvar_$config->{name}$params{name_postfix}"}; - if (($config->{type} eq 'text') || ($config->{type} eq 'textfield') || ($config->{type} eq 'select')) { + if (any { $config->{type} eq $_ } qw(text textfield htmlfield select)) { push @values, undef, undef, $value, undef; } elsif (($config->{type} eq 'date') || ($config->{type} eq 'timestamp')) { @@ -375,7 +376,7 @@ sub build_filter_query { my (@sub_values, @sub_where, $not); - if (($config->{type} eq 'text') || ($config->{type} eq 'textfield')) { + if (any { $config->{type} eq $_ } qw(text textfield htmlfield)) { next unless ($params{filter}->{$name}); push @sub_where, qq|cvar.text_value ILIKE ?|; @@ -525,6 +526,7 @@ sub add_custom_variables_to_report { : $cfg->{type} eq 'vendor' ? (SL::DB::Manager::Vendor->find_by(id => 1*$ref->{number_value}) || SL::DB::Vendor->new)->name : $cfg->{type} eq 'part' ? (SL::DB::Manager::Part->find_by(id => 1*$ref->{number_value}) || SL::DB::Part->new)->partnumber : $cfg->{type} eq 'bool' ? ($ref->{bool_value} ? $locale->text('Yes') : $locale->text('No')) + : $cfg->{type} eq 'htmlfield' ? SL::Presenter::Text::stripped_html($ref->{text_value}) : $ref->{text_value}; } }