Revision 7e8a3b38
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/DB/Manager/Order.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::DB::Helper::Manager); |
6 | 6 |
|
7 |
use SL::DB::Order::TypeData qw(:types); |
|
7 | 8 |
use SL::DB::Helper::Paginated; |
8 | 9 |
use SL::DB::Helper::Sorted; |
9 | 10 |
use SL::DB::Helper::Filtered; |
10 | 11 |
|
12 |
use List::MoreUtils qw(any); |
|
13 |
|
|
11 | 14 |
sub object_class { 'SL::DB::Order' } |
12 | 15 |
|
13 | 16 |
__PACKAGE__->make_manager_methods; |
... | ... | |
28 | 31 |
my $type = lc(shift || ''); |
29 | 32 |
my $prefix = shift || ''; |
30 | 33 |
|
31 |
return (and => [ "!${prefix}customer_id" => undef, "${prefix}quotation" => 1 ]) if $type eq 'sales_quotation'; |
|
32 |
return (and => [ "!${prefix}vendor_id" => undef, "${prefix}quotation" => 1, "${prefix}intake" => 0 ]) if $type eq 'request_quotation'; |
|
33 |
return (and => [ "!${prefix}customer_id" => undef, "${prefix}intake" => 1 ]) if $type eq 'sales_order_intake'; |
|
34 |
return (and => [ "!${prefix}vendor_id" => undef, "${prefix}intake" => 1, "${prefix}quotation" => 1 ]) if $type eq 'purchase_quotation_intake'; |
|
35 |
return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ], "${prefix}intake" => 0 ]) if $type eq 'sales_order'; |
|
36 |
return (and => [ "!${prefix}vendor_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'purchase_order'; |
|
34 |
return ("${prefix}record_type" => $type) if( any {$type eq $_} ( |
|
35 |
SALES_ORDER_INTAKE_TYPE(), |
|
36 |
SALES_ORDER_TYPE(), |
|
37 |
SALES_QUOTATION_TYPE(), |
|
38 |
PURCHASE_ORDER_TYPE(), |
|
39 |
REQUEST_QUOTATION_TYPE(), |
|
40 |
PURCHASE_QUOTATION_INTAKE_TYPE(), |
|
41 |
)); |
|
37 | 42 |
|
38 | 43 |
die "Unknown type $type"; |
39 | 44 |
} |
Auch abrufbar als: Unified diff
DB::Order: Funktionen angepasst (kein Angebotsflag/Intakeflag)