Revision f7441609
Von Tamino Steinert vor fast 2 Jahren 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 ]) if $type eq 'request_quotation'; |
|
33 |
return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'sales_order'; |
|
34 |
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_TYPE(), |
|
36 |
SALES_QUOTATION_TYPE(), |
|
37 |
PURCHASE_ORDER_TYPE(), |
|
38 |
REQUEST_QUOTATION_TYPE(), |
|
39 |
)); |
|
35 | 40 |
|
36 | 41 |
die "Unknown type $type"; |
37 | 42 |
} |
SL/DB/Order.pm | ||
---|---|---|
93 | 93 |
# least an empty string, even if we're saving a quotation. |
94 | 94 |
$self->ordnumber('') if !$self->ordnumber; |
95 | 95 |
|
96 |
my $field = $self->quotation ? 'quonumber' : 'ordnumber'; |
|
97 |
$self->create_trans_number if !$self->$field; |
|
96 |
$self->create_trans_number if !$self->record_number; |
|
98 | 97 |
|
99 | 98 |
return 1; |
100 | 99 |
} |
... | ... | |
175 | 174 |
return shift->type eq shift; |
176 | 175 |
} |
177 | 176 |
|
177 |
sub quotation { |
|
178 |
my $type = shift->type(); |
|
179 |
if (any { $type eq $_ } ( |
|
180 |
SALES_QUOTATION_TYPE(), |
|
181 |
REQUEST_QUOTATION_TYPE(), |
|
182 |
)) { |
|
183 |
return 1; |
|
184 |
}; |
|
185 |
return 0; |
|
186 |
} |
|
187 |
|
|
178 | 188 |
sub deliverydate { |
179 | 189 |
# oe doesn't have deliverydate, but it does have reqdate. |
180 | 190 |
# But this has a different meaning for sales quotations. |
... | ... | |
378 | 388 |
ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded tax_point taxzone_id |
379 | 389 |
transaction_description vendor_id billing_address_id |
380 | 390 |
)), |
381 |
quotation => !!($destination_type =~ m{quotation$}), |
|
382 | 391 |
closed => 0, |
383 | 392 |
delivered => 0, |
384 | 393 |
transdate => DateTime->today_local, |
Auch abrufbar als: Unified diff
DB::Order: Funktionen angepasst (kein Angebotsflag)