Revision fcde4c20
Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
61 | 61 |
return $self->type eq $type ? 1 : 0; |
62 | 62 |
} |
63 | 63 |
|
64 |
sub is_part { $_[0]->is_type('part') }
|
|
65 |
sub is_assembly { $_[0]->is_type('assembly') }
|
|
66 |
sub is_service { $_[0]->is_type('service') }
|
|
64 |
sub is_part { $_[0]->part_type eq 'part' }
|
|
65 |
sub is_assembly { $_[0]->part_type eq 'assembly' }
|
|
66 |
sub is_service { $_[0]->part_type eq 'service' }
|
|
67 | 67 |
|
68 | 68 |
sub type { |
69 |
my ($self, $type) = @_; |
|
70 |
if (@_ > 1) { |
|
71 |
die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/; |
|
72 |
$self->assembly( $type eq 'assembly' ? 1 : 0); |
|
73 |
$self->inventory_accno_id($type eq 'part' ? 1 : undef); |
|
74 |
} |
|
75 |
|
|
76 |
return 'assembly' if $self->assembly; |
|
77 |
return 'part' if $self->inventory_accno_id; |
|
78 |
return 'service'; |
|
69 |
return $_[0]->part_type; |
|
70 |
# my ($self, $type) = @_; |
|
71 |
# if (@_ > 1) { |
|
72 |
# die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/; |
|
73 |
# $self->assembly( $type eq 'assembly' ? 1 : 0); |
|
74 |
# $self->inventory_accno_id($type ne 'service' ? 1 : undef); |
|
75 |
# } |
|
76 |
|
|
77 |
# return 'assembly' if $self->assembly; |
|
78 |
# return 'part' if $self->inventory_accno_id; |
|
79 |
# return 'service'; |
|
79 | 80 |
} |
80 | 81 |
|
81 | 82 |
sub new_part { |
82 | 83 |
my ($class, %params) = @_; |
83 |
$class->new(%params, type => 'part'); |
|
84 |
$class->new(%params, part_type => 'part');
|
|
84 | 85 |
} |
85 | 86 |
|
86 | 87 |
sub new_assembly { |
87 | 88 |
my ($class, %params) = @_; |
88 |
$class->new(%params, type => 'assembly'); |
|
89 |
$class->new(%params, part_type => 'assembly');
|
|
89 | 90 |
} |
90 | 91 |
|
91 | 92 |
sub new_service { |
92 | 93 |
my ($class, %params) = @_; |
93 |
$class->new(%params, type => 'service'); |
|
94 |
$class->new(%params, part_type => 'service');
|
|
94 | 95 |
} |
95 | 96 |
|
96 | 97 |
sub orphaned { |
Auch abrufbar als: Unified diff
Ware/Erzeugnis/Dienstleistung per parts.part_type unterscheiden 2
kivitendo Code angepasst.