use SL::DBUtils;
use SL::MoreCommon qw(listify);
+use SL::Util qw(trim);
sub get_configs {
$main::lxdebug->enter_sub();
next unless ($params{filter}->{$name});
push @sub_where, qq|cvar.text_value ILIKE ?|;
- push @sub_values, '%' . $params{filter}->{$name} . '%'
+ push @sub_values, like($params{filter}->{$name});
} elsif ($config->{type} eq 'select') {
next unless ($params{filter}->{$name});
}
push @sub_where, qq|cvar.number_value $op ?|;
- push @sub_values, $form->parse_amount($myconfig, $params{filter}->{$name});
+ push @sub_values, $form->parse_amount($myconfig, trim($params{filter}->{$name}));
} elsif ($config->{type} eq 'bool') {
next unless ($params{filter}->{$name});
my $table = $config->{type};
push @sub_where, qq|cvar.number_value * 1 IN (SELECT id FROM $table WHERE name ILIKE ?)|;
- push @sub_values, "%$params{filter}->{$name}%";
+ push @sub_values, like($params{filter}->{$name});
} elsif ($config->{type} eq 'part') {
next unless $params{filter}->{$name};
push @sub_where, qq|cvar.number_value * 1 IN (SELECT id FROM parts WHERE partnumber ILIKE ?)|;
- push @sub_values, "%$params{filter}->{$name}%";
+ push @sub_values, like($params{filter}->{$name});
}
if (@sub_where) {
Suppose the following scenario:
-You have a lot of parts in your database, and a set of properties cofigured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display.
+You have a lot of parts in your database, and a set of properties configured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display.
Validity is assumed. If you modify validity, you actually save B<invalidity>.
Invalidity is saved as a function of config_id, and the trans_id