X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/9e8147d629899270fb53ae28028ff93c96d0c82e..52f5223a1dcf:/SL/IC.pm diff --git a/SL/IC.pm b/SL/IC.pm index 16ebef0b8..0983e2a8a 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -526,6 +526,22 @@ sub all_parts { push @bind_vars, @cvar_values; } + # simple search for assemblies by items used in assemblies + if ($form->{bom} eq '2' && $form->{l_assembly}) { + # nuke where clause and bind vars + $where_clause = ' 1=1 AND p.id in (SELECT id from assembly where parts_id IN ' . + ' (select id from parts where 1=1 AND '; + @bind_vars = (); + # use only like filter for items used in assemblies + foreach (@like_filters) { + next unless $form->{$_}; + $form->{"l_$_"} = '1'; # show the column + $where_clause .= " $_ ILIKE ? "; + push @bind_vars, like($form->{$_}); + } + $where_clause .='))'; + } + my $query = <<" SQL"; SELECT DISTINCT $select_clause FROM parts p