]> wagnertech.de Git - mfinanz.git/blobdiff - SL/CVar.pm
Erfolgsrechnung
[mfinanz.git] / SL / CVar.pm
index 0ace069027da47f263262c49e4fa1f9e40a73fc9..3dba8b217d009453697f57540aa1a8940b1b8637 100644 (file)
@@ -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>.
 Invalidity is saved as a function of config_id, and the trans_id