X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIC.pm;h=868fb741748649aa43dbf15ed6c1666e13a46a0e;hb=f24cf1f5ab8428ced545a382d0f0179ae6f40a81;hp=16ebef0b81a845eda2e6810fdb3f300f140b5330;hpb=df52f0a4ee134e780337a7822fdf64ab43d619cf;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index 16ebef0b8..868fb7417 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 @@ -790,7 +806,7 @@ sub retrieve_accounts { SQL my $query_tax = <{"taxaccounts_$index"} = $ref->{"accno"}; $form->{"taxaccounts"} .= "$ref->{accno} "if $form->{"taxaccounts"} !~ /$ref->{accno}/; - $form->{"$ref->{accno}_${_}"} = $ref->{$_} for qw(rate description taxnumber); + $form->{"$ref->{accno}_${_}"} = $ref->{$_} for qw(rate description taxnumber tax_id); } $sth_tax->finish;