X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIC.pm;h=2a9460745cac60b075bf1840fc3528b65758b792;hb=1268bf670c06f5a66ad78a75e41ad6c15061d9bc;hp=5ddf2c8625fcfed11dc0a48230e1d0b6f3bb67c8;hpb=d1054383fa90478db0424f5dc255d5836bc494d7;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index 5ddf2c862..2a9460745 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -524,15 +524,17 @@ sub all_parts { # simple search for assemblies by items used in assemblies if ($form->{bom} eq '2' && $form->{l_assembly}) { + # assembly_qty is the column name + $form->{l_assembly_qty} = 1; # 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 '; + ' (select id from parts where 1=1'; @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 ? "; + $where_clause .= " AND $_ ILIKE ? "; push @bind_vars, like($form->{$_}); } $where_clause .='))'; @@ -547,7 +549,6 @@ sub all_parts { $order_clause $limit_clause SQL - $form->{parts} = selectall_hashref_query($form, $dbh, $query, @bind_vars); map { $_->{onhand} *= 1 } @{ $form->{parts} }; @@ -564,7 +565,7 @@ sub all_parts { my @assemblies; if ($form->{l_assembly} && $form->{bom}) { $query = - qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand, + qq|SELECT p.id, p.partnumber, p.description, a.qty AS assembly_qty, p.unit, p.notes, p.itime::DATE as insertdate, p.sellprice, p.listprice, p.lastcost, p.rop, p.weight, @@ -735,7 +736,7 @@ sub retrieve_accounts { # transdate madness. my $transdate = ""; - if (($form->{type} eq "invoice") or ($form->{type} eq "credit_note") or ($form->{script} eq 'ir.pl')) { + if ( (any {$form->{type} eq $_} qw(invoice credit_note invoice_for_advance_payment final_invoice)) or ($form->{script} eq 'ir.pl') ) { # use deliverydate for sales and purchase invoice, if it exists # also use deliverydate for credit notes $transdate = $form->{tax_point} || $form->{deliverydate} || $form->{invdate};