diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html
index 4c3ce84baac4..f9400227fae0 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html
@@ -5,7 +5,7 @@
*/
-->
-
+
,
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html
index c3afce6c4537..ec41cae0bdc5 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html
@@ -5,7 +5,7 @@
*/
-->
-
+
,
diff --git a/app/code/Magento/Cms/Model/BlockRepository.php b/app/code/Magento/Cms/Model/BlockRepository.php
index a06c5fac1bc4..5f8ec399e9bd 100644
--- a/app/code/Magento/Cms/Model/BlockRepository.php
+++ b/app/code/Magento/Cms/Model/BlockRepository.php
@@ -154,25 +154,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria
$this->collectionProcessor->process($criteria, $collection);
- $blocks = [];
- /** @var Block $blockModel */
- foreach ($collection as $blockModel) {
- $blockData = $this->dataBlockFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $blockData,
- $blockModel->getData(),
- \Magento\Cms\Api\Data\BlockInterface::class
- );
- $blocks[] = $this->dataObjectProcessor->buildOutputDataArray(
- $blockData,
- \Magento\Cms\Api\Data\BlockInterface::class
- );
- }
-
/** @var Data\BlockSearchResultsInterface $searchResults */
$searchResults = $this->searchResultsFactory->create();
$searchResults->setSearchCriteria($criteria);
- $searchResults->setItems($blocks);
+ $searchResults->setItems($collection->getItems());
$searchResults->setTotalCount($collection->getSize());
return $searchResults;
}
diff --git a/app/code/Magento/Cms/Model/PageRepository.php b/app/code/Magento/Cms/Model/PageRepository.php
index 033289bf8fb8..521a975c885d 100644
--- a/app/code/Magento/Cms/Model/PageRepository.php
+++ b/app/code/Magento/Cms/Model/PageRepository.php
@@ -157,25 +157,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria
$this->collectionProcessor->process($criteria, $collection);
- $pages = [];
- /** @var Page $pageModel */
- foreach ($collection as $pageModel) {
- $pageData = $this->dataPageFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $pageData,
- $pageModel->getData(),
- \Magento\Cms\Api\Data\PageInterface::class
- );
- $pages[] = $this->dataObjectProcessor->buildOutputDataArray(
- $pageData,
- \Magento\Cms\Api\Data\PageInterface::class
- );
- }
-
/** @var Data\PageSearchResultsInterface $searchResults */
$searchResults = $this->searchResultsFactory->create();
$searchResults->setSearchCriteria($criteria);
- $searchResults->setItems($pages);
+ $searchResults->setItems($collection->getItems());
$searchResults->setTotalCount($collection->getSize());
return $searchResults;
}
diff --git a/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php b/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php
index dd43f4a0b228..6e4440ef97b2 100644
--- a/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php
@@ -263,22 +263,8 @@ public function testGetList()
->willReturnSelf();
$this->blockSearchResult->expects($this->once())
->method('setItems')
- ->with(['someData'])
+ ->with([$this->block])
->willReturnSelf();
-
- $this->block->expects($this->once())
- ->method('getData')
- ->willReturn(['data']);
-
- $this->dataHelper->expects($this->once())
- ->method('populateWithArray')
- ->with($this->blockData, ['data'], \Magento\Cms\Api\Data\BlockInterface::class);
-
- $this->dataObjectProcessor->expects($this->once())
- ->method('buildOutputDataArray')
- ->with($this->blockData, \Magento\Cms\Api\Data\BlockInterface::class)
- ->willReturn('someData');
-
$this->assertEquals($this->blockSearchResult, $this->repository->getList($criteria));
}
}
diff --git a/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php b/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php
index 7d064c73b325..1bd742048c51 100644
--- a/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php
@@ -261,22 +261,8 @@ public function testGetList()
->willReturnSelf();
$this->pageSearchResult->expects($this->once())
->method('setItems')
- ->with(['someData'])
+ ->with([$this->page])
->willReturnSelf();
-
- $this->page->expects($this->once())
- ->method('getData')
- ->willReturn(['data']);
-
- $this->dataHelper->expects($this->once())
- ->method('populateWithArray')
- ->with($this->pageData, ['data'], \Magento\Cms\Api\Data\PageInterface::class);
-
- $this->dataObjectProcessor->expects($this->once())
- ->method('buildOutputDataArray')
- ->with($this->pageData, \Magento\Cms\Api\Data\PageInterface::class)
- ->willReturn('someData');
-
$this->assertEquals($this->pageSearchResult, $this->repository->getList($criteria));
}
}
diff --git a/app/code/Magento/Config/Console/Command/ConfigSet/LockProcessor.php b/app/code/Magento/Config/Console/Command/ConfigSet/LockProcessor.php
index b8770482f032..0bd28f0f78d9 100644
--- a/app/code/Magento/Config/Console/Command/ConfigSet/LockProcessor.php
+++ b/app/code/Magento/Config/Console/Command/ConfigSet/LockProcessor.php
@@ -8,6 +8,7 @@
use Magento\Config\App\Config\Type\System;
use Magento\Config\Model\PreparedValueFactory;
use Magento\Framework\App\Config\ConfigPathResolver;
+use Magento\Framework\App\Config\Value;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Exception\CouldNotSaveException;
@@ -79,19 +80,27 @@ public function process($path, $value, $scope, $scopeCode)
$configPath = $this->configPathResolver->resolve($path, $scope, $scopeCode, System::CONFIG_TYPE);
$backendModel = $this->preparedValueFactory->create($path, $value, $scope, $scopeCode);
- /**
- * Temporary solution until Magento introduce unified interface
- * for storing system configuration into database and configuration files.
- */
- $backendModel->validateBeforeSave();
- $backendModel->beforeSave();
+ if ($backendModel instanceof Value) {
+ /**
+ * Temporary solution until Magento introduce unified interface
+ * for storing system configuration into database and configuration files.
+ */
+ $backendModel->validateBeforeSave();
+ $backendModel->beforeSave();
- $this->deploymentConfigWriter->saveConfig(
- [ConfigFilePool::APP_ENV => $this->arrayManager->set($configPath, [], $backendModel->getValue())],
- false
- );
+ $value = $backendModel->getValue();
- $backendModel->afterSave();
+ $backendModel->afterSave();
+
+ /**
+ * Because FS does not support transactions,
+ * we'll write value just after all validations are triggered.
+ */
+ $this->deploymentConfigWriter->saveConfig(
+ [ConfigFilePool::APP_ENV => $this->arrayManager->set($configPath, [], $value)],
+ false
+ );
+ }
} catch (\Exception $exception) {
throw new CouldNotSaveException(__('%1', $exception->getMessage()), $exception);
}
diff --git a/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php b/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php
index 960853778d5f..1412e0cd77c1 100644
--- a/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php
+++ b/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php
@@ -45,6 +45,6 @@ protected function _addWhetherScopeInfo()
*/
protected function _getAllowedExtensions()
{
- return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg'];
+ return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng'];
}
}
diff --git a/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php b/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php
index 908ae53af099..fc57287fb494 100644
--- a/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php
+++ b/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php
@@ -45,6 +45,6 @@ protected function _addWhetherScopeInfo()
*/
protected function _getAllowedExtensions()
{
- return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
+ return ['jpg', 'jpeg', 'gif', 'png'];
}
}
diff --git a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/LockProcessorTest.php b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/LockProcessorTest.php
index e37214411ff5..62028eb78923 100644
--- a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/LockProcessorTest.php
+++ b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/LockProcessorTest.php
@@ -206,10 +206,10 @@ public function testCustomException()
->willReturn($this->valueMock);
$this->arrayManagerMock->expects($this->never())
->method('set');
- $this->valueMock->expects($this->never())
+ $this->valueMock->expects($this->once())
->method('getValue');
$this->valueMock->expects($this->once())
- ->method('validateBeforeSave')
+ ->method('afterSave')
->willThrowException(new \Exception('Invalid values'));
$this->deploymentConfigWriterMock->expects($this->never())
->method('saveConfig');
diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php
index e68cff5d1280..28f35c233b87 100644
--- a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php
+++ b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php
@@ -73,7 +73,7 @@ public function testBeforeSave()
->will($this->returnValue('/tmp/val'));
$this->uploaderMock->expects($this->once())
->method('setAllowedExtensions')
- ->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png', 'svg']));
+ ->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png']));
$this->model->beforeSave();
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Model/AttributeOptionProvider.php b/app/code/Magento/ConfigurableProduct/Model/AttributeOptionProvider.php
index d9dda323c56a..759691433b80 100644
--- a/app/code/Magento/ConfigurableProduct/Model/AttributeOptionProvider.php
+++ b/app/code/Magento/ConfigurableProduct/Model/AttributeOptionProvider.php
@@ -6,13 +6,15 @@
namespace Magento\ConfigurableProduct\Model;
+use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Framework\App\ScopeResolverInterface;
use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute;
-use Magento\Framework\App\ScopeInterface;
use Magento\Framework\DB\Select;
-use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionProvider;
+/**
+ * Provider for retrieving configurable options.
+ */
class AttributeOptionProvider implements AttributeOptionProviderInterface
{
/**
@@ -26,23 +28,23 @@ class AttributeOptionProvider implements AttributeOptionProviderInterface
private $attributeResource;
/**
- * @var OptionProvider
+ * @var OptionSelectBuilderInterface
*/
- private $attributeOptionProvider;
+ private $optionSelectBuilder;
/**
* @param Attribute $attributeResource
- * @param OptionProvider $attributeOptionProvider ,
- * @param ScopeResolverInterface $scopeResolver
+ * @param ScopeResolverInterface $scopeResolver,
+ * @param OptionSelectBuilderInterface $optionSelectBuilder
*/
public function __construct(
Attribute $attributeResource,
- OptionProvider $attributeOptionProvider,
- ScopeResolverInterface $scopeResolver
+ ScopeResolverInterface $scopeResolver,
+ OptionSelectBuilderInterface $optionSelectBuilder
) {
$this->attributeResource = $attributeResource;
- $this->attributeOptionProvider = $attributeOptionProvider;
$this->scopeResolver = $scopeResolver;
+ $this->optionSelectBuilder = $optionSelectBuilder;
}
/**
@@ -50,8 +52,8 @@ public function __construct(
*/
public function getAttributeOptions(AbstractAttribute $superAttribute, $productId)
{
- $scope = $this->scopeResolver->getScope();
- $select = $this->getAttributeOptionsSelect($superAttribute, $productId, $scope);
+ $scope = $this->scopeResolver->getScope();
+ $select = $this->optionSelectBuilder->getSelect($superAttribute, $productId, $scope);
$data = $this->attributeResource->getConnection()->fetchAll($select);
if ($superAttribute->getSourceModel()) {
@@ -73,104 +75,4 @@ public function getAttributeOptions(AbstractAttribute $superAttribute, $productI
return $data;
}
-
- /**
- * Get load options for attribute select
- *
- * @param AbstractAttribute $superAttribute
- * @param int $productId
- * @param ScopeInterface $scope
- * @return Select
- */
- private function getAttributeOptionsSelect(AbstractAttribute $superAttribute, $productId, ScopeInterface $scope)
- {
- $select = $this->attributeResource->getConnection()->select()->from(
- ['super_attribute' => $this->attributeResource->getTable('catalog_product_super_attribute')],
- [
- 'sku' => 'entity.sku',
- 'product_id' => 'product_entity.entity_id',
- 'attribute_code' => 'attribute.attribute_code',
- 'value_index' => 'entity_value.value',
- 'super_attribute_label' => 'attribute_label.value',
- ]
- )->joinInner(
- ['product_entity' => $this->attributeResource->getTable('catalog_product_entity')],
- "product_entity.{$this->attributeOptionProvider->getProductEntityLinkField()} = super_attribute.product_id",
- []
- )->joinInner(
- ['product_link' => $this->attributeResource->getTable('catalog_product_super_link')],
- 'product_link.parent_id = super_attribute.product_id',
- []
- )->joinInner(
- ['attribute' => $this->attributeResource->getTable('eav_attribute')],
- 'attribute.attribute_id = super_attribute.attribute_id',
- []
- )->joinInner(
- ['entity' => $this->attributeResource->getTable('catalog_product_entity')],
- 'entity.entity_id = product_link.product_id',
- []
- )->joinInner(
- ['entity_value' => $superAttribute->getBackendTable()],
- implode(
- ' AND ',
- [
- 'entity_value.attribute_id = super_attribute.attribute_id',
- 'entity_value.store_id = 0',
- "entity_value.{$this->attributeOptionProvider->getProductEntityLinkField()} = "
- . "entity.{$this->attributeOptionProvider->getProductEntityLinkField()}",
- ]
- ),
- []
- )->joinLeft(
- ['attribute_label' => $this->attributeResource->getTable('catalog_product_super_attribute_label')],
- implode(
- ' AND ',
- [
- 'super_attribute.product_super_attribute_id = attribute_label.product_super_attribute_id',
- 'attribute_label.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
- ]
- ),
- []
- )->where(
- 'super_attribute.product_id = ?',
- $productId
- )->where(
- 'attribute.attribute_id = ?',
- $superAttribute->getAttributeId()
- );
-
- if (!$superAttribute->getSourceModel()) {
- $select->columns(
- [
- 'option_title' => $this->attributeResource->getConnection()->getIfNullSql(
- 'option_value.value',
- 'default_option_value.value'
- ),
- 'default_title' => 'default_option_value.value',
- ]
- )->joinLeft(
- ['option_value' => $this->attributeResource->getTable('eav_attribute_option_value')],
- implode(
- ' AND ',
- [
- 'option_value.option_id = entity_value.value',
- 'option_value.store_id = ' . $scope->getId(),
- ]
- ),
- []
- )->joinLeft(
- ['default_option_value' => $this->attributeResource->getTable('eav_attribute_option_value')],
- implode(
- ' AND ',
- [
- 'default_option_value.option_id = entity_value.value',
- 'default_option_value.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
- ]
- ),
- []
- );
- }
-
- return $select;
- }
}
diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php
new file mode 100644
index 000000000000..c8e4af088a0f
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php
@@ -0,0 +1,136 @@
+attributeResource = $attributeResource;
+ $this->attributeOptionProvider = $attributeOptionProvider;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSelect(AbstractAttribute $superAttribute, int $productId, ScopeInterface $scope)
+ {
+ $select = $this->attributeResource->getConnection()->select()->from(
+ ['super_attribute' => $this->attributeResource->getTable('catalog_product_super_attribute')],
+ [
+ 'sku' => 'entity.sku',
+ 'product_id' => 'product_entity.entity_id',
+ 'attribute_code' => 'attribute.attribute_code',
+ 'value_index' => 'entity_value.value',
+ 'super_attribute_label' => 'attribute_label.value',
+ ]
+ )->joinInner(
+ ['product_entity' => $this->attributeResource->getTable('catalog_product_entity')],
+ "product_entity.{$this->attributeOptionProvider->getProductEntityLinkField()} = super_attribute.product_id",
+ []
+ )->joinInner(
+ ['product_link' => $this->attributeResource->getTable('catalog_product_super_link')],
+ 'product_link.parent_id = super_attribute.product_id',
+ []
+ )->joinInner(
+ ['attribute' => $this->attributeResource->getTable('eav_attribute')],
+ 'attribute.attribute_id = super_attribute.attribute_id',
+ []
+ )->joinInner(
+ ['entity' => $this->attributeResource->getTable('catalog_product_entity')],
+ 'entity.entity_id = product_link.product_id',
+ []
+ )->joinInner(
+ ['entity_value' => $superAttribute->getBackendTable()],
+ implode(
+ ' AND ',
+ [
+ 'entity_value.attribute_id = super_attribute.attribute_id',
+ 'entity_value.store_id = 0',
+ "entity_value.{$this->attributeOptionProvider->getProductEntityLinkField()} = "
+ . "entity.{$this->attributeOptionProvider->getProductEntityLinkField()}",
+ ]
+ ),
+ []
+ )->joinLeft(
+ ['attribute_label' => $this->attributeResource->getTable('catalog_product_super_attribute_label')],
+ implode(
+ ' AND ',
+ [
+ 'super_attribute.product_super_attribute_id = attribute_label.product_super_attribute_id',
+ 'attribute_label.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
+ ]
+ ),
+ []
+ )->where(
+ 'super_attribute.product_id = ?',
+ $productId
+ )->where(
+ 'attribute.attribute_id = ?',
+ $superAttribute->getAttributeId()
+ );
+
+ if (!$superAttribute->getSourceModel()) {
+ $select->columns(
+ [
+ 'option_title' => $this->attributeResource->getConnection()->getIfNullSql(
+ 'option_value.value',
+ 'default_option_value.value'
+ ),
+ 'default_title' => 'default_option_value.value',
+ ]
+ )->joinLeft(
+ ['option_value' => $this->attributeResource->getTable('eav_attribute_option_value')],
+ implode(
+ ' AND ',
+ [
+ 'option_value.option_id = entity_value.value',
+ 'option_value.store_id = ' . $scope->getId(),
+ ]
+ ),
+ []
+ )->joinLeft(
+ ['default_option_value' => $this->attributeResource->getTable('eav_attribute_option_value')],
+ implode(
+ ' AND ',
+ [
+ 'default_option_value.option_id = entity_value.value',
+ 'default_option_value.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
+ ]
+ ),
+ []
+ );
+ }
+
+ return $select;
+ }
+}
diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilderInterface.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilderInterface.php
new file mode 100644
index 000000000000..400d89b836e5
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilderInterface.php
@@ -0,0 +1,26 @@
+stockStatusResource = $stockStatusResource;
+ }
+
+ /**
+ * Add stock status filter to select.
+ *
+ * @param OptionSelectBuilderInterface $subject
+ * @param Select $select
+ * @return Select
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterGetSelect(OptionSelectBuilderInterface $subject, Select $select)
+ {
+ $select->joinInner(
+ ['stock' => $this->stockStatusResource->getMainTable()],
+ 'stock.product_id = entity.entity_id',
+ []
+ )->where(
+ 'stock.stock_status = ?',
+ \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK
+ );
+
+ return $select;
+ }
+}
diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
index 498a7cac77e5..727598160ea1 100644
--- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
+++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
@@ -63,7 +63,7 @@ public function getProducts(ProductInterface $product)
);
$this->linkedProductMap[$product->getId()] = $this->collectionFactory->create()
- ->addAttributeToSelect(['price', 'special_price'])
+ ->addAttributeToSelect(['price', 'special_price', 'special_from_date', 'special_to_date'])
->addIdFilter($productIds)
->getItems();
}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/AttributeOptionProviderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/AttributeOptionProviderTest.php
index 925f7d6f4225..8a2530ab58eb 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/AttributeOptionProviderTest.php
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/AttributeOptionProviderTest.php
@@ -7,18 +7,15 @@
namespace Magento\ConfigurableProduct\Test\Unit\Model;
use Magento\ConfigurableProduct\Model\AttributeOptionProvider;
+use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface;
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
-use Magento\Framework\DB\Select;
+use Magento\Framework\App\ScopeInterface;
use Magento\Framework\App\ScopeResolverInterface;
+use Magento\Framework\DB\Select;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
-use Magento\Framework\App\ScopeInterface;
use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute;
-use Magento\CatalogInventory\Api\StockStatusRepositoryInterface;
-use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory;
-use Magento\CatalogInventory\Api\StockStatusCriteriaInterface;
-use Magento\CatalogInventory\Api\Data\StockStatusCollectionInterface;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -35,11 +32,6 @@ class AttributeOptionProviderTest extends \PHPUnit_Framework_TestCase
*/
private $objectManagerHelper;
- /**
- * @var \Magento\Framework\EntityManager\EntityMetadata|\PHPUnit_Framework_MockObject_MockObject
- */
- private $metadataMock;
-
/**
* @var ScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -71,70 +63,39 @@ class AttributeOptionProviderTest extends \PHPUnit_Framework_TestCase
private $attributeResource;
/**
- * @var StockStatusRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
- */
- private $stockStatusRepository;
-
- /**
- * @var StockStatusCriteriaInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
- */
- private $stockStatusCriteriaFactory;
-
- /**
- * @var StockStatusCriteriaInterface|\PHPUnit_Framework_MockObject_MockObject
- */
- private $stockStatusCriteriaInterface;
-
- /**
- * @var StockStatusCollectionInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var OptionSelectBuilderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
- private $stockStatusCollection;
+ private $optionSelectBuilder;
protected function setUp()
{
- $this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
- ->setMethods(['select', 'fetchAll'])
- ->disableOriginalConstructor()
- ->getMockForAbstractClass();
$this->select = $this->getMockBuilder(Select::class)
- ->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns'])
+ ->setMethods([])
->disableOriginalConstructor()
->getMock();
- $this->connectionMock->expects($this->any())
- ->method('select')
- ->willReturn($this->select);
- $this->metadataMock = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadata::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->scopeResolver = $this->getMockBuilder(ScopeResolverInterface::class)
- ->disableOriginalConstructor()
- ->getMockForAbstractClass();
- $this->abstractAttribute = $this->getMockBuilder(AbstractAttribute::class)
- ->setMethods(['getBackendTable', 'getAttributeId', 'getSourceModel', 'getSource'])
+ $this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
+
$this->scope = $this->getMockBuilder(ScopeInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->attributeResource = $this->getMockBuilder(Attribute::class)
- ->setMethods(['getTable', 'getConnection'])
- ->disableOriginalConstructor()
- ->getMock();
- $this->attributeResource->expects($this->any())
- ->method('getConnection')
- ->willReturn($this->connectionMock);
- $this->stockStatusRepository = $this->getMockBuilder(StockStatusRepositoryInterface::class)
+
+ $this->scopeResolver = $this->getMockBuilder(ScopeResolverInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->stockStatusCriteriaFactory = $this->getMockBuilder(StockStatusCriteriaInterfaceFactory::class)
- ->setMethods(['create'])
+
+ $this->attributeResource = $this->getMockBuilder(Attribute::class)
->disableOriginalConstructor()
->getMock();
- $this->stockStatusCriteriaInterface = $this->getMockBuilder(StockStatusCriteriaInterface::class)
+
+ $this->optionSelectBuilder = $this->getMockBuilder(OptionSelectBuilderInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->stockStatusCollection = $this->getMockBuilder(StockStatusCollectionInterface::class)
+
+ $this->abstractAttribute = $this->getMockBuilder(AbstractAttribute::class)
+ ->setMethods(['getSourceModel', 'getSource'])
->disableOriginalConstructor()
->getMockForAbstractClass();
@@ -143,87 +104,83 @@ protected function setUp()
AttributeOptionProvider::class,
[
'attributeResource' => $this->attributeResource,
- 'stockStatusRepository' => $this->stockStatusRepository,
- 'stockStatusCriteriaFactory' => $this->stockStatusCriteriaFactory,
'scopeResolver' => $this->scopeResolver,
+ 'optionSelectBuilder' => $this->optionSelectBuilder,
]
);
}
/**
* @param array $options
- * @dataProvider testOptionsDataProvider
+ * @dataProvider getAttributeOptionsDataProvider
*/
public function testGetAttributeOptions(array $options)
{
- $this->scopeResolver->expects($this->any())->method('getScope')->willReturn($this->scope);
- $this->scope->expects($this->any())->method('getId')->willReturn(123);
-
- $this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
- $this->select->expects($this->exactly(1))->method('columns')->willReturnSelf();
- $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
- $this->select->expects($this->exactly(3))->method('joinLeft')->willReturnSelf();
- $this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
-
- $this->abstractAttribute->expects($this->any())
- ->method('getBackendTable')
- ->willReturn('getBackendTable value');
- $this->abstractAttribute->expects($this->any())
- ->method('getAttributeId')
- ->willReturn('getAttributeId value');
+ $this->scopeResolver->expects($this->any())
+ ->method('getScope')
+ ->willReturn($this->scope);
+
+ $this->optionSelectBuilder->expects($this->any())
+ ->method('getSelect')
+ ->with($this->abstractAttribute, 4, $this->scope)
+ ->willReturn($this->select);
+
+ $this->attributeResource->expects($this->once())
+ ->method('getConnection')
+ ->willReturn($this->connectionMock);
$this->connectionMock->expects($this->once())
->method('fetchAll')
+ ->with($this->select)
->willReturn($options);
$this->assertEquals(
$options,
- $this->model->getAttributeOptions($this->abstractAttribute, 1)
+ $this->model->getAttributeOptions($this->abstractAttribute, 4)
);
}
/**
* @param array $options
- * @dataProvider testOptionsWithBackendModelDataProvider
+ * @dataProvider optionsWithBackendModelDataProvider
*/
public function testGetAttributeOptionsWithBackendModel(array $options)
{
- $this->scopeResolver->expects($this->any())->method('getScope')->willReturn($this->scope);
- $this->scope->expects($this->any())->method('getId')->willReturn(123);
-
- $this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
- $this->select->expects($this->exactly(0))->method('columns')->willReturnSelf();
- $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
- $this->select->expects($this->exactly(1))->method('joinLeft')->willReturnSelf();
- $this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
+ $this->scopeResolver->expects($this->any())
+ ->method('getScope')
+ ->willReturn($this->scope);
$source = $this->getMockBuilder(AbstractSource::class)
->disableOriginalConstructor()
->setMethods(['getAllOptions'])
->getMockForAbstractClass();
- $source->expects($this->any())
+ $source->expects($this->once())
->method('getAllOptions')
->willReturn([
['value' => 13, 'label' => 'Option Value for index 13'],
['value' => 14, 'label' => 'Option Value for index 14'],
['value' => 15, 'label' => 'Option Value for index 15']
]);
-
- $this->abstractAttribute->expects($this->atLeastOnce())
+
+ $this->abstractAttribute->expects($this->any())
->method('getSource')
->willReturn($source);
- $this->abstractAttribute->expects($this->any())
- ->method('getBackendTable')
- ->willReturn('getBackendTable value');
- $this->abstractAttribute->expects($this->any())
+ $this->abstractAttribute->expects($this->atLeastOnce())
->method('getSourceModel')
->willReturn('getSourceModel value');
- $this->abstractAttribute->expects($this->any())
- ->method('getAttributeId')
- ->willReturn('getAttributeId value');
+
+ $this->optionSelectBuilder->expects($this->any())
+ ->method('getSelect')
+ ->with($this->abstractAttribute, 1, $this->scope)
+ ->willReturn($this->select);
+
+ $this->attributeResource->expects($this->once())
+ ->method('getConnection')
+ ->willReturn($this->connectionMock);
$this->connectionMock->expects($this->once())
->method('fetchAll')
+ ->with($this->select)
->willReturn($options);
$this->assertEquals(
@@ -235,7 +192,7 @@ public function testGetAttributeOptionsWithBackendModel(array $options)
/**
* @return array
*/
- public function testOptionsDataProvider()
+ public function getAttributeOptionsDataProvider()
{
return [
[
@@ -269,7 +226,7 @@ public function testOptionsDataProvider()
/**
* @return array
*/
- public function testOptionsWithBackendModelDataProvider()
+ public function optionsWithBackendModelDataProvider()
{
return [
[
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php
new file mode 100644
index 000000000000..1ccd0b08c291
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php
@@ -0,0 +1,162 @@
+connectionMock = $this->getMockBuilder(AdapterInterface::class)
+ ->setMethods(['select', 'getIfNullSql'])
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $this->select = $this->getMockBuilder(Select::class)
+ ->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->connectionMock->expects($this->atLeastOnce())
+ ->method('select', 'getIfNullSql')
+ ->willReturn($this->select);
+
+ $this->attributeResourceMock = $this->getMockBuilder(Attribute::class)
+ ->setMethods(['getTable', 'getConnection'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->attributeResourceMock->expects($this->atLeastOnce())
+ ->method('getConnection')
+ ->willReturn($this->connectionMock);
+
+ $this->attributeOptionProviderMock = $this->getMockBuilder(OptionProvider::class)
+ ->setMethods(['getProductEntityLinkField'])
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->abstractAttributeMock = $this->getMockBuilder(AbstractAttribute::class)
+ ->setMethods(['getBackendTable', 'getAttributeId', 'getSourceModel'])
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->scope = $this->getMockBuilder(ScopeInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->objectManagerHelper = new ObjectManagerHelper($this);
+ $this->model = $this->objectManagerHelper->getObject(
+ OptionSelectBuilder::class,
+ [
+ 'attributeResource' => $this->attributeResourceMock,
+ 'attributeOptionProvider' => $this->attributeOptionProviderMock,
+ ]
+ );
+ }
+
+ /**
+ * Test for method getSelect
+ */
+ public function testGetSelect()
+ {
+ $this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
+ $this->select->expects($this->exactly(1))->method('columns')->willReturnSelf();
+ $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
+ $this->select->expects($this->exactly(3))->method('joinLeft')->willReturnSelf();
+ $this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
+
+ $this->abstractAttributeMock->expects($this->atLeastOnce())
+ ->method('getAttributeId')
+ ->willReturn('getAttributeId value');
+ $this->abstractAttributeMock->expects($this->atLeastOnce())
+ ->method('getBackendTable')
+ ->willReturn('getMainTable value');
+
+ $this->scope->expects($this->any())->method('getId')->willReturn(123);
+
+ $this->assertEquals(
+ $this->select,
+ $this->model->getSelect($this->abstractAttributeMock, 4, $this->scope)
+ );
+ }
+
+ /**
+ * Test for method getSelect with backend table
+ */
+ public function testGetSelectWithBackendModel()
+ {
+ $this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
+ $this->select->expects($this->exactly(0))->method('columns')->willReturnSelf();
+ $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
+ $this->select->expects($this->exactly(1))->method('joinLeft')->willReturnSelf();
+ $this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
+
+ $this->abstractAttributeMock->expects($this->atLeastOnce())
+ ->method('getAttributeId')
+ ->willReturn('getAttributeId value');
+ $this->abstractAttributeMock->expects($this->atLeastOnce())
+ ->method('getBackendTable')
+ ->willReturn('getMainTable value');
+ $this->abstractAttributeMock->expects($this->atLeastOnce())
+ ->method('getSourceModel')
+ ->willReturn('source model value');
+
+ $this->scope->expects($this->any())->method('getId')->willReturn(123);
+
+ $this->assertEquals(
+ $this->select,
+ $this->model->getSelect($this->abstractAttributeMock, 4, $this->scope)
+ );
+ }
+}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/Model/ResourceModel/Attribute/InStockOptionSelectBuilderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/Model/ResourceModel/Attribute/InStockOptionSelectBuilderTest.php
new file mode 100644
index 000000000000..18550e7d26f9
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/Model/ResourceModel/Attribute/InStockOptionSelectBuilderTest.php
@@ -0,0 +1,87 @@
+stockStatusResourceMock = $this->getMockBuilder(Status::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->selectMock = $this->getMockBuilder(Select::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->optionSelectBuilderMock = $this->getMockBuilder(OptionSelectBuilder::class)
+ ->setMethods([])
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->objectManagerHelper = new ObjectManager($this);
+ $this->model = $this->objectManagerHelper->getObject(
+ InStockOptionSelectBuilder::class,
+ [
+ 'stockStatusResource' => $this->stockStatusResourceMock,
+ ]
+ );
+ }
+
+ /**
+ * Test for method afterGetSelect.
+ */
+ public function testAfterGetSelect()
+ {
+ $this->stockStatusResourceMock->expects($this->once())
+ ->method('getMainTable')
+ ->willReturn('stock_table_name');
+
+ $this->selectMock->expects($this->once())
+ ->method('joinInner')
+ ->willReturnSelf();
+ $this->selectMock->expects($this->once())
+ ->method('where')
+ ->willReturnSelf();
+
+ $this->assertEquals(
+ $this->selectMock,
+ $this->model->afterGetSelect($this->optionSelectBuilderMock, $this->selectMock)
+ );
+ }
+}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php
new file mode 100644
index 000000000000..65b80eceefc8
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php
@@ -0,0 +1,100 @@
+connection = $this
+ ->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
+ ->getMock();
+ $this->resourceConnection = $this
+ ->getMockBuilder(\Magento\Framework\App\ResourceConnection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getConnection'])
+ ->getMock();
+ $this->resourceConnection->expects($this->once())->method('getConnection')->willReturn($this->connection);
+ $this->linkedProductSelectBuilder = $this
+ ->getMockBuilder(LinkedProductSelectBuilderInterface::class)
+ ->setMethods(['build'])
+ ->getMock();
+ $this->productCollection = $this
+ ->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['addAttributeToSelect', 'addIdFilter', 'getItems'])
+ ->getMock();
+ $this->collectionFactory = $this
+ ->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->collectionFactory->expects($this->once())->method('create')->willReturn($this->productCollection);
+
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ \Magento\ConfigurableProduct\Pricing\Price\LowestPriceOptionsProvider::class,
+ [
+ 'resourceConnection' => $this->resourceConnection,
+ 'linkedProductSelectBuilder' => $this->linkedProductSelectBuilder,
+ 'collectionFactory' => $this->collectionFactory,
+ ]
+ );
+ }
+
+ public function testGetProducts()
+ {
+ $productId = 1;
+ $linkedProducts = ['some', 'linked', 'products', 'dataobjects'];
+ $product = $this->getMockBuilder(ProductInterface::class)->disableOriginalConstructor()->getMock();
+ $product->expects($this->any())->method('getId')->willReturn($productId);
+ $this->linkedProductSelectBuilder->expects($this->any())->method('build')->with($productId)->willReturn([]);
+ $this->productCollection
+ ->expects($this->once())
+ ->method('addAttributeToSelect')
+ ->with(['price', 'special_price', 'special_from_date', 'special_to_date'])
+ ->willReturnSelf();
+ $this->productCollection->expects($this->once())->method('addIdFilter')->willReturnSelf();
+ $this->productCollection->expects($this->once())->method('getItems')->willReturn($linkedProducts);
+
+ $this->assertEquals($linkedProducts, $this->model->getProducts($product));
+ }
+}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php
index 79102ddefbd6..794f421f99cb 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php
@@ -15,13 +15,106 @@ class ConfigurablePriceTest extends AbstractModifierTest
*/
protected function createModel()
{
- return $this->objectManager->getObject(ConfigurablePriceModifier::class);
+ return $this->objectManager->getObject(ConfigurablePriceModifier::class, ['locator' => $this->locatorMock]);
}
- public function testModifyMeta()
+ /**
+ * @param array $metaInput
+ * @param array $metaOutput
+ * @dataProvider metaDataProvider
+ */
+ public function testModifyMeta($metaInput, $metaOutput)
{
- $meta = ['initial' => 'meta'];
+ $this->productMock->expects($this->any())
+ ->method('getTypeId')
+ ->willReturn(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE);
+
+ $metaResult = $this->getModel()->modifyMeta($metaInput);
+ $this->assertEquals($metaResult, $metaOutput);
+ }
- $this->assertArrayHasKey('initial', $this->getModel()->modifyMeta($meta));
+ /**
+ * @return array
+ */
+ public function metaDataProvider()
+ {
+ return [
+ [
+ 'metaInput' => [
+ 'pruduct-details' => [
+ 'children' => [
+ 'container_price' => [
+ 'children' => [
+ 'advanced_pricing_button' => [
+ 'arguments' => []
+ ]
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'metaOutput' => [
+ 'pruduct-details' => [
+ 'children' => [
+ 'container_price' => [
+ 'children' => [
+ 'advanced_pricing_button' => [
+ 'arguments' => [
+ 'data' => [
+ 'config' => [
+ 'visible' => 0,
+ 'disabled' => 1,
+ 'componentType' => 'container'
+ ],
+ ],
+ ],
+ ],
+ 'price' => [
+ 'arguments' => [
+ 'data' => [
+ 'config' => [
+ 'component' =>
+ 'Magento_ConfigurableProduct/js/components/price-configurable'
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ]
+ ]
+ ], [
+ 'metaInput' => [
+ 'pruduct-details' => [
+ 'children' => [
+ 'container_price' => [
+ 'children' => []
+ ]
+ ]
+ ]
+ ],
+ 'metaOutput' => [
+ 'pruduct-details' => [
+ 'children' => [
+ 'container_price' => [
+ 'children' => [
+ 'price' => [
+ 'arguments' => [
+ 'data' => [
+ 'config' => [
+ 'component' =>
+ 'Magento_ConfigurableProduct/js/components/price-configurable'
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ];
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePrice.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePrice.php
index f294cb14da4f..e3e1ef2ff87b 100644
--- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePrice.php
+++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePrice.php
@@ -49,9 +49,10 @@ public function modifyData(array $data)
*/
public function modifyMeta(array $meta)
{
- if ($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_PRICE)
- ?: $this->getGroupCodeByField($meta, self::CODE_GROUP_PRICE)
- ) {
+ $groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_PRICE)
+ ?: $this->getGroupCodeByField($meta, self::CODE_GROUP_PRICE);
+
+ if ($groupCode && !empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE])) {
if (!empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE])) {
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE] = array_replace_recursive(
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
@@ -71,7 +72,9 @@ public function modifyMeta(array $meta)
]
);
}
- if (!empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE])) {
+ if (
+ !empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE]['children'][self::$advancedPricingButton])
+ ) {
$productTypeId = $this->locator->getProduct()->getTypeId();
$visibilityConfig = ($productTypeId === ConfigurableType::TYPE_CODE)
? ['visible' => 0, 'disabled' => 1]
@@ -81,6 +84,8 @@ public function modifyMeta(array $meta)
. ConfigurablePanel::CONFIGURABLE_MATRIX . ':isEmpty',
]
];
+ $config = $visibilityConfig;
+ $config['componentType'] = 'container';
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE] = array_replace_recursive(
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
[
@@ -88,10 +93,7 @@ public function modifyMeta(array $meta)
self::$advancedPricingButton => [
'arguments' => [
'data' => [
- 'config' => [
- 'componentType' => 'container',
- $visibilityConfig
- ],
+ 'config' => $config,
],
],
],
diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml
index 496d85310e81..9e913a3592cb 100644
--- a/app/code/Magento/ConfigurableProduct/etc/di.xml
+++ b/app/code/Magento/ConfigurableProduct/etc/di.xml
@@ -15,6 +15,7 @@
+
diff --git a/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml b/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml
index 99ab8ee9050c..592b0292c98a 100644
--- a/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml
+++ b/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml
@@ -14,4 +14,7 @@
+
+
+
diff --git a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
index 1e494d59046e..a72e97138119 100644
--- a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
+++ b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
@@ -97,9 +97,9 @@ class ProcessCronQueueObserver implements ObserverInterface
protected $_shell;
/**
- * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
+ * @var \Magento\Framework\Stdlib\DateTime\DateTime
*/
- protected $timezone;
+ protected $dateTime;
/**
* @var \Symfony\Component\Process\PhpExecutableFinder
@@ -124,7 +124,7 @@ class ProcessCronQueueObserver implements ObserverInterface
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\App\Console\Request $request
* @param \Magento\Framework\ShellInterface $shell
- * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
+ * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
* @param \Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\App\State $state
@@ -138,7 +138,7 @@ public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\App\Console\Request $request,
\Magento\Framework\ShellInterface $shell,
- \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
+ \Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
\Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\App\State $state
@@ -150,7 +150,7 @@ public function __construct(
$this->_scopeConfig = $scopeConfig;
$this->_request = $request;
$this->_shell = $shell;
- $this->timezone = $timezone;
+ $this->dateTime = $dateTime;
$this->phpExecutableFinder = $phpExecutableFinderFactory->create();
$this->logger = $logger;
$this->state = $state;
@@ -170,7 +170,7 @@ public function __construct(
public function execute(\Magento\Framework\Event\Observer $observer)
{
$pendingJobs = $this->_getPendingSchedules();
- $currentTime = $this->timezone->scopeTimeStamp();
+ $currentTime = $this->dateTime->gmtTimestamp();
$jobGroupsRoot = $this->_config->getJobs();
$phpPath = $this->phpExecutableFinder->find() ?: 'php';
@@ -274,7 +274,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule,
);
}
- $schedule->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', $this->timezone->scopeTimeStamp()))->save();
+ $schedule->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()))->save();
try {
call_user_func_array($callback, [$schedule]);
@@ -285,7 +285,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule,
$schedule->setStatus(Schedule::STATUS_SUCCESS)->setFinishedAt(strftime(
'%Y-%m-%d %H:%M:%S',
- $this->timezone->scopeTimeStamp()
+ $this->dateTime->gmtTimestamp()
));
}
@@ -322,7 +322,7 @@ protected function _generate($groupId)
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$schedulePeriod = $rawSchedulePeriod * self::SECONDS_IN_MINUTE;
- if ($lastRun > $this->timezone->scopeTimeStamp() - $schedulePeriod) {
+ if ($lastRun > $this->dateTime->gmtTimestamp() - $schedulePeriod) {
return $this;
}
@@ -343,7 +343,7 @@ protected function _generate($groupId)
* save time schedules generation was ran with no expiration
*/
$this->_cache->save(
- $this->timezone->scopeTimeStamp(),
+ $this->dateTime->gmtTimestamp(),
self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT . $groupId,
['crontab'],
null
@@ -398,7 +398,7 @@ protected function _cleanup($groupId)
'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_CLEANUP_EVERY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
- if ($lastCleanup > $this->timezone->scopeTimeStamp() - $historyCleanUp * self::SECONDS_IN_MINUTE) {
+ if ($lastCleanup > $this->dateTime->gmtTimestamp() - $historyCleanUp * self::SECONDS_IN_MINUTE) {
return $this;
}
@@ -431,7 +431,7 @@ protected function _cleanup($groupId)
Schedule::STATUS_ERROR => $historyFailure * self::SECONDS_IN_MINUTE,
];
- $now = $this->timezone->scopeTimeStamp();
+ $now = $this->dateTime->gmtTimestamp();
/** @var Schedule $record */
foreach ($history as $record) {
$checkTime = $record->getExecutedAt() ? strtotime($record->getExecutedAt()) :
@@ -443,7 +443,7 @@ protected function _cleanup($groupId)
// save time history cleanup was ran with no expiration
$this->_cache->save(
- $this->timezone->scopeTimeStamp(),
+ $this->dateTime->gmtTimestamp(),
self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT . $groupId,
['crontab'],
null
@@ -475,7 +475,7 @@ protected function getConfigSchedule($jobConfig)
*/
protected function saveSchedule($jobCode, $cronExpression, $timeInterval, $exists)
{
- $currentTime = $this->timezone->scopeTimeStamp();
+ $currentTime = $this->dateTime->gmtTimestamp();
$timeAhead = $currentTime + $timeInterval;
for ($time = $currentTime; $time < $timeAhead; $time += self::SECONDS_IN_MINUTE) {
$ts = strftime('%Y-%m-%d %H:%M:00', $time);
@@ -503,7 +503,7 @@ protected function generateSchedule($jobCode, $cronExpression, $time)
->setCronExpr($cronExpression)
->setJobCode($jobCode)
->setStatus(Schedule::STATUS_PENDING)
- ->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', $this->timezone->scopeTimeStamp()))
+ ->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()))
->setScheduledAt(strftime('%Y-%m-%d %H:%M', $time));
return $schedule;
diff --git a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
index fadd9e52a7fe..7dfc037eb473 100644
--- a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
+++ b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
@@ -64,9 +64,9 @@ class ProcessCronQueueObserverTest extends \PHPUnit_Framework_TestCase
protected $_cronGroupConfig;
/**
- * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
+ * @var \Magento\Framework\Stdlib\DateTime\DateTime
*/
- protected $timezone;
+ protected $dateTimeMock;
/**
* @var \Magento\Framework\Event\Observer
@@ -126,8 +126,10 @@ protected function setUp()
$this->observer = $this->getMock(\Magento\Framework\Event\Observer::class, [], [], '', false);
- $this->timezone = $this->getMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
- $this->timezone->expects($this->any())->method('scopeTimeStamp')->will($this->returnValue(time()));
+ $this->dateTimeMock = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime\DateTime::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->dateTimeMock->expects($this->any())->method('gmtTimestamp')->will($this->returnValue(time()));
$phpExecutableFinder = $this->getMock(\Symfony\Component\Process\PhpExecutableFinder::class, [], [], '', false);
$phpExecutableFinder->expects($this->any())->method('find')->willReturn('php');
@@ -148,7 +150,7 @@ protected function setUp()
$this->_scopeConfig,
$this->_request,
$this->_shell,
- $this->timezone,
+ $this->dateTimeMock,
$phpExecutableFinderFactory,
$this->loggerMock,
$this->appStateMock
diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php
index 340d547199e2..98c89fdd6958 100644
--- a/app/code/Magento/Customer/Model/Customer.php
+++ b/app/code/Magento/Customer/Model/Customer.php
@@ -335,7 +335,7 @@ public function updateData($customer)
$customAttributes = $customer->getCustomAttributes();
if ($customAttributes !== null) {
foreach ($customAttributes as $attribute) {
- $this->setDataUsingMethod($attribute->getAttributeCode(), $attribute->getValue());
+ $this->setData($attribute->getAttributeCode(), $attribute->getValue());
}
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php
index f0a06c28193e..5e80f48ea832 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php
@@ -58,6 +58,11 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Customer\Model\ResourceModel\Customer|\PHPUnit_Framework_MockObject_MockObject */
protected $resourceMock;
+ /**
+ * @var \Magento\Framework\Reflection\DataObjectProcessor|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $dataObjectProcessor;
+
protected function setUp()
{
$this->_website = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false);
@@ -102,6 +107,15 @@ protected function setUp()
false,
false
);
+
+ $this->dataObjectProcessor = $this->getMock(
+ \Magento\Framework\Reflection\DataObjectProcessor::class,
+ ['buildOutputDataArray'],
+ [],
+ '',
+ false
+ );
+
$this->resourceMock->expects($this->any())
->method('getIdFieldName')
->will($this->returnValue('id'));
@@ -119,6 +133,7 @@ protected function setUp()
'attributeFactory' => $this->attributeFactoryMock,
'registry' => $this->registryMock,
'resource' => $this->resourceMock,
+ 'dataObjectProcessor' => $this->dataObjectProcessor
]
);
}
@@ -271,4 +286,65 @@ public function dataProviderIsConfirmationRequired()
[1, null, 'test2@example.com', true],
];
}
+
+ public function testUpdateData()
+ {
+ $customerDataAttributes = [
+ 'attribute' => 'attribute',
+ 'test1' => 'test1',
+ 'test33' => 'test33',
+ ];
+
+ $customer = $this->getMock(
+ \Magento\Customer\Model\Data\Customer::class,
+ [
+ 'getCustomAttributes',
+ 'getId',
+ ],
+ [],
+ '',
+ false
+ );
+
+ $attribute = $this->getMock(
+ \Magento\Framework\Api\AttributeValue::class,
+ [
+ 'getAttributeCode',
+ 'getValue',
+ ],
+ [],
+ '',
+ false
+ );
+
+ $this->dataObjectProcessor->expects($this->once())
+ ->method('buildOutputDataArray')
+ ->withConsecutive(
+ [$customer, \Magento\Customer\Api\Data\CustomerInterface::class]
+ )->willReturn($customerDataAttributes);
+
+ $attribute->expects($this->exactly(3))
+ ->method('getAttributeCode')
+ ->willReturn('test33');
+
+ $attribute->expects($this->exactly(2))
+ ->method('getValue')
+ ->willReturn('test33');
+
+ $customer->expects($this->once())
+ ->method('getCustomAttributes')
+ ->willReturn([$attribute->getAttributeCode() => $attribute]);
+
+ $this->_model->updateData($customer);
+
+ foreach ($customerDataAttributes as $key => $value) {
+ $expectedResult[strtolower(trim(preg_replace('/([A-Z]|[0-9]+)/', "_$1", $key), '_'))] = $value;
+ }
+
+ $expectedResult[$attribute->getAttributeCode()] = $attribute->getValue();
+ $expectedResult['attribute_set_id'] =
+ \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER;
+
+ $this->assertEquals($this->_model->getData(), $expectedResult);
+ }
}
diff --git a/app/code/Magento/Deploy/Console/DeployStaticOptions.php b/app/code/Magento/Deploy/Console/DeployStaticOptions.php
index 7bf522f7ca35..9a73dd5d65fc 100644
--- a/app/code/Magento/Deploy/Console/DeployStaticOptions.php
+++ b/app/code/Magento/Deploy/Console/DeployStaticOptions.php
@@ -131,6 +131,11 @@ class DeployStaticOptions
*/
const CONTENT_VERSION = 'content-version';
+ /**
+ * Key for refresh content version only mode
+ */
+ const REFRESH_CONTENT_VERSION_ONLY = 'refresh-content-version-only';
+
/**
* Deploy static command options list
*
@@ -225,6 +230,13 @@ private function getBasicOptions()
'Custom version of static content can be used if running deployment on multiple nodes '
. 'to ensure that static content version is identical and caching works properly.'
),
+ new InputOption(
+ self::REFRESH_CONTENT_VERSION_ONLY,
+ null,
+ InputOption::VALUE_NONE,
+ 'Refreshing the version of static content only can be used to refresh static content '
+ . 'in browser cache and CDN cache.'
+ ),
new InputArgument(
self::LANGUAGES_ARGUMENT,
InputArgument::IS_ARRAY,
diff --git a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Less.php b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Less.php
index d9f231c4cee3..8a464ca4bc62 100644
--- a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Less.php
+++ b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Less.php
@@ -127,23 +127,34 @@ private function hasOverrides(PackageFile $parentFile, Package $package)
$parentFile->getPackage()->getPath(),
$parentFile->getExtension()
);
- $parentFiles = $this->collectFileMap($parentFile->getFileName(), $map);
- $currentPackageLessFiles = $package->getFilesByType('less');
- $currentPackageCssFiles = $package->getFilesByType('css');
/** @var PackageFile[] $currentPackageFiles */
- $currentPackageFiles = array_merge($currentPackageLessFiles, $currentPackageCssFiles);
+ $currentPackageFiles = array_merge($package->getFilesByType('less'), $package->getFilesByType('css'));
foreach ($currentPackageFiles as $file) {
- if (in_array($file->getDeployedFileName(), $parentFiles)) {
+ if ($this->inParentFiles($file->getDeployedFileName(), $parentFile->getFileName(), $map)) {
return true;
}
}
+ return false;
+ }
- $intersections = array_intersect($parentFiles, array_keys($currentPackageFiles));
- if ($intersections) {
- return true;
+ /**
+ * @param string $fileName
+ * @param string $parentFile
+ * @param array $map
+ * @return bool
+ */
+ private function inParentFiles($fileName, $parentFile, $map)
+ {
+ if (isset($map[$parentFile])) {
+ if (in_array($fileName, $map[$parentFile])) {
+ return true;
+ } else {
+ foreach ($map[$parentFile] as $pFile) {
+ return $this->inParentFiles($fileName, $pFile, $map);
+ }
+ }
}
-
return false;
}
@@ -186,25 +197,6 @@ private function buildMap($filePath, $packagePath, $contentType)
return $this->map;
}
- /**
- * Flatten map tree into simple array
- *
- * Original map file information structure in form of tree,
- * and to have checking of overridden files simpler we need to flatten that tree
- *
- * @param string $fileName
- * @param array $map
- * @return array
- */
- private function collectFileMap($fileName, array $map)
- {
- $result = isset($map[$fileName]) ? $map[$fileName] : [];
- foreach ($result as $fName) {
- $result = array_merge($result, $this->collectFileMap($fName, $map));
- }
- return array_unique($result);
- }
-
/**
* Return normalized path
*
diff --git a/app/code/Magento/Deploy/Process/Queue.php b/app/code/Magento/Deploy/Process/Queue.php
index 31d662c874ac..671e47fe2d7d 100644
--- a/app/code/Magento/Deploy/Process/Queue.php
+++ b/app/code/Magento/Deploy/Process/Queue.php
@@ -187,24 +187,15 @@ private function assertAndExecute($name, array & $packages, array $packageJob)
{
/** @var Package $package */
$package = $packageJob['package'];
- $parentPackagesDeployed = true;
if ($package->getParent() && $package->getParent() !== $package) {
- if (!$this->isDeployed($package->getParent())) {
- $parentPackagesDeployed = false;
- } else {
- $dependencies = $packageJob['dependencies'];
- foreach ($dependencies as $parentPackage) {
- if (!$this->isDeployed($parentPackage)) {
- $parentPackagesDeployed = false;
- break;
- }
+ foreach ($packageJob['dependencies'] as $dependencyName => $dependency) {
+ if (!$this->isDeployed($dependency)) {
+ $this->assertAndExecute($dependencyName, $packages, $packages[$dependencyName]);
}
}
}
- if (
- $parentPackagesDeployed
- && ($this->maxProcesses < 2 || (count($this->inProgress) < $this->maxProcesses))
- ) {
+ if (!$this->isDeployed($package)
+ && ($this->maxProcesses < 2 || (count($this->inProgress) < $this->maxProcesses))) {
unset($packages[$name]);
$this->execute($package);
}
diff --git a/app/code/Magento/Deploy/Service/DeployRequireJsConfig.php b/app/code/Magento/Deploy/Service/DeployRequireJsConfig.php
index c54f972485ef..966f127c6ba6 100644
--- a/app/code/Magento/Deploy/Service/DeployRequireJsConfig.php
+++ b/app/code/Magento/Deploy/Service/DeployRequireJsConfig.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Deploy\Service;
+use Magento\Framework\Locale\ResolverInterfaceFactory;
+use Magento\Framework\Locale\ResolverInterface;
use Magento\RequireJs\Model\FileManagerFactory;
use Magento\Framework\View\DesignInterfaceFactory;
use Magento\Framework\View\Design\Theme\ListInterface;
@@ -46,6 +48,11 @@ class DeployRequireJsConfig
*/
private $requireJsConfigFactory;
+ /**
+ * @var ResolverInterfaceFactory
+ */
+ private $localeFactory;
+
/**
* DeployRequireJsConfig constructor
*
@@ -54,31 +61,40 @@ class DeployRequireJsConfig
* @param RepositoryFactory $assetRepoFactory
* @param FileManagerFactory $fileManagerFactory
* @param ConfigFactory $requireJsConfigFactory
+ * @param ResolverInterfaceFactory $localeFactory
*/
public function __construct(
ListInterface $themeList,
DesignInterfaceFactory $designFactory,
RepositoryFactory $assetRepoFactory,
FileManagerFactory $fileManagerFactory,
- ConfigFactory $requireJsConfigFactory
+ ConfigFactory $requireJsConfigFactory,
+ ResolverInterfaceFactory $localeFactory
) {
$this->themeList = $themeList;
$this->designFactory = $designFactory;
$this->assetRepoFactory = $assetRepoFactory;
$this->fileManagerFactory = $fileManagerFactory;
$this->requireJsConfigFactory = $requireJsConfigFactory;
+ $this->localeFactory = $localeFactory;
}
/**
* @param string $areaCode
* @param string $themePath
+ * @param string $localeCode
* @return bool true on success
*/
- public function deploy($areaCode, $themePath)
+ public function deploy($areaCode, $themePath, $localeCode)
{
/** @var \Magento\Framework\View\Design\ThemeInterface $theme */
$theme = $this->themeList->getThemeByFullPath($areaCode . '/' . $themePath);
+ /** @var \Magento\Theme\Model\View\Design $design */
$design = $this->designFactory->create()->setDesignTheme($theme, $areaCode);
+ /** @var ResolverInterface $locale */
+ $locale = $this->localeFactory->create();
+ $locale->setLocale($localeCode);
+ $design->setLocale($locale);
$assetRepo = $this->assetRepoFactory->create(['design' => $design]);
/** @var \Magento\RequireJs\Model\FileManager $fileManager */
diff --git a/app/code/Magento/Deploy/Service/DeployStaticContent.php b/app/code/Magento/Deploy/Service/DeployStaticContent.php
index 5f087ca6bb7f..66ec6e7418af 100644
--- a/app/code/Magento/Deploy/Service/DeployStaticContent.php
+++ b/app/code/Magento/Deploy/Service/DeployStaticContent.php
@@ -75,6 +75,16 @@ public function __construct(
*/
public function deploy(array $options)
{
+ $version = !empty($options[Options::CONTENT_VERSION]) && is_string($options[Options::CONTENT_VERSION])
+ ? $options[Options::CONTENT_VERSION]
+ : (new \DateTime())->getTimestamp();
+ $this->versionStorage->save($version);
+
+ if ($this->isRefreshContentVersionOnly($options)) {
+ $this->logger->warning("New content version: " . $version);
+ return;
+ }
+
$queue = $this->queueFactory->create(
[
'logger' => $this->logger,
@@ -96,11 +106,6 @@ public function deploy(array $options)
]
);
- $version = !empty($options[Options::CONTENT_VERSION]) && is_string($options[Options::CONTENT_VERSION])
- ? $options[Options::CONTENT_VERSION]
- : (new \DateTime())->getTimestamp();
- $this->versionStorage->save($version);
-
$packages = $deployStrategy->deploy($options);
if ($options[Options::NO_JAVASCRIPT] !== true) {
@@ -115,7 +120,7 @@ public function deploy(array $options)
]);
foreach ($packages as $package) {
if (!$package->isVirtual()) {
- $deployRjsConfig->deploy($package->getArea(), $package->getTheme());
+ $deployRjsConfig->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
$deployI18n->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
$deployBundle->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
}
@@ -135,4 +140,14 @@ private function getProcessesAmount(array $options)
{
return isset($options[Options::JOBS_AMOUNT]) ? (int)$options[Options::JOBS_AMOUNT] : 0;
}
+
+ /**
+ * @param array $options
+ * @return bool
+ */
+ private function isRefreshContentVersionOnly(array $options)
+ {
+ return isset($options[Options::REFRESH_CONTENT_VERSION_ONLY])
+ && $options[Options::REFRESH_CONTENT_VERSION_ONLY];
+ }
}
diff --git a/app/code/Magento/Deploy/Test/Unit/Process/QueueTest.php b/app/code/Magento/Deploy/Test/Unit/Process/QueueTest.php
index a657a3a058a8..e97af44545a4 100644
--- a/app/code/Magento/Deploy/Test/Unit/Process/QueueTest.php
+++ b/app/code/Magento/Deploy/Test/Unit/Process/QueueTest.php
@@ -113,8 +113,8 @@ public function testAdd()
public function testProcess()
{
$package = $this->getMock(Package::class, [], [], '', false);
- $package->expects($this->any())->method('getState')->willReturn(1);
- $package->expects($this->once())->method('getParent')->willReturn(null);
+ $package->expects($this->any())->method('getState')->willReturn(0);
+ $package->expects($this->exactly(2))->method('getParent')->willReturn(true);
$package->expects($this->any())->method('getArea')->willReturn('area');
$package->expects($this->any())->method('getPath')->willReturn('path');
$package->expects($this->any())->method('getFiles')->willReturn([]);
diff --git a/app/code/Magento/Deploy/Test/Unit/Service/DeployStaticContentTest.php b/app/code/Magento/Deploy/Test/Unit/Service/DeployStaticContentTest.php
index 04bfea068cab..8ac828cb195d 100644
--- a/app/code/Magento/Deploy/Test/Unit/Service/DeployStaticContentTest.php
+++ b/app/code/Magento/Deploy/Test/Unit/Service/DeployStaticContentTest.php
@@ -114,14 +114,18 @@ protected function setUp()
public function testDeploy($options, $expectedContentVersion)
{
$package = $this->getMock(Package::class, [], [], '', false);
- $package->expects($this->exactly(1))->method('isVirtual')->willReturn(false);
- $package->expects($this->exactly(3))->method('getArea')->willReturn('area');
- $package->expects($this->exactly(3))->method('getTheme')->willReturn('theme');
- $package->expects($this->exactly(2))->method('getLocale')->willReturn('locale');
-
- $packages = [
- 'package' => $package
- ];
+ if ($options['refresh-content-version-only']) {
+ $package->expects($this->never())->method('isVirtual');
+ $package->expects($this->never())->method('getArea');
+ $package->expects($this->never())->method('getTheme');
+ $package->expects($this->never())->method('getLocale');
+ } else {
+ $package->expects($this->exactly(1))->method('isVirtual')->willReturn(false);
+ $package->expects($this->exactly(3))->method('getArea')->willReturn('area');
+ $package->expects($this->exactly(3))->method('getTheme')->willReturn('theme');
+ $package->expects($this->exactly(3))->method('getLocale')->willReturn('locale');
+ }
+ $packages = ['package' => $package];
if ($expectedContentVersion) {
$this->versionStorage->expects($this->once())->method('save')->with($expectedContentVersion);
@@ -132,20 +136,27 @@ public function testDeploy($options, $expectedContentVersion)
$queue = $this->getMockBuilder(Queue::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->queueFactory->expects($this->once())->method('create')->willReturn($queue);
+ if ($options['refresh-content-version-only']) {
+ $this->queueFactory->expects($this->never())->method('create');
+ } else {
+ $this->queueFactory->expects($this->once())->method('create')->willReturn($queue);
+ }
$strategy = $this->getMockBuilder(CompactDeploy::class)
->setMethods(['deploy'])
->disableOriginalConstructor()
->getMockForAbstractClass();
- $strategy->expects($this->once())->method('deploy')
- ->with($options)
- ->willReturn($packages);
- $this->deployStrategyFactory->expects($this->once())
- ->method('create')
- ->with('compact', ['queue' => $queue])
- ->willReturn($strategy);
-
+ if ($options['refresh-content-version-only']) {
+ $strategy->expects($this->never())->method('deploy');
+ } else {
+ $strategy->expects($this->once())->method('deploy')
+ ->with($options)
+ ->willReturn($packages);
+ $this->deployStrategyFactory->expects($this->once())
+ ->method('create')
+ ->with('compact', ['queue' => $queue])
+ ->willReturn($strategy);
+ }
$deployPackageService = $this->getMockBuilder(DeployPackage::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
@@ -166,34 +177,32 @@ public function testDeploy($options, $expectedContentVersion)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->objectManager->expects($this->exactly(4))
- ->method('create')
- ->withConsecutive(
- [DeployPackage::class, ['logger' => $this->logger]],
- [DeployRequireJsConfig::class, ['logger' => $this->logger]],
- [DeployTranslationsDictionary::class, ['logger' => $this->logger]],
- [Bundle::class, ['logger' => $this->logger]]
- )
- ->willReturnOnConsecutiveCalls(
- $deployPackageService,
- $deployRjsConfig,
- $deployI18n,
- $deployBundle
- );
-
- $this->objectManager->expects($this->exactly(1))
- ->method('get')
- ->withConsecutive(
- [MinifyTemplates::class]
- )
- ->willReturnOnConsecutiveCalls(
- $minifyTemplates
- );
-
- $this->assertEquals(
- null,
- $this->service->deploy($options)
- );
+ if ($options['refresh-content-version-only']) {
+ $this->objectManager->expects($this->never())->method('create');
+ $this->objectManager->expects($this->never())->method('get');
+ } else {
+ $this->objectManager->expects($this->exactly(4))
+ ->method('create')
+ ->withConsecutive(
+ [DeployPackage::class, ['logger' => $this->logger]],
+ [DeployRequireJsConfig::class, ['logger' => $this->logger]],
+ [DeployTranslationsDictionary::class, ['logger' => $this->logger]],
+ [Bundle::class, ['logger' => $this->logger]]
+ )
+ ->willReturnOnConsecutiveCalls(
+ $deployPackageService,
+ $deployRjsConfig,
+ $deployI18n,
+ $deployBundle
+ );
+
+ $this->objectManager->expects($this->exactly(1))
+ ->method('get')
+ ->withConsecutive([MinifyTemplates::class])
+ ->willReturnOnConsecutiveCalls($minifyTemplates);
+ }
+
+ $this->assertEquals(null, $this->service->deploy($options));
}
public function deployDataProvider()
@@ -203,7 +212,8 @@ public function deployDataProvider()
[
'strategy' => 'compact',
'no-javascript' => false,
- 'no-html-minify' => false
+ 'no-html-minify' => false,
+ 'refresh-content-version-only' => false,
],
null // content version value should not be asserted in this case
],
@@ -212,9 +222,17 @@ public function deployDataProvider()
'strategy' => 'compact',
'no-javascript' => false,
'no-html-minify' => false,
+ 'refresh-content-version-only' => false,
'content-version' => '123456',
],
'123456'
+ ],
+ [
+ [
+ 'refresh-content-version-only' => true,
+ 'content-version' => '654321',
+ ],
+ '654321'
]
];
}
diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsDisableCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsDisableCommand.php
new file mode 100644
index 000000000000..dbecc673c1b8
--- /dev/null
+++ b/app/code/Magento/Developer/Console/Command/TemplateHintsDisableCommand.php
@@ -0,0 +1,62 @@
+resourceConfig = $resourceConfig;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this->setName(self::COMMAND_NAME)
+ ->setDescription('Disable frontend template hints. A cache flush might be required.');
+
+ parent::configure();
+ }
+
+ /**
+ * {@inheritdoc}
+ * @throws \InvalidArgumentException
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->resourceConfig->saveConfig('dev/debug/template_hints_storefront', 0, 'default', 0);
+ $output->writeln("
". self::SUCCESS_MESSAGE . "");
+ }
+}
diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsEnableCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsEnableCommand.php
new file mode 100644
index 000000000000..b1813686c565
--- /dev/null
+++ b/app/code/Magento/Developer/Console/Command/TemplateHintsEnableCommand.php
@@ -0,0 +1,63 @@
+resourceConfig = $resourceConfig;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this->setName(self::COMMAND_NAME)
+ ->setDescription('Enable frontend template hints. A cache flush might be required.');
+
+ parent::configure();
+ }
+
+ /**
+ * {@inheritdoc}
+ * @throws \InvalidArgumentException
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->resourceConfig->saveConfig('dev/debug/template_hints_storefront', 1, 'default', 0);
+ $output->writeln("
". self::SUCCESS_MESSAGE . "");
+ }
+}
diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml
index 6b9bf23b4872..ca35c38a31b6 100644
--- a/app/code/Magento/Developer/etc/di.xml
+++ b/app/code/Magento/Developer/etc/di.xml
@@ -100,6 +100,8 @@
- Magento\Developer\Console\Command\DiInfoCommand
- Magento\Developer\Console\Command\QueryLogEnableCommand
- Magento\Developer\Console\Command\QueryLogDisableCommand
+
- Magento\Developer\Console\Command\TemplateHintsDisableCommand
+
- Magento\Developer\Console\Command\TemplateHintsEnableCommand
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php
index 32b72023340b..8f1324195b38 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php
@@ -13,7 +13,7 @@
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Serialize\Serializer\Json as Serializer;
-use Magento\Store\Api\StoreResolverInterface;
+use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Eav\Model\Cache\Type as CacheType;
use Magento\Eav\Model\Entity\Attribute;
@@ -37,9 +37,9 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
private $cache;
/**
- * @var StoreResolverInterface
+ * @var StoreManagerInterface
*/
- private $storeResolver;
+ private $storeManager;
/**
* @var Serializer
@@ -66,22 +66,25 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
/**
* @param BooleanFactory $attrBooleanFactory
* @param CacheInterface $cache
- * @param StoreResolverInterface $storeResolver
+ * @param $storeResolver @deprecated
* @param array $cacheTags
+ * @param StoreManagerInterface $storeManager
* @param Serializer $serializer
* @codeCoverageIgnore
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
BooleanFactory $attrBooleanFactory,
CacheInterface $cache = null,
- StoreResolverInterface $storeResolver = null,
+ $storeResolver = null,
array $cacheTags = null,
+ StoreManagerInterface $storeManager = null,
Serializer $serializer = null
) {
$this->_attrBooleanFactory = $attrBooleanFactory;
$this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class);
- $this->storeResolver = $storeResolver ?: ObjectManager::getInstance()->get(StoreResolverInterface::class);
$this->cacheTags = $cacheTags ?: self::$defaultCacheTags;
+ $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Serializer::class);
}
@@ -299,7 +302,7 @@ public function getSelectOptions()
{
$cacheKey = 'attribute-navigation-option-' .
$this->getAttribute()->getAttributeCode() . '-' .
- $this->storeResolver->getCurrentStoreId();
+ $this->storeManager->getStore()->getId();
$optionString = $this->cache->load($cacheKey);
if (false === $optionString) {
$options = $this->getAttribute()->getSource()->getAllOptions();
diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php
index 61146d7e3860..ced56f313dd7 100644
--- a/app/code/Magento/Eav/Setup/EavSetup.php
+++ b/app/code/Magento/Eav/Setup/EavSetup.php
@@ -942,6 +942,7 @@ public function updateAttribute($entityTypeId, $id, $field, $value = null, $sort
* @param mixed $value
* @param int $sortOrder
* @return $this
+ * @throws LocalizedException
*/
private function _updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null)
{
@@ -972,11 +973,15 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
return $this;
}
}
+ $attributeId = $this->getAttributeId($entityTypeId, $id);
+ if (false === $attributeId) {
+ throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id));
+ }
$this->setup->updateTableRow(
'eav_attribute',
'attribute_id',
- $this->getAttributeId($entityTypeId, $id),
+ $attributeId,
$field,
$value,
'entity_type_id',
@@ -994,6 +999,7 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
* @param string|array $field
* @param mixed $value
* @return $this
+ * @throws LocalizedException
*/
private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $value = null)
{
@@ -1022,6 +1028,11 @@ private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $val
return $this;
}
}
+
+ $attributeId = $this->getAttributeId($entityTypeId, $id);
+ if (false === $attributeId) {
+ throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id));
+ }
$this->setup->updateTableRow(
$this->setup->getTable($additionalTable),
'attribute_id',
diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
index 5dd00fb3bc4f..7ff2dc0b9f0d 100644
--- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
@@ -8,7 +8,8 @@
use Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend;
use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory;
use Magento\Framework\Serialize\Serializer\Json as Serializer;
-use Magento\Store\Api\StoreResolverInterface;
+use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
use Magento\Framework\App\CacheInterface;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
@@ -31,9 +32,14 @@ class DefaultFrontendTest extends \PHPUnit_Framework_TestCase
private $serializerMock;
/**
- * @var StoreResolverInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
- private $storeResolverMock;
+ private $storeManagerMock;
+
+ /**
+ * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $storeMock;
/**
* @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -64,7 +70,9 @@ protected function setUp()
->getMock();
$this->serializerMock = $this->getMockBuilder(Serializer::class)
->getMock();
- $this->storeResolverMock = $this->getMockBuilder(StoreResolverInterface::class)
+ $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
+ ->getMockForAbstractClass();
+ $this->storeMock = $this->getMockBuilder(StoreInterface::class)
->getMockForAbstractClass();
$this->cacheMock = $this->getMockBuilder(CacheInterface::class)
->getMockForAbstractClass();
@@ -83,7 +91,7 @@ protected function setUp()
[
'_attrBooleanFactory' => $this->booleanFactory,
'cache' => $this->cacheMock,
- 'storeResolver' => $this->storeResolverMock,
+ 'storeManager' => $this->storeManagerMock,
'serializer' => $this->serializerMock,
'_attribute' => $this->attributeMock,
'cacheTags' => $this->cacheTags
@@ -188,8 +196,11 @@ public function testGetSelectOptions()
$options = ['option1', 'option2'];
$serializedOptions = "{['option1', 'option2']}";
- $this->storeResolverMock->expects($this->once())
- ->method('getCurrentStoreId')
+ $this->storeManagerMock->expects($this->once())
+ ->method('getStore')
+ ->willReturn($this->storeMock);
+ $this->storeMock->expects($this->once())
+ ->method('getId')
->willReturn($storeId);
$this->attributeMock->expects($this->once())
->method('getAttributeCode')
diff --git a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml
index 403abb6fdcad..b63f79233383 100644
--- a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml
+++ b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml
@@ -22,7 +22,7 @@
- jpg jpeg gif png svg
+ jpg jpeg gif png
2097152
theme/design_config_fileUploader/save
diff --git a/app/code/Magento/GiftMessage/i18n/en_US.csv b/app/code/Magento/GiftMessage/i18n/en_US.csv
index 5c82c8e5aeb8..bac6989bd01a 100644
--- a/app/code/Magento/GiftMessage/i18n/en_US.csv
+++ b/app/code/Magento/GiftMessage/i18n/en_US.csv
@@ -22,7 +22,7 @@ OK,OK
"Gift Options","Gift Options"
"Gift Message","Gift Message"
"Do you have any gift items in your order?","Do you have any gift items in your order?"
-"Add gift options","Add gift options"
+"Add Gift Options","Add Gift Options"
"Gift Options for the Entire Order","Gift Options for the Entire Order"
"Leave this box blank if you don\'t want to leave a gift message for the entire order.","Leave this box blank if you don\'t want to leave a gift message for the entire order."
"Gift Options for Individual Items","Gift Options for Individual Items"
@@ -30,14 +30,14 @@ OK,OK
"Leave a box blank if you don\'t want to add a gift message for that item.","Leave a box blank if you don\'t want to add a gift message for that item."
"Add Gift Options for the Entire Order","Add Gift Options for the Entire Order"
"You can leave this box blank if you don\'t want to add a gift message for this address.","You can leave this box blank if you don\'t want to add a gift message for this address."
-"Add gift options for Individual Items","Add gift options for Individual Items"
+"Add Gift Options for Individual Items","Add Gift Options for Individual Items"
"You can leave this box blank if you don\'t want to add a gift message for the item.","You can leave this box blank if you don\'t want to add a gift message for the item."
"Gift Message (optional)","Gift Message (optional)"
To:,To:
From:,From:
Message:,Message:
Update,Update
-"Gift options","Gift options"
+"Gift Options","Gift Options"
Edit,Edit
Delete,Delete
"Allow Gift Messages on Order Level","Allow Gift Messages on Order Level"
diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
index 8fbb6918d711..6155cfc37c4a 100644
--- a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
+++ b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
@@ -14,7 +14,7 @@
getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" />
-
+
@@ -148,7 +148,7 @@
getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" />
-
+
@@ -197,7 +197,7 @@
-
getItemsHasMesssages()): ?> checked="checked" class="checkbox" />
-
+
diff --git a/app/code/Magento/Integration/etc/adminhtml/system.xml b/app/code/Magento/Integration/etc/adminhtml/system.xml
index 73ebb70c2a22..97aec083e7ab 100644
--- a/app/code/Magento/Integration/etc/adminhtml/system.xml
+++ b/app/code/Magento/Integration/etc/adminhtml/system.xml
@@ -48,6 +48,18 @@
Timeout for OAuth consumer credentials Post request within X seconds.
+
+
+
+
+ Maximum Number of authentication failures to lock out account.
+
+
+
+ Period of time in seconds after which account will be unlocked.
+
+
+
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php
new file mode 100644
index 000000000000..edb0795b86e3
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php
@@ -0,0 +1,114 @@
+carrierLinkFactory = $carrierLinkFactory;
+ $this->dataObjectHelper = $dataObjectHelper;
+ $this->shippingConfig = $shippingConfig;
+ }
+
+ /**
+ * @param SourceInterface $source
+ * @param array $requestData
+ * @return SourceInterface
+ * @throws InputException
+ */
+ public function hydrate(SourceInterface $source, array $requestData)
+ {
+ $useDefaultCarrierConfig = isset($requestData[SourceInterface::USE_DEFAULT_CARRIER_CONFIG])
+ && true === (bool)$requestData[SourceInterface::USE_DEFAULT_CARRIER_CONFIG];
+
+ $carrierLinks = [];
+ if (false === $useDefaultCarrierConfig
+ && isset($requestData['carrier_codes'])
+ && is_array($requestData['carrier_codes'])
+ ) {
+ $this->checkCarrierCodes($requestData['carrier_codes']);
+ $carrierLinks = $this->createCarrierLinks($requestData['carrier_codes']);
+ }
+
+ $source->setUseDefaultCarrierConfig($useDefaultCarrierConfig);
+ $source->setCarrierLinks($carrierLinks);
+ return $source;
+ }
+
+ /**
+ * @param array $carrierCodes
+ * @return void
+ * @throws InputException
+ */
+ private function checkCarrierCodes(array $carrierCodes)
+ {
+ $availableCarriers = $this->shippingConfig->getAllCarriers();
+
+ if (count(array_intersect_key(array_flip($carrierCodes), $availableCarriers)) !== count($carrierCodes)) {
+ throw new InputException(__('Wrong carrier codes data'));
+ }
+ }
+
+ /**
+ * @param array $carrierCodes
+ * @return SourceCarrierLinkInterface[]
+ */
+ private function createCarrierLinks(array $carrierCodes)
+ {
+ $carrierLinks = [];
+ foreach ($carrierCodes as $carrierCode) {
+ /** @var SourceCarrierLinkInterface $carrierLink */
+ $carrierLink = $this->carrierLinkFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $carrierLink,
+ [
+ SourceCarrierLinkInterface::CARRIER_CODE => $carrierCode,
+ ],
+ SourceCarrierLinkInterface::class
+ );
+ $carrierLinks[] = $carrierLink;
+ }
+ return $carrierLinks;
+ }
+}
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php
new file mode 100644
index 000000000000..d3711442fa24
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php
@@ -0,0 +1,70 @@
+sourceRepository = $sourceRepository;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function execute()
+ {
+ $sourceId = $this->getRequest()->getParam(SourceInterface::SOURCE_ID);
+ try {
+ $source = $this->sourceRepository->get($sourceId);
+
+ /** @var Page $result */
+ $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
+ $result->setActiveMenu('Magento_Inventory::source')
+ ->addBreadcrumb(__('Edit Source'), __('Edit Source'));
+ $result->getConfig()
+ ->getTitle()
+ ->prepend(__('Edit Source: %1', $source->getName()));
+ } catch (NoSuchEntityException $e) {
+ /** @var Redirect $result */
+ $result = $this->resultRedirectFactory->create();
+ $this->messageManager->addErrorMessage(
+ __('Source with id "%1" does not exist.', $sourceId)
+ );
+ $result->setPath('*/*');
+ }
+ return $result;
+ }
+}
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php
new file mode 100644
index 000000000000..94c37beef49a
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php
@@ -0,0 +1,34 @@
+resultFactory->create(ResultFactory::TYPE_PAGE);
+ $resultPage->setActiveMenu('Magento_Inventory::source')
+ ->addBreadcrumb(__('Sources'), __('List'));
+ $resultPage->getConfig()->getTitle()->prepend(__('Manage Sources'));
+ return $resultPage;
+ }
+}
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php
new file mode 100644
index 000000000000..46a2d67fd08a
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php
@@ -0,0 +1,93 @@
+hydrator = $hydrator;
+ $this->sourceRepository = $sourceRepository;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function execute()
+ {
+ $errorMessages = [];
+ $request = $this->getRequest();
+ $requestData = $request->getParam('items', []);
+
+ if ($request->isXmlHttpRequest() && $request->isPost() && $requestData) {
+ foreach ($requestData as $itemData) {
+ try {
+ $source = $this->sourceRepository->get(
+ $itemData[SourceInterface::SOURCE_ID]
+ );
+ $source = $this->hydrator->hydrate($source, $itemData);
+ $this->sourceRepository->save($source);
+ } catch (NoSuchEntityException $e) {
+ $errorMessages[] = __(
+ '[ID: %1] The Source does not exist.',
+ $itemData[SourceInterface::SOURCE_ID]
+ );
+ } catch (CouldNotSaveException $e) {
+ $errorMessages[] =
+ __('[ID: %1] ', $itemData[SourceInterface::SOURCE_ID])
+ . $e->getMessage();
+ }
+ }
+ } else {
+ $errorMessages[] = __('Please correct the data sent.');
+ }
+
+ /** @var Json $resultJson */
+ $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
+ $resultJson->setData([
+ 'messages' => $errorMessages,
+ 'error' => count($errorMessages),
+ ]);
+ return $resultJson;
+ }
+}
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php
new file mode 100644
index 000000000000..a9b96061a8ae
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php
@@ -0,0 +1,34 @@
+resultFactory->create(ResultFactory::TYPE_PAGE);
+ $resultPage->setActiveMenu('Magento_Inventory::source');
+ $resultPage->getConfig()->getTitle()->prepend(__('New Source'));
+ return $resultPage;
+ }
+}
diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php
new file mode 100644
index 000000000000..7d1185a6c911
--- /dev/null
+++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php
@@ -0,0 +1,181 @@
+sourceFactory = $sourceFactory;
+ $this->sourceRepository = $sourceRepository;
+ $this->dataObjectHelper = $dataObjectHelper;
+ $this->registry = $registry;
+ $this->carrierRequestDataHydrator = $carrierRequestDataHydrator;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function execute()
+ {
+ $resultRedirect = $this->resultRedirectFactory->create();
+ $requestData = $this->getRequest()->getParam('general');
+ if ($this->getRequest()->isPost() && $requestData) {
+ try {
+ $sourceId = !empty($requestData[SourceInterface::SOURCE_ID])
+ ? $requestData[SourceInterface::SOURCE_ID] : null;
+
+ $sourceId = $this->processSave($sourceId, $requestData);
+ // Keep data for plugins on Save controller. Now we can not call separate services from one form.
+ $this->registry->register(self::REGISTRY_SOURCE_ID_KEY, $sourceId);
+
+ $this->messageManager->addSuccessMessage(__('The Source has been saved.'));
+ $this->processRedirectAfterSuccessSave($resultRedirect, $sourceId);
+
+ } catch (NoSuchEntityException $e) {
+ $this->messageManager->addErrorMessage(__('The Source does not exist.'));
+ $this->processRedirectAfterFailureSave($resultRedirect);
+ } catch (CouldNotSaveException $e) {
+ $this->messageManager->addErrorMessage($e->getMessage());
+ $this->processRedirectAfterFailureSave($resultRedirect, $sourceId);
+ } catch (InputException $e) {
+ $this->messageManager->addErrorMessage($e->getMessage());
+ $this->processRedirectAfterFailureSave($resultRedirect, $sourceId);
+ } catch (Exception $e) {
+ $this->messageManager->addErrorMessage(__('Could not save source'));
+ $this->processRedirectAfterFailureSave($resultRedirect, $sourceId);
+ }
+ } else {
+ $this->messageManager->addErrorMessage(__('Wrong request.'));
+ $this->processRedirectAfterFailureSave($resultRedirect);
+ }
+ return $resultRedirect;
+ }
+
+ /**
+ * @param int $sourceId
+ * @param array $requestData
+ * @return int
+ */
+ private function processSave($sourceId, array $requestData)
+ {
+ if ($sourceId) {
+ $source = $this->sourceRepository->get($sourceId);
+ } else {
+ /** @var SourceInterface $source */
+ $source = $this->sourceFactory->create();
+ }
+ $source = $this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class);
+ $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData);
+
+ $sourceId = $this->sourceRepository->save($source);
+ return $sourceId;
+ }
+
+ /**
+ * @param Redirect $resultRedirect
+ * @param int $sourceId
+ * @return void
+ */
+ private function processRedirectAfterSuccessSave(Redirect $resultRedirect, $sourceId)
+ {
+ if ($this->getRequest()->getParam('back')) {
+ $resultRedirect->setPath('*/*/edit', [
+ SourceInterface::SOURCE_ID => $sourceId,
+ '_current' => true,
+ ]);
+ } elseif ($this->getRequest()->getParam('redirect_to_new')) {
+ $resultRedirect->setPath('*/*/new', [
+ '_current' => true,
+ ]);
+ } else {
+ $resultRedirect->setPath('*/*/');
+ }
+ }
+
+ /**
+ * @param Redirect $resultRedirect
+ * @param int|null $sourceId
+ * @return void
+ */
+ private function processRedirectAfterFailureSave(Redirect $resultRedirect, $sourceId = null)
+ {
+ if (null === $sourceId) {
+ $resultRedirect->setPath('*/*/');
+ } else {
+ $resultRedirect->setPath('*/*/edit', [
+ SourceInterface::SOURCE_ID => $sourceId,
+ '_current' => true,
+ ]);
+ }
+ }
+}
diff --git a/app/code/Magento/CatalogInventoryConfigurableProduct/LICENSE.txt b/app/code/Magento/Inventory/LICENSE.txt
similarity index 100%
rename from app/code/Magento/CatalogInventoryConfigurableProduct/LICENSE.txt
rename to app/code/Magento/Inventory/LICENSE.txt
diff --git a/app/code/Magento/CatalogInventoryConfigurableProduct/LICENSE_AFL.txt b/app/code/Magento/Inventory/LICENSE_AFL.txt
similarity index 100%
rename from app/code/Magento/CatalogInventoryConfigurableProduct/LICENSE_AFL.txt
rename to app/code/Magento/Inventory/LICENSE_AFL.txt
diff --git a/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php
new file mode 100644
index 000000000000..1bb60603feed
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php
@@ -0,0 +1,56 @@
+shippingConfig = $shippingConfig;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toOptionArray()
+ {
+ if (null === $this->sourceData) {
+ $carriers = $this->shippingConfig->getAllCarriers();
+ foreach ($carriers as $carrier) {
+ $this->sourceData[] = [
+ 'value' => $carrier->getCarrierCode(),
+ 'label' => $carrier->getConfigData('title'),
+ ];
+ }
+ }
+ return $this->sourceData;
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php
new file mode 100644
index 000000000000..f352bac25079
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php
@@ -0,0 +1,51 @@
+regionCollectionFactory = $regionCollectionFactory;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toOptionArray()
+ {
+ if (null === $this->sourceData) {
+ $regionCollection = $this->regionCollectionFactory->create();
+ $this->sourceData = $regionCollection->toOptionArray();
+ }
+ return $this->sourceData;
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source.php b/app/code/Magento/Inventory/Model/ResourceModel/Source.php
new file mode 100644
index 000000000000..08e24a89fa22
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/ResourceModel/Source.php
@@ -0,0 +1,76 @@
+sourceCarrierLinkManagement = $sourceCarrierLinkManagement;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function _construct()
+ {
+ $this->_init(InstallSchema::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function load(AbstractModel $object, $value, $field = null)
+ {
+ parent::load($object, $value, $field);
+ /** @var SourceInterface $object */
+ $this->sourceCarrierLinkManagement->loadCarrierLinksBySource($object);
+ return $this;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function save(AbstractModel $object)
+ {
+ $connection = $this->getConnection();
+ $connection->beginTransaction();
+ try {
+ parent::save($object);
+ /** @var SourceInterface $object */
+ $this->sourceCarrierLinkManagement->saveCarrierLinksBySource($object);
+ $connection->commit();
+ } catch (Exception $e) {
+ $connection->rollBack();
+ throw $e;
+ }
+ return $this;
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php
new file mode 100644
index 000000000000..533b6fe7647c
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php
@@ -0,0 +1,78 @@
+sourceCarrierLinkManagement = $sourceCarrierLinkManagement;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function _construct()
+ {
+ $this->_init(SourceModel::class, ResourceSource::class);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function load($printQuery = false, $logQuery = false)
+ {
+ parent::load($printQuery, $logQuery);
+
+ foreach ($this->_items as $item) {
+ /** @var SourceInterface $item */
+ $this->sourceCarrierLinkManagement->loadCarrierLinksBySource($item);
+ }
+ return $this;
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php
new file mode 100644
index 000000000000..bb2d9f225bbe
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php
@@ -0,0 +1,25 @@
+_init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id');
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php
new file mode 100644
index 000000000000..cb5ecd67a171
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php
@@ -0,0 +1,33 @@
+_init(SourceCarrierLinkModel::class, ResourceSourceCarrierLink::class);
+ }
+
+ /**
+ * Id field name getter
+ *
+ * @return string
+ */
+ public function getIdFieldName()
+ {
+ return 'source_carrier_link_id';
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php
new file mode 100644
index 000000000000..8d37778f00af
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/Source.php
@@ -0,0 +1,351 @@
+_init(\Magento\Inventory\Model\ResourceModel\Source::class);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getSourceId()
+ {
+ return $this->getData(SourceInterface::SOURCE_ID);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setSourceId($sourceId)
+ {
+ $this->setData(SourceInterface::SOURCE_ID, $sourceId);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return $this->getData(SourceInterface::NAME);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setName($name)
+ {
+ $this->setData(SourceInterface::NAME, $name);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getEmail()
+ {
+ return $this->getData(SourceInterface::EMAIL);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setEmail($email)
+ {
+ $this->setData(SourceInterface::EMAIL, $email);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getContactName()
+ {
+ return $this->getData(SourceInterface::CONTACT_NAME);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setContactName($contactName)
+ {
+ $this->setData(SourceInterface::CONTACT_NAME, $contactName);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isEnabled()
+ {
+ return $this->getData(SourceInterface::ENABLED);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setEnabled($enabled)
+ {
+ $this->setData(SourceInterface::ENABLED, $enabled);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getDescription()
+ {
+ return $this->getData(SourceInterface::DESCRIPTION);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setDescription($description)
+ {
+ $this->setData(SourceInterface::DESCRIPTION, $description);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getLatitude()
+ {
+ return $this->getData(SourceInterface::LATITUDE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setLatitude($latitude)
+ {
+ $this->setData(SourceInterface::LATITUDE, $latitude);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getLongitude()
+ {
+ return $this->getData(SourceInterface::LONGITUDE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setLongitude($longitude)
+ {
+ $this->setData(SourceInterface::LONGITUDE, $longitude);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCountryId()
+ {
+ return $this->getData(SourceInterface::COUNTRY_ID);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setCountryId($countryId)
+ {
+ $this->setData(SourceInterface::COUNTRY_ID, $countryId);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getRegionId()
+ {
+ return $this->getData(SourceInterface::REGION_ID);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setRegionId($regionId)
+ {
+ $this->setData(SourceInterface::REGION_ID, $regionId);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getRegion()
+ {
+ return $this->getData(SourceInterface::REGION);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setRegion($region)
+ {
+ $this->setData(SourceInterface::REGION, $region);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCity()
+ {
+ return $this->getData(SourceInterface::CITY);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setCity($city)
+ {
+ $this->setData(SourceInterface::CITY, $city);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getStreet()
+ {
+ return $this->getData(SourceInterface::STREET);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setStreet($street)
+ {
+ $this->setData(SourceInterface::STREET, $street);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getPostcode()
+ {
+ return $this->getData(SourceInterface::POSTCODE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setPostcode($postcode)
+ {
+ $this->setData(SourceInterface::POSTCODE, $postcode);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getPhone()
+ {
+ return $this->getData(SourceInterface::PHONE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setPhone($phone)
+ {
+ $this->setData(SourceInterface::PHONE, $phone);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getFax()
+ {
+ return $this->getData(SourceInterface::FAX);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setFax($fax)
+ {
+ $this->setData(SourceInterface::FAX, $fax);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getPriority()
+ {
+ return $this->getData(SourceInterface::PRIORITY);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setPriority($priority)
+ {
+ $this->setData(SourceInterface::PRIORITY, $priority);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isUseDefaultCarrierConfig()
+ {
+ return $this->getData(self::USE_DEFAULT_CARRIER_CONFIG);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUseDefaultCarrierConfig($useDefaultCarrierConfig)
+ {
+ return $this->setData(self::USE_DEFAULT_CARRIER_CONFIG, $useDefaultCarrierConfig);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCarrierLinks()
+ {
+ return $this->getData(SourceInterface::CARRIER_LINKS);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setCarrierLinks($carrierLinks)
+ {
+ $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getExtensionAttributes()
+ {
+ $extensionAttributes = $this->_getExtensionAttributes();
+ if (null === $extensionAttributes) {
+ $extensionAttributes = $this->extensionAttributesFactory->create(SourceInterface::class);
+ $this->setExtensionAttributes($extensionAttributes);
+ }
+ return $extensionAttributes;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setExtensionAttributes(
+ \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php
new file mode 100644
index 000000000000..a1f3043a5357
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php
@@ -0,0 +1,79 @@
+_init(\Magento\Inventory\Model\ResourceModel\SourceCarrierLink::class);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getCarrierCode()
+ {
+ return $this->getData(SourceCarrierLinkInterface::CARRIER_CODE);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function setCarrierCode($carrierCode)
+ {
+ $this->setData(SourceCarrierLinkInterface::CARRIER_CODE, $carrierCode);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getPosition()
+ {
+ return $this->getData(SourceCarrierLinkInterface::POSITION);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function setPosition($position)
+ {
+ $this->setData(SourceCarrierLinkInterface::POSITION, $position);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getExtensionAttributes()
+ {
+ $extensionAttributes = $this->_getExtensionAttributes();
+ if (null === $extensionAttributes) {
+ $extensionAttributes = $this->extensionAttributesFactory->create(SourceCarrierLinkInterface::class);
+ $this->setExtensionAttributes($extensionAttributes);
+ }
+ return $extensionAttributes;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function setExtensionAttributes(
+ \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php
new file mode 100644
index 000000000000..c71ced6523d6
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php
@@ -0,0 +1,139 @@
+connection = $connection;
+ $this->resourceSourceCarrierLink = $resourceSourceCarrierLink;
+ $this->collectionProcessor = $collectionProcessor;
+ $this->carrierLinkCollectionFactory = $carrierLinkCollectionFactory;
+ $this->searchCriteriaBuilder = $searchCriteriaBuilder;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function saveCarrierLinksBySource(SourceInterface $source)
+ {
+ if (is_array($source->getCarrierLinks())) {
+ try {
+ $this->deleteCurrentCarrierLinks($source);
+ if (!empty($source->getCarrierLinks())) {
+ $this->saveNewCarrierLinks($source);
+ }
+ } catch (\Exception $e) {
+ throw new StateException(__('Could not update Carrier Links'), $e);
+ }
+ }
+ }
+
+ /**
+ * @param SourceInterface $source
+ * @return void
+ */
+ private function deleteCurrentCarrierLinks(SourceInterface $source)
+ {
+ $connection = $this->connection->getConnection();
+ $connection->delete(
+ $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK),
+ $connection->quoteInto('source_id = ?', $source->getSourceId())
+ );
+ }
+
+ /**
+ * @param SourceInterface $source
+ * @return void
+ */
+ private function saveNewCarrierLinks(SourceInterface $source)
+ {
+ $carrierLinkData = [];
+ foreach ($source->getCarrierLinks() as $carrierLink) {
+ $carrierLinkData[] = [
+ 'source_id' => $source->getSourceId(),
+ SourceCarrierLinkInterface::CARRIER_CODE => $carrierLink->getCarrierCode(),
+ SourceCarrierLinkInterface::POSITION => $carrierLink->getPosition(),
+ ];
+ }
+
+ $connection = $this->connection->getConnection();
+ $connection->insertMultiple(
+ $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK),
+ $carrierLinkData
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function loadCarrierLinksBySource(SourceInterface $source)
+ {
+ $searchCriteria = $this->searchCriteriaBuilder
+ ->addFilter(SourceInterface::SOURCE_ID, $source->getSourceId())
+ ->create();
+
+ /** @var ResourceSourceCarrierLink\Collection $collection */
+ $collection = $this->carrierLinkCollectionFactory->create();
+ $this->collectionProcessor->process($searchCriteria, $collection);
+
+ $source->setCarrierLinks($collection->getItems());
+ }
+}
diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php
new file mode 100644
index 000000000000..3f5ae25d3d68
--- /dev/null
+++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php
@@ -0,0 +1,36 @@
+resourceSource = $resourceSource;
+ $this->sourceFactory = $sourceFactory;
+ $this->collectionProcessor = $collectionProcessor;
+ $this->sourceCollectionFactory = $sourceCollectionFactory;
+ $this->sourceSearchResultsFactory = $sourceSearchResultsFactory;
+ $this->searchCriteriaBuilder = $searchCriteriaBuilder;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function save(SourceInterface $source)
+ {
+ try {
+ $this->resourceSource->save($source);
+ return $source->getSourceId();
+ } catch (\Exception $e) {
+ $this->logger->error($e->getMessage());
+ throw new CouldNotSaveException(__('Could not save source'), $e);
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function get($sourceId)
+ {
+ $source = $this->sourceFactory->create();
+ $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID);
+
+ if (!$source->getSourceId()) {
+ throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId);
+ }
+ return $source;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getList(SearchCriteriaInterface $searchCriteria = null)
+ {
+ $collection = $this->sourceCollectionFactory->create();
+
+ if (null === $searchCriteria) {
+ $searchCriteria = $this->searchCriteriaBuilder->create();
+ } else {
+ $this->collectionProcessor->process($searchCriteria, $collection);
+ }
+
+ $searchResult = $this->sourceSearchResultsFactory->create();
+ $searchResult->setItems($collection->getItems());
+ $searchResult->setTotalCount($collection->getSize());
+ $searchResult->setSearchCriteria($searchCriteria);
+ return $searchResult;
+ }
+}
diff --git a/app/code/Magento/Inventory/README.md b/app/code/Magento/Inventory/README.md
new file mode 100644
index 000000000000..2defd616b65f
--- /dev/null
+++ b/app/code/Magento/Inventory/README.md
@@ -0,0 +1,5 @@
+# Inventory
+
+**Inventory** provides implementation for inventory management.
+See [concept documentation](https://github.com/magento-engcom/magento2/wiki/Technical-Vision.-Catalog-Inventory)
+for further information.
diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php
new file mode 100644
index 000000000000..d9fbffe8b477
--- /dev/null
+++ b/app/code/Magento/Inventory/Setup/InstallSchema.php
@@ -0,0 +1,335 @@
+startSetup();
+
+ $sourceTable = $this->createSourceTable($setup);
+ $sourceTable = $this->addAddressFields($sourceTable);
+ $sourceTable = $this->addContactInfoFields($sourceTable);
+ $sourceTable = $this->addSourceCarrierFields($sourceTable);
+ $setup->getConnection()->createTable($sourceTable);
+
+ $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup));
+ $setup->endSetup();
+ }
+
+ /**
+ * @param SchemaSetupInterface $setup
+ * @return Table
+ */
+ private function createSourceTable(SchemaSetupInterface $setup)
+ {
+ $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE);
+
+ return $setup->getConnection()->newTable(
+ $sourceTable
+ )->setComment(
+ 'Inventory Source Table'
+ )->addColumn(
+ SourceInterface::SOURCE_ID,
+ Table::TYPE_INTEGER,
+ null,
+ [
+ InstallSchema::OPTION_IDENTITY => true,
+ InstallSchema::OPTION_UNSIGNED => true,
+ InstallSchema::OPTION_NULLABLE => false,
+ InstallSchema::OPTION_PRIMARY => true,
+ ],
+ 'Source ID'
+ )->addColumn(
+ SourceInterface::NAME,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ ],
+ 'Source Name'
+ )->addColumn(
+ SourceInterface::ENABLED,
+ Table::TYPE_SMALLINT,
+ null,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ InstallSchema::OPTION_UNSIGNED => true,
+ InstallSchema::OPTION_DEFAULT => 1,
+ ],
+ 'Defines Is Source Enabled'
+ )->addColumn(
+ SourceInterface::DESCRIPTION,
+ Table::TYPE_TEXT,
+ 1000,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Description'
+ )->addColumn(
+ SourceInterface::LATITUDE,
+ Table::TYPE_DECIMAL,
+ null,
+ [
+ InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LAT,
+ InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE,
+ InstallSchema::OPTION_UNSIGNED => false,
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Latitude'
+ )->addColumn(
+ SourceInterface::LONGITUDE,
+ Table::TYPE_DECIMAL,
+ null,
+ [
+ InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LON,
+ InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE,
+ InstallSchema::OPTION_UNSIGNED => false,
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Longitude'
+ )->addColumn(
+ SourceInterface::PRIORITY,
+ Table::TYPE_SMALLINT,
+ null,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ InstallSchema::OPTION_UNSIGNED => true,
+ ],
+ 'Priority'
+ );
+ }
+
+ /**
+ * @param Table $sourceTable
+ * @return Table
+ */
+ private function addAddressFields(Table $sourceTable)
+ {
+ $sourceTable->addColumn(
+ SourceInterface::COUNTRY_ID,
+ Table::TYPE_TEXT,
+ 2,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ ],
+ 'Country Id'
+ )->addColumn(
+ SourceInterface::REGION_ID,
+ Table::TYPE_INTEGER,
+ null,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ InstallSchema::OPTION_UNSIGNED => true,
+ ],
+ 'Region Id'
+ )->addColumn(
+ SourceInterface::REGION,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Region'
+ )->addColumn(
+ SourceInterface::CITY,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'City'
+ )->addColumn(
+ SourceInterface::STREET,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Street'
+ )->addColumn(
+ SourceInterface::POSTCODE,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ ],
+ 'Postcode'
+ );
+ return $sourceTable;
+ }
+
+ /**
+ * @param Table $sourceTable
+ * @return Table
+ */
+ private function addContactInfoFields(Table $sourceTable)
+ {
+ $sourceTable->addColumn(
+ SourceInterface::CONTACT_NAME,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Contact Name'
+ )->addColumn(
+ SourceInterface::EMAIL,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Email'
+ )->addColumn(
+ SourceInterface::PHONE,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Phone'
+ )->addColumn(
+ SourceInterface::FAX,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ ],
+ 'Fax'
+ );
+ return $sourceTable;
+ }
+
+ /**
+ * @param Table $sourceTable
+ * @return Table
+ */
+ private function addSourceCarrierFields(Table $sourceTable)
+ {
+ $sourceTable->addColumn(
+ 'use_default_carrier_config',
+ Table::TYPE_SMALLINT,
+ null,
+ [
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'default' => '1'
+ ],
+ 'Use default carrier configuration'
+ );
+ return $sourceTable;
+ }
+
+ /**
+ * @param SchemaSetupInterface $setup
+ * @return Table
+ */
+ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup)
+ {
+ $sourceCarrierLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK);
+ $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE);
+
+ return $setup->getConnection()->newTable(
+ $sourceCarrierLinkTable
+ )->setComment(
+ 'Inventory Source Carrier Link Table'
+ )->addColumn(
+ 'source_carrier_link_id',
+ Table::TYPE_INTEGER,
+ null,
+ [
+ InstallSchema::OPTION_IDENTITY => true,
+ InstallSchema::OPTION_UNSIGNED => true,
+ InstallSchema::OPTION_NULLABLE => false,
+ InstallSchema::OPTION_PRIMARY => true,
+ ],
+ 'Source Carrier Link ID'
+ )->addColumn(
+ SourceInterface::SOURCE_ID,
+ Table::TYPE_INTEGER,
+ null,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ InstallSchema::OPTION_UNSIGNED => true,
+ ],
+ 'Source ID'
+ )->addColumn(
+ SourceCarrierLinkInterface::CARRIER_CODE,
+ Table::TYPE_TEXT,
+ 255,
+ [
+ InstallSchema::OPTION_NULLABLE => false,
+ ],
+ 'Carrier Code'
+ )->addColumn(
+ 'position',
+ Table::TYPE_SMALLINT,
+ null,
+ [
+ InstallSchema::OPTION_NULLABLE => true,
+ InstallSchema::OPTION_UNSIGNED => true,
+ ],
+ 'Position'
+ )->addForeignKey(
+ $setup->getFkName(
+ $sourceCarrierLinkTable,
+ SourceInterface::SOURCE_ID,
+ $sourceTable,
+ SourceInterface::SOURCE_ID
+ ),
+ SourceInterface::SOURCE_ID,
+ $sourceTable,
+ SourceInterface::SOURCE_ID,
+ AdapterInterface::FK_ACTION_CASCADE
+ );
+ }
+}
diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php
new file mode 100644
index 000000000000..291b7ca2e607
--- /dev/null
+++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php
@@ -0,0 +1,309 @@
+resourceSource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock();
+ $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->sourceFactory = $this->getMockBuilder(SourceInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['process'])
+ ->getMock();
+ $this->sourceCollectionFactory = $this->getMockBuilder(SourceCollectionFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->sourceSearchResultsFactory = $this->getMockBuilder(SourceSearchResultsInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->source = $this->getMockBuilder(Source::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ \Magento\Inventory\Model\SourceRepository::class,
+ [
+ 'resourceSource' => $this->resourceSource,
+ 'sourceFactory' => $this->sourceFactory,
+ 'collectionProcessor' => $this->collectionProcessor,
+ 'sourceCollectionFactory' => $this->sourceCollectionFactory,
+ 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory,
+ 'searchCriteriaBuilder' => $this->searchCriteriaBuilder,
+ 'logger' => $this->loggerMock,
+ ]
+ );
+ }
+
+ public function testSave()
+ {
+ $sourceId = 42;
+
+ $this->source
+ ->expects($this->once())
+ ->method('getSourceId')
+ ->willReturn($sourceId);
+ $this->resourceSource
+ ->expects($this->once())
+ ->method('save')
+ ->with($this->source);
+
+ self::assertEquals($sourceId, $this->model->save($this->source));
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+ */
+ public function testSaveErrorExpectsException()
+ {
+ $message = 'some message';
+
+ $this->resourceSource
+ ->expects($this->once())
+ ->method('save')
+ ->willThrowException(new \Exception($message));
+
+ $this->loggerMock
+ ->expects($this->once())
+ ->method('error')
+ ->with($message);
+
+ $this->model->save($this->source);
+ }
+
+ public function testGet()
+ {
+ $sourceId = 345;
+
+ $this->source
+ ->expects($this->once())
+ ->method('getSourceId')
+ ->willReturn($sourceId);
+ $this->sourceFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($this->source);
+ $this->resourceSource
+ ->expects($this->once())
+ ->method('load')
+ ->with($this->source, $sourceId, SourceInterface::SOURCE_ID);
+
+ self::assertSame($this->source, $this->model->get($sourceId));
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\NoSuchEntityException
+ */
+ public function testGetErrorExpectsException()
+ {
+ $sourceId = 345;
+
+ $this->source
+ ->expects($this->once())
+ ->method('getSourceId')
+ ->willReturn(null);
+ $this->sourceFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($this->source);
+ $this->resourceSource->expects($this->once())
+ ->method('load')
+ ->with(
+ $this->source,
+ $sourceId,
+ SourceInterface::SOURCE_ID
+ );
+
+ $this->model->get($sourceId);
+ }
+
+ public function testGetListWithSearchCriteria()
+ {
+ $items = [
+ $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(),
+ $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock()
+ ];
+ $totalCount = 2;
+ $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $sourceCollection = $this->getMockBuilder(SourceCollection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $sourceCollection
+ ->expects($this->once())
+ ->method('getItems')
+ ->willReturn($items);
+ $sourceCollection
+ ->expects($this->once())
+ ->method('getSize')
+ ->willReturn($totalCount);
+ $this->sourceCollectionFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($sourceCollection);
+
+ $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $searchResults
+ ->expects($this->once())
+ ->method('setItems')
+ ->with($items);
+ $searchResults
+ ->expects($this->once())
+ ->method('setTotalCount')
+ ->with($totalCount);
+ $searchResults
+ ->expects($this->once())
+ ->method('setSearchCriteria')
+ ->with($searchCriteria);
+ $this->sourceSearchResultsFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($searchResults);
+
+ $this->collectionProcessor
+ ->expects($this->once())
+ ->method('process')
+ ->with($searchCriteria, $sourceCollection);
+
+ self::assertSame($searchResults, $this->model->getList($searchCriteria));
+ }
+
+ public function testGetListWithoutSearchCriteria()
+ {
+ $items = [
+ $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(),
+ $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock()
+ ];
+ $totalCount = 2;
+
+ $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->searchCriteriaBuilder
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($searchCriteria);
+
+ $sourceCollection = $this->getMockBuilder(SourceCollection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $sourceCollection
+ ->expects($this->once())
+ ->method('getItems')
+ ->willReturn($items);
+ $sourceCollection
+ ->expects($this->once())
+ ->method('getSize')
+ ->willReturn($totalCount);
+ $this->sourceCollectionFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($sourceCollection);
+
+ $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $searchResults
+ ->expects($this->once())
+ ->method('setItems')
+ ->with($items);
+ $searchResults
+ ->expects($this->once())
+ ->method('setTotalCount')
+ ->with($totalCount);
+ $searchResults
+ ->expects($this->once())
+ ->method('setSearchCriteria')
+ ->with($searchCriteria);
+ $this->sourceSearchResultsFactory
+ ->expects($this->once())
+ ->method('create')
+ ->willReturn($searchResults);
+
+ $this->collectionProcessor
+ ->expects($this->never())
+ ->method('process');
+
+ self::assertSame($searchResults, $this->model->getList());
+ }
+}
diff --git a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php
new file mode 100644
index 000000000000..997e72545e8a
--- /dev/null
+++ b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php
@@ -0,0 +1,130 @@
+sourceRepository = $sourceRepository;
+ $this->searchResultFactory = $searchResultFactory;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getData()
+ {
+ $data = parent::getData();
+ if ('inventory_source_form_data_source' === $this->name) {
+ // It is need for support of several fieldsets.
+ // For details see \Magento\Ui\Component\Form::getDataSourceData
+ if ($data['totalRecords'] > 0) {
+ $sourceId = $data['items'][0][SourceInterface::SOURCE_ID];
+ $sourceGeneralData = $data['items'][0];
+ $sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId);
+ $dataForSingle[$sourceId] = [
+ 'general' => $sourceGeneralData,
+ ];
+ $data = $dataForSingle;
+ } else {
+ $data = [];
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSearchResult()
+ {
+ $searchCriteria = $this->getSearchCriteria();
+ $result = $this->sourceRepository->getList($searchCriteria);
+
+ $searchResult = $this->searchResultFactory->create(
+ $result->getItems(),
+ $result->getTotalCount(),
+ $searchCriteria,
+ SourceInterface::SOURCE_ID
+ );
+ return $searchResult;
+ }
+
+ /**
+ * @param int $sourceId
+ * @return array
+ */
+ private function getAssignedCarrierCodes($sourceId)
+ {
+ $source = $this->sourceRepository->get($sourceId);
+
+ $carrierCodes = [];
+ foreach ($source->getCarrierLinks() as $carrierLink) {
+ $carrierCodes[] = $carrierLink->getCarrierCode();
+ }
+ return $carrierCodes;
+ }
+}
diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json
new file mode 100644
index 000000000000..45581db5f40b
--- /dev/null
+++ b/app/code/Magento/Inventory/composer.json
@@ -0,0 +1,27 @@
+{
+ "name": "magento/module-inventory",
+ "description": "N/A",
+ "require": {
+ "php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
+ "magento/framework": "100.2.*",
+ "magento/module-inventory-api": "100.0.*",
+ "magento/module-backend": "100.2.*",
+ "magento/module-directory": "100.2.*",
+ "magento/module-shipping": "100.2.*",
+ "magento/module-ui": "100.2.*"
+ },
+ "type": "magento2-module",
+ "version": "100.0.0-dev",
+ "license": [
+ "OSL-3.0",
+ "AFL-3.0"
+ ],
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Magento\\Inventory\\": ""
+ }
+ }
+}
diff --git a/app/code/Magento/Inventory/etc/adminhtml/di.xml b/app/code/Magento/Inventory/etc/adminhtml/di.xml
new file mode 100644
index 000000000000..f1989475949e
--- /dev/null
+++ b/app/code/Magento/Inventory/etc/adminhtml/di.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ inventory_source_form.inventory_source_form
+
+
+
diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml
new file mode 100644
index 000000000000..bd4c7e9e1e3f
--- /dev/null
+++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/etc/adminhtml/routes.xml b/app/code/Magento/Inventory/etc/adminhtml/routes.xml
new file mode 100644
index 000000000000..72e6c53b9857
--- /dev/null
+++ b/app/code/Magento/Inventory/etc/adminhtml/routes.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml
new file mode 100644
index 000000000000..3c6091ff5561
--- /dev/null
+++ b/app/code/Magento/Inventory/etc/di.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/etc/module.xml b/app/code/Magento/Inventory/etc/module.xml
new file mode 100644
index 000000000000..2ef165277a57
--- /dev/null
+++ b/app/code/Magento/Inventory/etc/module.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogInventoryConfigurableProduct/registration.php b/app/code/Magento/Inventory/registration.php
similarity index 82%
rename from app/code/Magento/CatalogInventoryConfigurableProduct/registration.php
rename to app/code/Magento/Inventory/registration.php
index d784dbbbe606..55b1734a5250 100644
--- a/app/code/Magento/CatalogInventoryConfigurableProduct/registration.php
+++ b/app/code/Magento/Inventory/registration.php
@@ -6,6 +6,6 @@
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
- 'Magento_CatalogInventoryConfigurableProduct',
+ 'Magento_Inventory',
__DIR__
);
diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml
new file mode 100644
index 000000000000..8944441fd693
--- /dev/null
+++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml
new file mode 100644
index 000000000000..a1a413733288
--- /dev/null
+++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml
new file mode 100644
index 000000000000..68d4c1c00309
--- /dev/null
+++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml
new file mode 100644
index 000000000000..e7726ee34109
--- /dev/null
+++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml
@@ -0,0 +1,268 @@
+
+
+
diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml
new file mode 100644
index 000000000000..c38f71ff5dd0
--- /dev/null
+++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml
@@ -0,0 +1,280 @@
+
+
+
+
+ -
+
- inventory_source_listing.inventory_source_listing_data_source
+
+
+
+
+
+
+ inventory_source_listing_columns
+
+ inventory_source_listing.inventory_source_listing_data_source
+
+
+
+
+
+ source_id
+
+
+
+
+
+ id
+ source_id
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - false
+
+ source_id
+ true
+ inventory_source_listing.inventory_source_listing.inventory_source_listing_columns.ids
+
+
+
+ - inventory_source_listing.inventory_source_listing.inventory_source_listing_columns_editor
+ - startEdit
+ -
+
- ${ $.$data.rowIndex }
+ - true
+
+
+
+
+
+
+ source_id
+
+
+
+
+ textRange
+
+ asc
+
+
+
+
+ text
+
+
+ text
+
+ true
+
+
+
+
+
+
+ text
+
+ text
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+
+ select
+ select
+
+
+
+
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+ false
+ select
+ select
+
+
+
+
+
+ false
+ select
+ select
+
+
+
+
+
+ text
+
+ false
+
+
+
+
+ text
+
+ text
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+ false
+
+
+
+
+ text
+
+ text
+
+ true
+
+
+
+
+
+
+
+ -
+
- inventory/source/edit
+
+
+
+ source_id
+
+
+
+
diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php
new file mode 100644
index 000000000000..9d0fb91a8d9d
--- /dev/null
+++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php
@@ -0,0 +1,69 @@
+" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/InventoryApi/LICENSE_AFL.txt b/app/code/Magento/InventoryApi/LICENSE_AFL.txt
new file mode 100644
index 000000000000..f39d641b18a1
--- /dev/null
+++ b/app/code/Magento/InventoryApi/LICENSE_AFL.txt
@@ -0,0 +1,48 @@
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
diff --git a/app/code/Magento/InventoryApi/README.md b/app/code/Magento/InventoryApi/README.md
new file mode 100644
index 000000000000..e10a610def87
--- /dev/null
+++ b/app/code/Magento/InventoryApi/README.md
@@ -0,0 +1,5 @@
+# InventoryApi
+
+**InventoryApi** provides interfaces for inventory management.
+See [concept documentation](https://github.com/magento-engcom/magento2/wiki/Technical-Vision.-Catalog-Inventory)
+for further information.
diff --git a/app/code/Magento/CatalogInventoryConfigurableProduct/composer.json b/app/code/Magento/InventoryApi/composer.json
similarity index 53%
rename from app/code/Magento/CatalogInventoryConfigurableProduct/composer.json
rename to app/code/Magento/InventoryApi/composer.json
index 2bfd4a377188..36fb986952cb 100644
--- a/app/code/Magento/CatalogInventoryConfigurableProduct/composer.json
+++ b/app/code/Magento/InventoryApi/composer.json
@@ -1,16 +1,12 @@
{
- "name": "magento/module-catalog-inventory-configurable-product",
+ "name": "magento/module-inventory-api",
"description": "N/A",
"require": {
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
- "magento/module-catalog-inventory": "100.2.*",
"magento/framework": "100.2.*"
},
- "suggest": {
- "magento/module-configurable-product": "100.2.*"
- },
"type": "magento2-module",
- "version": "100.2.0-dev",
+ "version": "100.0.0-dev",
"license": [
"OSL-3.0",
"AFL-3.0"
@@ -20,7 +16,7 @@
"registration.php"
],
"psr-4": {
- "Magento\\CatalogInventoryConfigurableProduct\\": ""
+ "Magento\\InventoryApi\\": ""
}
}
}
diff --git a/app/code/Magento/InventoryApi/etc/acl.xml b/app/code/Magento/InventoryApi/etc/acl.xml
new file mode 100644
index 000000000000..b353c2a55244
--- /dev/null
+++ b/app/code/Magento/InventoryApi/etc/acl.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogInventoryConfigurableProduct/etc/module.xml b/app/code/Magento/InventoryApi/etc/module.xml
similarity index 76%
rename from app/code/Magento/CatalogInventoryConfigurableProduct/etc/module.xml
rename to app/code/Magento/InventoryApi/etc/module.xml
index 9c0772cf2ae5..9b4ae307339b 100644
--- a/app/code/Magento/CatalogInventoryConfigurableProduct/etc/module.xml
+++ b/app/code/Magento/InventoryApi/etc/module.xml
@@ -6,5 +6,5 @@
*/
-->
-
+
diff --git a/app/code/Magento/InventoryApi/etc/webapi.xml b/app/code/Magento/InventoryApi/etc/webapi.xml
new file mode 100644
index 000000000000..6c413af4829c
--- /dev/null
+++ b/app/code/Magento/InventoryApi/etc/webapi.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/InventoryApi/registration.php b/app/code/Magento/InventoryApi/registration.php
new file mode 100644
index 000000000000..ce0a9c85a875
--- /dev/null
+++ b/app/code/Magento/InventoryApi/registration.php
@@ -0,0 +1,11 @@
+addressRenderer->format($address, 'html');
}
+
+ /**
+ * @inheritdoc
+ */
+ public function getChildHtml($alias = '', $useCache = true)
+ {
+ $layout = $this->getLayout();
+
+ if ($alias || !$layout) {
+ return parent::getChildHtml($alias, $useCache);
+ }
+
+ $childNames = $layout->getChildNames($this->getNameInLayout());
+ $outputChildNames = array_diff($childNames, ['extra_customer_info']);
+
+ $out = '';
+ foreach ($outputChildNames as $childName) {
+ $out .= $layout->renderElement($childName, $useCache);
+ }
+
+ return $out;
+ }
}
diff --git a/app/code/Magento/Sales/Block/Order/View.php b/app/code/Magento/Sales/Block/Order/View.php
index f63de0a39435..e77711d28b99 100644
--- a/app/code/Magento/Sales/Block/Order/View.php
+++ b/app/code/Magento/Sales/Block/Order/View.php
@@ -27,9 +27,9 @@ class View extends \Magento\Framework\View\Element\Template
protected $_coreRegistry = null;
/**
- * @var \Magento\Customer\Model\Session
+ * @var \Magento\Framework\App\Http\Context
*/
- protected $_customerSession;
+ protected $httpContext;
/**
* @var \Magento\Payment\Helper\Data
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php
index e276eccb85b5..823385c4b78d 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php
@@ -439,14 +439,14 @@ public function canVoid()
*/
public static function getStates()
{
- if (is_null(self::$_states)) {
- self::$_states = [
+ if (is_null(static::$_states)) {
+ static::$_states = [
self::STATE_OPEN => __('Pending'),
self::STATE_REFUNDED => __('Refunded'),
self::STATE_CANCELED => __('Canceled'),
];
}
- return self::$_states;
+ return static::$_states;
}
/**
@@ -461,11 +461,11 @@ public function getStateName($stateId = null)
$stateId = $this->getState();
}
- if (is_null(self::$_states)) {
- self::getStates();
+ if (is_null(static::$_states)) {
+ static::getStates();
}
- if (isset(self::$_states[$stateId])) {
- return self::$_states[$stateId];
+ if (isset(static::$_states[$stateId])) {
+ return static::$_states[$stateId];
}
return __('Unknown State');
}
diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php
index 8b9fb9151325..622bc7783c11 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice.php
@@ -543,14 +543,14 @@ public function addItem(\Magento\Sales\Model\Order\Invoice\Item $item)
*/
public static function getStates()
{
- if (null === self::$_states) {
- self::$_states = [
+ if (null === static::$_states) {
+ static::$_states = [
self::STATE_OPEN => __('Pending'),
self::STATE_PAID => __('Paid'),
self::STATE_CANCELED => __('Canceled'),
];
}
- return self::$_states;
+ return static::$_states;
}
/**
@@ -565,11 +565,11 @@ public function getStateName($stateId = null)
$stateId = $this->getState();
}
- if (null === self::$_states) {
- self::getStates();
+ if (null === static::$_states) {
+ static::getStates();
}
- if (isset(self::$_states[$stateId])) {
- return self::$_states[$stateId];
+ if (isset(static::$_states[$stateId])) {
+ return static::$_states[$stateId];
}
return __('Unknown State');
}
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php
index 3a31aca1b5df..715f68d3210a 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php
@@ -165,6 +165,6 @@ public function getAmount()
*/
public function getTitleDescription()
{
- return $this->getSource()->getDataUsingMethod($this->getTitleSourceField());
+ return $this->getSource()->getOrder()->getData($this->getTitleSourceField());
}
}
diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
index d63c6f23f401..38f5e7bdfc4a 100644
--- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
+++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
@@ -56,7 +56,7 @@
-
+
diff --git a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml
index 2d404cb96f97..8065b7e23613 100644
--- a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml
+++ b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml
@@ -13,7 +13,9 @@
-
+
+
+