X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIC.pm;h=8895bf888e39e5bad0dde0360863d5df525ffb58;hb=706d20f46c3e638de6ffca27e0fbdd48394b24ab;hp=47c5fea4155513db6963a0169a38b43c78174204;hpb=5c111f6cc47536287ff150a543b9191f0c703376;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index 47c5fea41..8895bf888 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -164,28 +164,25 @@ sub get_part { #correct rows $form->{price_rows} = $i - 1; - unless ($form->{item} eq 'service') { - - # get makes - if ($form->{makemodel}) { - #hli - $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | . - qq|WHERE m.parts_id = ? order by m.sortorder asc|; - my @values = ($form->{id}); - $sth = $dbh->prepare($query); - $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")"); - - my $i = 1; - - while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"}, - $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array) - { - $i++; - } - $sth->finish; - $form->{makemodel_rows} = $i - 1; - + # get makes + if ($form->{makemodel}) { + #hli + $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | . + qq|WHERE m.parts_id = ? order by m.sortorder asc|; + my @values = ($form->{id}); + $sth = $dbh->prepare($query); + $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")"); + + my $i = 1; + + while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"}, + $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array) + { + $i++; } + $sth->finish; + $form->{makemodel_rows} = $i - 1; + } # get translations @@ -330,10 +327,8 @@ sub save { } $sth->finish; - if ($form->{item} ne 'service') { - # delete makemodel records - do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id})); - } + # delete makemodel records + do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id})); if ($form->{item} eq 'assembly') { # delete assembly records @@ -1126,6 +1121,26 @@ sub all_parts { $form->{parts} = \@assemblies; } + if ($form->{l_pricegroups} ) { + my $query = <{parts} }) { + do_statement($form, $sth, $query, conv_i($part->{id})); + + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { + $part->{"pricegroup_$ref->{pricegroup_id}"} = $ref->{price}; + } + $sth->finish; + } + }; + + $main::lxdebug->leave_sub(); return wantarray ? @{ $form->{parts} } : $form->{parts};