You are here

uc7_order.yml in Commerce Migrate 3.0.x

modules/ubercart/migrations/uc7_order.yml

File

modules/ubercart/migrations/uc7_order.yml
View source
  1. # Ubercart 7 Order Migration
  2. id: uc7_order
  3. label: Migrate orders from Ubercart
  4. migration_tags:
  5. - Drupal 7
  6. - Ubercart
  7. - Content
  8. source:
  9. plugin: uc_order
  10. constants:
  11. store_id: 1
  12. process:
  13. # If you are using this file to build a custom migration consider removing
  14. # the order_id field to allow incremental migrations.
  15. order_id: order_id
  16. order_number: order_id
  17. order_items:
  18. plugin: migration_lookup
  19. migration: uc7_order_product
  20. source: order_item_ids
  21. uid: uid
  22. type:
  23. plugin: default_value
  24. default_value: default
  25. store_id: 'constants/store_id'
  26. mail: primary_email
  27. # Get the profile id and revision id for this order.
  28. billing_profile_data:
  29. -
  30. plugin: migration_lookup
  31. migration: uc7_profile_billing
  32. source: order_id
  33. billing_profile/target_id:
  34. -
  35. plugin: skip_on_empty
  36. method: process
  37. source: '@billing_profile_data'
  38. -
  39. plugin: extract
  40. index: [0]
  41. billing_profile/target_revision_id:
  42. -
  43. plugin: skip_on_empty
  44. method: process
  45. source: '@billing_profile_data'
  46. -
  47. plugin: extract
  48. index: [1]
  49. state:
  50. plugin: static_map
  51. source: order_status
  52. default_value: draft
  53. map:
  54. # These are the equivalent order states I was able to gather from the
  55. # documentation.
  56. in_checkout: draft
  57. pending: validation
  58. processing: draft
  59. payment_received: completed
  60. completed: completed
  61. canceled: canceled
  62. ip_address: host
  63. data/refresh_state:
  64. plugin: static_map
  65. source: order_status
  66. bypass: true
  67. map:
  68. # Do not refresh the order during migration of in_checkout orders.
  69. in_checkout: refresh_state
  70. created: created
  71. changed: modified
  72. # Set the placed time only if not draft or cancelled.
  73. placed:
  74. -
  75. plugin: skip_on_value
  76. method: process
  77. source: '@state'
  78. value:
  79. - draft
  80. - cancelled
  81. -
  82. plugin: get
  83. source: modified
  84. # Set the completed time only if completed
  85. completed:
  86. -
  87. plugin: skip_on_value
  88. method: process
  89. not_equals: true
  90. source: '@state'
  91. value: completed
  92. -
  93. plugin: get
  94. source: modified
  95. adjustments:
  96. plugin: commerce_adjustments
  97. source: adjustments
  98. field_order_comments: order_comments
  99. field_order_admin_comments: order_admin_comments
  100. field_order_logs:
  101. -
  102. plugin: sub_process
  103. source: order_logs
  104. process:
  105. value:
  106. -
  107. plugin: callback
  108. callable: strip_tags
  109. source: value
  110. destination:
  111. plugin: 'entity:commerce_order'
  112. destination_module: commerce_order
  113. migration_dependencies:
  114. required:
  115. - uc7_store
  116. - uc7_profile_billing
  117. - uc7_order_product
  118. - uc_order_field_instance