Revision 951ebae4
Von Bernd Bleßmann vor mehr als 6 Jahren hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
205 | 205 |
croak("A destination type must be given parameter") unless $params{destination_type}; |
206 | 206 |
|
207 | 207 |
my $destination_type = delete $params{destination_type}; |
208 |
my $src_dst_allowed = ('sales_quotation' eq $source->type && 'sales_order' eq $destination_type) |
|
209 |
|| ('request_quotation' eq $source->type && 'purchase_order' eq $destination_type); |
|
208 |
my $src_dst_allowed = ('sales_quotation' eq $source->type && 'sales_order' eq $destination_type) |
|
209 |
|| ('request_quotation' eq $source->type && 'purchase_order' eq $destination_type) |
|
210 |
|| ('sales_quotation' eq $source->type && 'sales_quotation' eq $destination_type) |
|
211 |
|| ('sales_order' eq $source->type && 'sales_order' eq $destination_type) |
|
212 |
|| ('request_quotation' eq $source->type && 'request_quotation' eq $destination_type) |
|
213 |
|| ('purchase_order' eq $source->type && 'purchase_order' eq $destination_type); |
|
210 | 214 |
croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") unless $src_dst_allowed; |
211 | 215 |
|
212 | 216 |
my ($item_parent_id_column, $item_parent_column); |
... | ... | |
221 | 225 |
ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id |
222 | 226 |
transaction_description vendor_id |
223 | 227 |
)), |
224 |
quotation => 0,
|
|
228 |
quotation => !!($destination_type =~ m{quotation$}),
|
|
225 | 229 |
closed => 0, |
226 | 230 |
delivered => 0, |
227 | 231 |
transdate => DateTime->today_local, |
... | ... | |
229 | 233 |
|
230 | 234 |
# Custom shipto addresses (the ones specific to the sales/purchase |
231 | 235 |
# record and not to the customer/vendor) are only linked from |
232 |
# shipto → delivery_orders. Meaning delivery_orders.shipto_id
|
|
236 |
# shipto → order. Meaning order.shipto_id
|
|
233 | 237 |
# will not be filled in that case. |
234 | 238 |
if (!$source->shipto_id && $source->id) { |
235 | 239 |
$args{custom_shipto} = $source->custom_shipto->clone($class) if $source->can('custom_shipto') && $source->custom_shipto; |
... | ... | |
372 | 376 |
=head2 C<new_from $source, %params> |
373 | 377 |
|
374 | 378 |
Creates a new C<SL::DB::Order> instance and copies as much |
375 |
information from C<$source> as possible. At the moment only sales orders from |
|
379 |
information from C<$source> as possible. At the moment only records with the |
|
380 |
same destination type as the source type and sales orders from |
|
376 | 381 |
sales quotations and purchase orders from requests for quotations can be |
377 | 382 |
created. |
378 | 383 |
|
... | ... | |
391 | 396 |
=item C<destination_type> |
392 | 397 |
|
393 | 398 |
(mandatory) |
394 |
The type of the newly created object. Can be C<sales_order> or
|
|
395 |
C<purchase_order> for now. |
|
399 |
The type of the newly created object. Can be C<sales_quotation>,
|
|
400 |
C<sales_order>, C<purchase_quotation> or C<purchase_order> for now.
|
|
396 | 401 |
|
397 | 402 |
=item C<items> |
398 | 403 |
|
Auch abrufbar als: Unified diff
Order: new_from: auch gleiche Quell- und Ziel-Typen berücksichtigen