diff -u b/src/Plugin/migrate/destination/ubercart/d6/EntityOrder.php b/src/Plugin/migrate/destination/ubercart/d6/EntityOrder.php --- b/src/Plugin/migrate/destination/ubercart/d6/EntityOrder.php +++ b/src/Plugin/migrate/destination/ubercart/d6/EntityOrder.php @@ -24,8 +24,7 @@ if ($values) { $adjustments = []; foreach ($values as $adjustment) { - $amount = $adjustment['amount']['number']; - $adjustment['amount'] = new Price($amount, $adjustment['amount']['currency_code']); + $adjustment['amount'] = new Price($adjustment['amount']['number'], $adjustment['amount']['currency_code']); $adjustments[] = new Adjustment($adjustment); } $row->setDestinationProperty('adjustments', $adjustments); diff -u b/src/Plugin/migrate/process/ubercart/d6/UbercartLineItem.php b/src/Plugin/migrate/process/ubercart/d6/UbercartLineItem.php --- b/src/Plugin/migrate/process/ubercart/d6/UbercartLineItem.php +++ b/src/Plugin/migrate/process/ubercart/d6/UbercartLineItem.php @@ -31,7 +31,7 @@ $adjust['amount'] = [ 'number' => $adjustment['amount'], - 'currency_code' => $adjustment['currency'], + 'currency_code' => $adjustment['currency_code'], ]; // @TODO: Adjustment sourceId and included. $adjustments[] = $adjust; diff -u b/src/Plugin/migrate/source/ubercart/d6/Order.php b/src/Plugin/migrate/source/ubercart/d6/Order.php --- b/src/Plugin/migrate/source/ubercart/d6/Order.php +++ b/src/Plugin/migrate/source/ubercart/d6/Order.php @@ -2,8 +2,9 @@ namespace Drupal\commerce_migrate\Plugin\migrate\source\ubercart\d6; +use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\migrate\Plugin\migrate\source\SqlBase; +use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; use Drupal\migrate\Row; use Drupal\Core\State\StateInterface; use Drupal\migrate\Plugin\MigrationInterface; @@ -16,7 +17,7 @@ * id = "d6_ubercart_order" * ) */ -class Order extends SqlBase { +class Order extends DrupalSqlBase { /** * The module handler. @@ -28,8 +29,8 @@ /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, ModuleHandlerInterface $module_handler) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state); + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager); $this->state = $state; $this->moduleHandler = $module_handler; } @@ -44,6 +45,7 @@ $plugin_definition, $migration, $container->get('state'), + $container->get('entity.manager'), $container->get('module_handler') ); } @@ -86,7 +88,6 @@ $row->setSourceProperty('commerce_shipping', $this->moduleHandler->moduleExists('commerce_shipping')); $row->setSourceProperty('adjustments', $this->getAdjustmentData($row)); - $row->setSourceProperty('currency', $this->getUbercartCurrency()); return parent::prepareRow($row); } @@ -107,7 +108,14 @@ ->orderBy('weight', 'ASC') ->condition('uol.order_id', $order_id); $query->innerJoin('uc_orders', 'uo', 'uol.order_id = uo.order_id'); - return $query->execute()->fetchAll(); + $adjustments = $query->execute()->fetchAll(); + + $currency_code = $this->variableGet('uc_currency_code', 'USD'); + foreach ($adjustments as &$adjustment) { + $adjustment['currency_code'] = $currency_code; + } + return $adjustments; + } /** @@ -124,17 +132,2 @@ - /** - * Gets the Ubercart global currency. - * - * @return string - * The currency. - */ - public function getUbercartCurrency() { - static $currency; - - if (empty($currency)) { - $currency = $this->variableGet('uc_currency_code', 'USD'); - } - return $currency; - } - }