use SL::DBUtils;
use SL::MoreCommon qw(listify);
+use SL::Presenter::Text;
use SL::Util qw(trim);
use SL::DB;
} 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);
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;
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')) {
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 ?|;
: $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};
}
}