Revision 4979985b
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
374 | 374 |
{ from => 'sales_order_intake', to => 'sales_order', abbr => 'soiso' }, |
375 | 375 |
{ from => 'sales_order_intake', to => 'purchase_order', abbr => 'soipo' }, |
376 | 376 |
{ from => 'sales_quotation', to => 'sales_order_intake', abbr => 'sqsoi' }, |
377 |
{ from => 'purchase_quotation_intake', to => 'purchase_quotation_intake', abbr => 'pqipqi' }, |
|
378 |
{ from => 'purchase_quotation_intake', to => 'sales_quotation', abbr => 'pqisq' }, |
|
379 |
{ from => 'purchase_quotation_intake', to => 'sales_order', abbr => 'pqiso' }, |
|
380 |
{ from => 'purchase_quotation_intake', to => 'purchase_order', abbr => 'pqipo' }, |
|
381 |
{ from => 'request_quotation', to => 'purchase_quotation_intake', abbr => 'rqpqi' }, |
|
377 | 382 |
); |
378 | 383 |
my $from_to = (grep { $_->{from} eq $source->type && $_->{to} eq $destination_type} @from_tos)[0]; |
379 | 384 |
croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") if !$from_to; |
... | ... | |
399 | 404 |
ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded tax_point taxzone_id |
400 | 405 |
transaction_description vendor_id billing_address_id |
401 | 406 |
)), |
402 |
quotation => !!($destination_type =~ m{quotation$}),
|
|
407 |
quotation => !!(($destination_type =~ m{quotation$}) || ($destination_type eq 'purchase_quotation_intake')),
|
|
403 | 408 |
intake => !!($destination_type =~ m{intake$}), |
404 | 409 |
closed => 0, |
405 | 410 |
delivered => 0, |
... | ... | |
422 | 427 |
: $from_to->{to} =~ m/^sales_order_intake$/ |
423 | 428 |
# ? $source->reqdate |
424 | 429 |
? undef |
430 |
: $from_to->{to} =~ m/^purchase_quotation_intake$/ |
|
431 |
? $source->reqdate |
|
425 | 432 |
: die "Wrong state for reqdate"; |
426 | 433 |
} elsif ( ref($source) eq 'SL::DB::Reclamation') { |
427 | 434 |
%args = ( map({ ( $_ => $source->$_ ) } qw( |
... | ... | |
438 | 445 |
); |
439 | 446 |
} |
440 | 447 |
|
441 |
if ( $is_abbr_any->(qw(soipo sopo poso rqso soisq sosq porq rqsq sqrq soirq sorq)) ) { |
|
448 |
if ( $is_abbr_any->(qw(soipo sopo poso rqso soisq sosq porq rqsq sqrq soirq sorq poisq poiso)) ) {
|
|
442 | 449 |
$args{ordnumber} = undef; |
443 | 450 |
$args{quonumber} = undef; |
444 | 451 |
} |
... | ... | |
448 | 455 |
$args{payment_id} = undef; |
449 | 456 |
$args{delivery_term_id} = undef; |
450 | 457 |
} |
451 |
if ( $is_abbr_any->(qw(poso rqsq)) ) { |
|
458 |
if ( $is_abbr_any->(qw(poso rqsq pqisq pqiso)) ) {
|
|
452 | 459 |
$args{vendor_id} = undef; |
453 | 460 |
} |
454 | 461 |
if ( $is_abbr_any->(qw(soso)) ) { |
... | ... | |
460 | 467 |
if ( $is_abbr_any->(qw(soiso)) ) { |
461 | 468 |
$args{ordnumber} = undef; |
462 | 469 |
} |
470 |
if ( $is_abbr_any->(qw(rqpqi pqisq)) ) { |
|
471 |
$args{quonumber} = undef; |
|
472 |
} |
|
463 | 473 |
|
464 | 474 |
# Custom shipto addresses (the ones specific to the sales/purchase |
465 | 475 |
# record and not to the customer/vendor) are only linked from |
... | ... | |
513 | 523 |
$current_oe_item->sellprice($source_item->lastcost); |
514 | 524 |
$current_oe_item->discount(0); |
515 | 525 |
} |
516 |
if ( $is_abbr_any->(qw(poso rqsq rqso)) ) { |
|
526 |
if ( $is_abbr_any->(qw(poso rqsq rqso pqisq pqiso)) ) {
|
|
517 | 527 |
$current_oe_item->lastcost($source_item->sellprice); |
518 | 528 |
} |
519 | 529 |
$current_oe_item->{"converted_from_orderitems_id"} = $_->{id} if ref($item_parent) eq 'SL::DB::Order'; |
... | ... | |
613 | 623 |
sales_quotation => 'quonumber', |
614 | 624 |
purchase_order => 'ordnumber', |
615 | 625 |
request_quotation => 'quonumber', |
626 |
purchase_quotation_intake => 'quonumber', |
|
616 | 627 |
); |
617 | 628 |
|
618 | 629 |
return $self->${ \ $number_method{$self->type} }(@_); |
Auch abrufbar als: Unified diff
Angebots-Eingang: S:D:Order->new_from