X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FManager%2FPart.pm;h=088d4c838c63789ee373890675aa03498f3dc832;hb=17f43ff5eed41ff4fe630fd874905cacf4f763d8;hp=0b751bd34b58bd6af513252f8dfc9cb28ab5f20f;hpb=c312836ce432677d4f7876f1e3a2b6d99f433cd6;p=kivitendo-erp.git diff --git a/SL/DB/Manager/Part.pm b/SL/DB/Manager/Part.pm index 0b751bd34..088d4c838 100644 --- a/SL/DB/Manager/Part.pm +++ b/SL/DB/Manager/Part.pm @@ -16,7 +16,7 @@ sub object_class { 'SL::DB::Part' } __PACKAGE__->make_manager_methods; __PACKAGE__->add_filter_specs( - type => sub { + part_type => sub { my ($key, $value, $prefix) = @_; return __PACKAGE__->type_filter($value, $prefix); }, @@ -33,7 +33,7 @@ sub type_filter { $prefix //= ''; - # this is to make selection like type => { part => 1, service => 1 } work + # this is to make selections like part_type => { part => 1, service => 1 } work if ('HASH' eq ref $type) { $type = [ grep { $type->{$_} } keys %$type ]; } @@ -43,16 +43,13 @@ sub type_filter { for my $type (@types) { if ($type =~ m/^part/) { - push @filter, (and => [ or => [ $prefix . assembly => 0, $prefix . assembly => undef ], - "!${prefix}inventory_accno_id" => 0, - "!${prefix}inventory_accno_id" => undef, - ]); + push @filter, ($prefix . part_type => 'part'); } elsif ($type =~ m/^service/) { - push @filter, (and => [ or => [ $prefix . assembly => 0, $prefix . assembly => undef ], - or => [ $prefix . inventory_accno_id => 0, $prefix . inventory_accno_id => undef ], - ]); - } elsif ($type =~ m/^assembl/) { - push @filter, ($prefix . assembly => 1); + push @filter, ($prefix . part_type => 'service'); + } elsif ($type =~ m/^assembly/) { + push @filter, ($prefix . part_type => 'assembly'); + } elsif ($type =~ m/^assortment/) { + push @filter, ($prefix . part_type => 'assortment'); } }