X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/be42a45043cab936e86e91aa895c6fc25bab079f..0bf92081282bc1cad1d7cec16e55f13ca584ff11:/SL/CVar.pm diff --git a/SL/CVar.pm b/SL/CVar.pm index 0ace06902..3dba8b217 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -9,6 +9,7 @@ use Data::Dumper; use SL::DBUtils; use SL::MoreCommon qw(listify); +use SL::Util qw(trim); sub get_configs { $main::lxdebug->enter_sub(); @@ -355,7 +356,7 @@ sub build_filter_query { 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}); @@ -406,7 +407,7 @@ sub build_filter_query { } 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}); @@ -418,12 +419,12 @@ sub build_filter_query { 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) { @@ -724,7 +725,7 @@ SL::CVar.pm - Custom Variables module 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 is saved as a function of config_id, and the trans_id