X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPE.pm;h=4d7176dd22f20a70792c5ce610c7fef431662607;hb=fee5532a132c44dcfc1743393cba00c8e3397176;hp=9906a72d9a7249103a5bb51e40279843ed965735;hpb=c09536f461b4933a1813b2af5e17eb6214f7bf38;p=kivitendo-erp.git diff --git a/SL/PE.pm b/SL/PE.pm index 9906a72d9..4d7176dd2 100644 --- a/SL/PE.pm +++ b/SL/PE.pm @@ -59,6 +59,9 @@ sub partsgroups { $where .= qq| AND id NOT IN | . qq| (SELECT DISTINCT partsgroup_id FROM parts | . + qq| WHERE NOT partsgroup_id ISNULL | . + qq| UNION | . + qq| SELECT DISTINCT partsgroup_id FROM custom_variable_config_partsgroups | . qq| WHERE NOT partsgroup_id ISNULL) |; } @@ -129,6 +132,12 @@ sub get_partsgroup { $dbh->disconnect; + # also not orphaned if partsgroup is selected for a cvar filter + if ($form->{orphaned}) { + my $cvar_count = scalar( @{ SL::DB::PartsGroup->new(id => $form->{id})->custom_variable_configs } ); + $form->{orphaned} = !$cvar_count; + } + $main::lxdebug->leave_sub(); } @@ -172,7 +181,7 @@ sub pricegroups { my $first = 1; $where .= qq| AND id NOT IN (|; - foreach my $table (qw(invoice orderitems prices rmaitems)) { + foreach my $table (qw(invoice orderitems prices)) { $where .= "UNION " unless ($first); $first = 0; $where .= @@ -253,7 +262,7 @@ sub get_pricegroup { my @values = (); $query = qq|SELECT |; - foreach my $table (qw(invoice orderitems prices rmaitems)) { + foreach my $table (qw(invoice orderitems prices)) { $query .= " + " unless ($first); $first = 0; $query .= qq|(SELECT COUNT(*) FROM $table WHERE pricegroup_id = ?) |;