Revision 5dddfd91
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
26 | 26 |
use SL::RecordLinks; |
27 | 27 |
use Rose::DB::Object::Helpers qw(as_tree strip); |
28 | 28 |
|
29 |
use SL::DB::Order::TypeData qw(:types); |
|
29 |
use SL::DB::Order::TypeData qw(:types validate_type);
|
|
30 | 30 |
use SL::DB::Reclamation::TypeData qw(:types); |
31 | 31 |
|
32 | 32 |
__PACKAGE__->meta->add_relationship( |
... | ... | |
161 | 161 |
|
162 | 162 |
sub type { |
163 | 163 |
my $self = shift; |
164 |
die "invalid type: " . $self->record_type if (!any { $self->record_type eq $_ } ( |
|
165 |
SALES_ORDER_TYPE(), |
|
166 |
PURCHASE_ORDER_TYPE(), |
|
167 |
REQUEST_QUOTATION_TYPE(), |
|
168 |
SALES_QUOTATION_TYPE(), |
|
169 |
)); |
|
164 |
SL::DB::Order::TypeData::validate_type($self->record_type); |
|
170 | 165 |
return $self->record_type; |
171 | 166 |
} |
172 | 167 |
|
... | ... | |
200 | 195 |
} |
201 | 196 |
|
202 | 197 |
sub displayable_type { |
203 |
my $type = shift->type; |
|
204 |
|
|
205 |
return $::locale->text('Sales quotation') if $type eq SALES_QUOTATION_TYPE(); |
|
206 |
return $::locale->text('Request quotation') if $type eq REQUEST_QUOTATION_TYPE(); |
|
207 |
return $::locale->text('Sales Order') if $type eq SALES_ORDER_TYPE(); |
|
208 |
return $::locale->text('Purchase Order') if $type eq PURCHASE_ORDER_TYPE(); |
|
198 |
my ($self) = @_; |
|
209 | 199 |
|
210 |
die 'invalid type';
|
|
200 |
return $self->type_data->text('list');
|
|
211 | 201 |
} |
212 | 202 |
|
213 | 203 |
sub displayable_name { |
... | ... | |
602 | 592 |
sub number { |
603 | 593 |
my $self = shift; |
604 | 594 |
|
605 |
return if !$self->type; |
|
606 |
|
|
607 |
my %number_method = ( |
|
608 |
SALES_ORDER_TYPE() => 'ordnumber', |
|
609 |
SALES_QUOTATION_TYPE() => 'quonumber', |
|
610 |
PURCHASE_ORDER_TYPE() => 'ordnumber', |
|
611 |
REQUEST_QUOTATION_TYPE() => 'quonumber', |
|
612 |
); |
|
613 |
|
|
614 |
return $self->${ \ $number_method{$self->type} }(@_); |
|
595 |
my $nr_key = $self->type_data->properties('nr_key'); |
|
596 |
return $self->$nr_key(@_); |
|
615 | 597 |
} |
616 | 598 |
|
617 | 599 |
sub customervendor { |
Auch abrufbar als: Unified diff
Order: nutze TypeData