Revision 60009b97
Von Sven Schöling vor etwa 13 Jahren hinzugefügt
SL/DB/Manager/Part.pm | ||
---|---|---|
7 | 7 |
|
8 | 8 |
use Carp; |
9 | 9 |
use SL::DBUtils; |
10 |
use SL::MoreCommon qw(listify); |
|
10 | 11 |
|
11 | 12 |
sub object_class { 'SL::DB::Part' } |
12 | 13 |
|
13 | 14 |
__PACKAGE__->make_manager_methods; |
14 | 15 |
|
15 | 16 |
sub type_filter { |
16 |
my $class = shift; |
|
17 |
my $type = lc(shift || ''); |
|
18 |
|
|
19 |
if ($type =~ m/^part/) { |
|
20 |
return (and => [ or => [ assembly => 0, assembly => undef ], |
|
21 |
'!inventory_accno_id' => 0, |
|
22 |
'!inventory_accno_id' => undef, |
|
23 |
]); |
|
24 |
|
|
25 |
} elsif ($type =~ m/^service/) { |
|
26 |
return (and => [ or => [ assembly => 0, assembly => undef ], |
|
27 |
or => [ inventory_accno_id => 0, inventory_accno_id => undef ], |
|
28 |
]); |
|
29 |
|
|
30 |
} elsif ($type =~ m/^assembl/) { |
|
31 |
return (assembly => 1); |
|
32 |
|
|
17 |
my ($class, $type) = @_; |
|
18 |
|
|
19 |
return () unless $type; |
|
20 |
|
|
21 |
my @types = listify($type); |
|
22 |
my @filter; |
|
23 |
|
|
24 |
for my $type (@types) { |
|
25 |
if ($type =~ m/^part/) { |
|
26 |
push @filter, (and => [ or => [ assembly => 0, assembly => undef ], |
|
27 |
'!inventory_accno_id' => 0, |
|
28 |
'!inventory_accno_id' => undef, |
|
29 |
]); |
|
30 |
} elsif ($type =~ m/^service/) { |
|
31 |
push @filter, (and => [ or => [ assembly => 0, assembly => undef ], |
|
32 |
or => [ inventory_accno_id => 0, inventory_accno_id => undef ], |
|
33 |
]); |
|
34 |
} elsif ($type =~ m/^assembl/) { |
|
35 |
push @filter, (assembly => 1); |
|
36 |
} |
|
33 | 37 |
} |
34 | 38 |
|
35 |
return (); |
|
39 |
return @filter ? (or => \@filter) : ();
|
|
36 | 40 |
} |
37 | 41 |
|
38 | 42 |
sub get_ordered_qty { |
Auch abrufbar als: Unified diff
Part::type_filter kommt nun auch mit mehreren werten klar.