Revision ef5a7368
Von Bernd Bleßmann vor etwa 2 Jahren hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
my $destination_type = delete $params{destination_type};
|
||
|
||
my @from_tos = (
|
||
{ from => 'sales_quotation', to => 'sales_order', abbr => 'sqso' },
|
||
{ from => 'request_quotation', to => 'purchase_order', abbr => 'rqpo' },
|
||
{ from => 'sales_quotation', to => 'sales_quotation', abbr => 'sqsq' },
|
||
{ from => 'sales_order', to => 'sales_order', abbr => 'soso' },
|
||
{ from => 'request_quotation', to => 'request_quotation', abbr => 'rqrq' },
|
||
{ from => 'purchase_order', to => 'purchase_order', abbr => 'popo' },
|
||
{ from => 'sales_order', to => 'purchase_order', abbr => 'sopo' },
|
||
{ from => 'purchase_order', to => 'sales_order', abbr => 'poso' },
|
||
{ from => 'sales_order', to => 'sales_quotation', abbr => 'sosq' },
|
||
{ from => 'purchase_order', to => 'request_quotation', abbr => 'porq' },
|
||
{ from => 'request_quotation', to => 'sales_quotation', abbr => 'rqsq' },
|
||
{ from => 'request_quotation', to => 'sales_order', abbr => 'rqso' },
|
||
{ from => 'sales_quotation', to => 'request_quotation', abbr => 'sqrq' },
|
||
{ from => 'sales_order', to => 'request_quotation', abbr => 'sorq' },
|
||
{ from => 'sales_reclamation', to => 'sales_order', abbr => 'srso' },
|
||
{ from => 'purchase_reclamation', to => 'purchase_order', abbr => 'prpo' },
|
||
{ from => 'sales_quotation', to => 'sales_order', abbr => 'sqso' },
|
||
{ from => 'request_quotation', to => 'purchase_order', abbr => 'rqpo' },
|
||
{ from => 'sales_quotation', to => 'sales_quotation', abbr => 'sqsq' },
|
||
{ from => 'sales_order', to => 'sales_order', abbr => 'soso' },
|
||
{ from => 'request_quotation', to => 'request_quotation', abbr => 'rqrq' },
|
||
{ from => 'purchase_order', to => 'purchase_order', abbr => 'popo' },
|
||
{ from => 'sales_order', to => 'purchase_order', abbr => 'sopo' },
|
||
{ from => 'purchase_order', to => 'sales_order', abbr => 'poso' },
|
||
{ from => 'sales_order', to => 'sales_quotation', abbr => 'sosq' },
|
||
{ from => 'purchase_order', to => 'request_quotation', abbr => 'porq' },
|
||
{ from => 'request_quotation', to => 'sales_quotation', abbr => 'rqsq' },
|
||
{ from => 'request_quotation', to => 'sales_order', abbr => 'rqso' },
|
||
{ from => 'sales_quotation', to => 'request_quotation', abbr => 'sqrq' },
|
||
{ from => 'sales_order', to => 'request_quotation', abbr => 'sorq' },
|
||
{ from => 'sales_reclamation', to => 'sales_order', abbr => 'srso' },
|
||
{ from => 'purchase_reclamation', to => 'purchase_order', abbr => 'prpo' },
|
||
{ from => 'sales_order_intake', to => 'sales_order_intake', abbr => 'soisoi' },
|
||
{ from => 'sales_order_intake', to => 'sales_quotation', abbr => 'soisq' },
|
||
{ from => 'sales_order_intake', to => 'request_quotation', abbr => 'soirq' },
|
||
{ from => 'sales_order_intake', to => 'sales_order', abbr => 'soiso' },
|
||
{ from => 'sales_order_intake', to => 'purchase_order', abbr => 'soipo' },
|
||
{ from => 'sales_quotation', to => 'sales_order_intake', abbr => 'sqsoi' },
|
||
);
|
||
my $from_to = (grep { $_->{from} eq $source->type && $_->{to} eq $destination_type} @from_tos)[0];
|
||
croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") if !$from_to;
|
||
... | ... | |
transaction_description vendor_id billing_address_id
|
||
)),
|
||
quotation => !!($destination_type =~ m{quotation$}),
|
||
intake => !!($destination_type =~ m{intake$}),
|
||
closed => 0,
|
||
delivered => 0,
|
||
transdate => DateTime->today_local,
|
||
... | ... | |
);
|
||
}
|
||
|
||
if ( $is_abbr_any->(qw(sopo poso rqso sosq porq rqsq sqrq sorq)) ) {
|
||
if ( $is_abbr_any->(qw(soipo sopo poso rqso soisq sosq porq rqsq sqrq soirq sorq)) ) {
|
||
$args{ordnumber} = undef;
|
||
$args{quonumber} = undef;
|
||
}
|
||
if ( $is_abbr_any->(qw(sopo sqrq sorq)) ) {
|
||
if ( $is_abbr_any->(qw(soipo sopo sqrq soirq sorq)) ) {
|
||
$args{customer_id} = undef;
|
||
$args{salesman_id} = undef;
|
||
$args{payment_id} = undef;
|
||
... | ... | |
if ( $is_abbr_any->(qw(soso)) ) {
|
||
$args{periodic_invoices_config} = $source->periodic_invoices_config->clone_and_reset if $source->periodic_invoices_config;
|
||
}
|
||
if ( $is_abbr_any->(qw(sqrq sorq)) ) {
|
||
if ( $is_abbr_any->(qw(sqrq soirq sorq)) ) {
|
||
$args{cusordnumber} = undef;
|
||
}
|
||
if ( $is_abbr_any->(qw(soiso)) ) {
|
||
$args{ordnumber} = undef;
|
||
}
|
||
|
||
# Custom shipto addresses (the ones specific to the sales/purchase
|
||
# record and not to the customer/vendor) are only linked from
|
||
... | ... | |
custom_variables => \@custom_variables,
|
||
);
|
||
}
|
||
if ( $is_abbr_any->(qw(sopo)) ) {
|
||
if ( $is_abbr_any->(qw(soipo sopo)) ) {
|
||
$current_oe_item->sellprice($source_item->lastcost);
|
||
$current_oe_item->discount(0);
|
||
}
|
||
... | ... | |
return if !$self->type;
|
||
|
||
my %number_method = (
|
||
sales_order => 'ordnumber',
|
||
sales_quotation => 'quonumber',
|
||
purchase_order => 'ordnumber',
|
||
request_quotation => 'quonumber',
|
||
sales_order_intake => 'ordnumber',
|
||
sales_order => 'ordnumber',
|
||
sales_quotation => 'quonumber',
|
||
purchase_order => 'ordnumber',
|
||
request_quotation => 'quonumber',
|
||
);
|
||
|
||
return $self->${ \ $number_method{$self->type} }(@_);
|
Auch abrufbar als: Unified diff
Auftrags-Eingang: Workflows