From 7d4465670326ad09d15985091d40834f6ec040f9 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Fri, 5 Jan 2018 18:08:22 +0200
Subject: [PATCH 0001/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Model/Product/Type/Grouped.php | 2 +-
.../_files/product_virtual_out_of_stock.php | 20 ++
.../product_virtual_out_of_stock_rollback.php | 26 +++
.../Model/Product/Type/GroupedTest.php | 214 ++++++++++++++++--
.../product_grouped_with_out_of_stock.php | 75 ++++++
...uct_grouped_with_out_of_stock_rollback.php | 10 +
6 files changed, 331 insertions(+), 16 deletions(-)
create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock.php
create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock_rollback.php
create mode 100644 dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
create mode 100644 dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock_rollback.php
diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
index e1c97c8912cf8..c97a62d9df456 100644
--- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
+++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
@@ -341,7 +341,7 @@ protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $pr
if ($isStrictProcessMode && !$subProduct->getQty()) {
return __('Please specify the quantity of product(s).')->render();
}
- $productsInfo[$subProduct->getId()] = intval($subProduct->getQty());
+ $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? intval($subProduct->getQty()) : 0;
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock.php
new file mode 100644
index 0000000000000..cff2e83ed002e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock.php
@@ -0,0 +1,20 @@
+create(\Magento\Catalog\Model\Product::class);
+$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL)
+ ->setId(31)
+ ->setAttributeSetId(4)
+ ->setWebsiteIds([1])
+ ->setName('Virtual Product Out')
+ ->setSku('virtual-product-out')
+ ->setPrice(10)
+ ->setTaxClassId(0)
+ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
+ ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
+ ->setStockData(['is_in_stock' => 0])
+ ->save();
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock_rollback.php
new file mode 100644
index 0000000000000..8055ca4a25569
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_out_of_stock_rollback.php
@@ -0,0 +1,26 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+
+try {
+ $product = $productRepository->get('virtual-product-out', false, null, true);
+ $productRepository->delete($product);
+} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
+ //Product already removed
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index dcf4565873ea5..554a20d8a18a7 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -5,8 +5,19 @@
*/
namespace Magento\GroupedProduct\Model\Product\Type;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\Product;
+use Magento\CatalogInventory\Model\Configuration;
+use Magento\Framework\App\Config\ReinitableConfigInterface;
+use Magento\Framework\App\Config\Value;
+
class GroupedTest extends \PHPUnit\Framework\TestCase
{
+ /**
+ * @var ReinitableConfigInterface
+ */
+ private $reinitableConfig;
+
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
@@ -20,16 +31,21 @@ class GroupedTest extends \PHPUnit\Framework\TestCase
protected function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-
$this->_productType = $this->objectManager->get(\Magento\Catalog\Model\Product\Type::class);
+ $this->reinitableConfig = $this->objectManager->get(ReinitableConfigInterface::class);
+ }
+
+ protected function tearDown()
+ {
+ $this->dropConfigValue(Configuration::XML_PATH_SHOW_OUT_OF_STOCK);
}
public function testFactory()
{
$product = new \Magento\Framework\DataObject();
- $product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE);
+ $product->setTypeId(Grouped::TYPE_CODE);
$type = $this->_productType->factory($product);
- $this->assertInstanceOf(\Magento\GroupedProduct\Model\Product\Type\Grouped::class, $type);
+ $this->assertInstanceOf(Grouped::class, $type);
}
/**
@@ -38,12 +54,12 @@ public function testFactory()
*/
public function testGetAssociatedProducts()
{
- $productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
- /** @var \Magento\Catalog\Model\Product $product */
+ /** @var Product $product */
$product = $productRepository->get('grouped-product');
$type = $product->getTypeInstance();
- $this->assertInstanceOf(\Magento\GroupedProduct\Model\Product\Type\Grouped::class, $type);
+ $this->assertInstanceOf(Grouped::class, $type);
$associatedProducts = $type->getAssociatedProducts($product);
$this->assertCount(2, $associatedProducts);
@@ -53,7 +69,7 @@ public function testGetAssociatedProducts()
}
/**
- * @param \Magento\Catalog\Model\Product $product
+ * @param Product $product
*/
private function assertProductInfo($product)
{
@@ -92,25 +108,25 @@ public function testPrepareProduct()
\Magento\Framework\DataObject::class,
['data' => ['value' => ['qty' => 2]]]
);
- /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
- $productRepository = $this->objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ /** @var ProductRepositoryInterface $productRepository */
+ $productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
$product = $productRepository->get('grouped-product');
- /** @var \Magento\GroupedProduct\Model\Product\Type\Grouped $type */
- $type = $this->objectManager->get(\Magento\GroupedProduct\Model\Product\Type\Grouped::class);
+ /** @var Grouped $type */
+ $type = $this->objectManager->get(Grouped::class);
$processModes = [
- \Magento\GroupedProduct\Model\Product\Type\Grouped::PROCESS_MODE_FULL,
- \Magento\GroupedProduct\Model\Product\Type\Grouped::PROCESS_MODE_LITE
+ Grouped::PROCESS_MODE_FULL,
+ Grouped::PROCESS_MODE_LITE
];
$expectedData = [
- \Magento\GroupedProduct\Model\Product\Type\Grouped::PROCESS_MODE_FULL => [
+ Grouped::PROCESS_MODE_FULL => [
1 => '{"super_product_config":{"product_type":"grouped","product_id":"'
. $product->getId() . '"}}',
21 => '{"super_product_config":{"product_type":"grouped","product_id":"'
. $product->getId() . '"}}',
],
- \Magento\GroupedProduct\Model\Product\Type\Grouped::PROCESS_MODE_LITE => [
+ Grouped::PROCESS_MODE_LITE => [
$product->getId() => '{"value":{"qty":2}}',
]
];
@@ -127,4 +143,172 @@ public function testPrepareProduct()
}
}
}
+
+ /**
+ * Test adding grouped product to cart then one of subproducts is out of stock.
+ *
+ * @magentoDataFixture Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
+ * @magentoAppArea frontend
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
+ * @dataProvider outOfStockSubProductDataProvider
+ * @param bool $outOfStockShown
+ * @param array $data
+ * @param array $expected
+ */
+ public function testOutOfStockSubProduct(bool $outOfStockShown, array $data, array $expected)
+ {
+ $this->changeConfigValue(Configuration::XML_PATH_SHOW_OUT_OF_STOCK, $outOfStockShown);
+ $buyRequest = new \Magento\Framework\DataObject($data);
+ $productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
+ /** @var Product $product */
+ $product = $productRepository->get('grouped-product');
+ /** @var Grouped $groupedProduct */
+ $groupedProduct = $this->objectManager->get(Grouped::class);
+ $actual = $groupedProduct->prepareForCartAdvanced($buyRequest, $product, Grouped::PROCESS_MODE_FULL);
+ self::assertEquals(
+ count($expected),
+ count($actual)
+ );
+ /** @var array $element */
+ foreach ($expected as $number => $element) {
+ foreach ($element as $key => $value) {
+ self::assertEquals(
+ $value,
+ $actual[$number]->getData($key),
+ "Failed asserting that value $key matches expected"
+ );
+ }
+ }
+
+ }
+
+ /**
+ * Data provider for testOutOfStockSubProduct.
+ *
+ * @return array
+ */
+ public function outOfStockSubProductDataProvider()
+ {
+ return [
+ 'Out of stock product are shown #1' => [
+ true,
+ [
+ 'product' => 3,
+ 'qty' => 1,
+ 'super_group' => [
+ 1 => 4,
+ 21 => 5
+ ],
+ ],
+ [
+ [
+ 'sku' => 'virtual-product',
+ 'cart_qty' => 5
+ ],
+ [
+ 'sku' => 'simple',
+ 'cart_qty' => 4
+ ],
+ ]
+ ],
+ 'Out of stock product are shown #2' => [
+ true,
+ [
+ 'product' => 3,
+ 'qty' => 1,
+ 'super_group' => [
+ 1 => 0,
+ ],
+ ],
+ [
+ [
+ 'sku' => 'virtual-product',
+ 'cart_qty' => 2 // This is a default quantity.
+ ],
+ ]
+ ],
+ 'Out of stock product are hidden #1' => [
+ false,
+ [
+ 'product' => 3,
+ 'qty' => 1,
+ 'super_group' => [
+ 1 => 4,
+ 21 => 5
+ ],
+ ],
+ [
+ [
+ 'sku' => 'virtual-product',
+ 'cart_qty' => 5
+ ],
+ [
+ 'sku' => 'simple',
+ 'cart_qty' => 4
+ ],
+ ]
+ ],
+ 'Out of stock product are hidden #2' => [
+ false,
+ [
+ 'product' => 3,
+ 'qty' => 1,
+ 'super_group' => [
+ 1 => 0,
+ ],
+ ],
+ [
+ [
+ 'sku' => 'virtual-product',
+ 'cart_qty' => 2 // This is a default quantity.
+ ],
+ ]
+ ],
+ ];
+ }
+
+ /**
+ * Write config value to database.
+ *
+ * @param string $path
+ * @param string $value
+ * @param string $scope
+ * @param int $scopeId
+ */
+ private function changeConfigValue(string $path, string $value, string $scope = 'default', int $scopeId = 0)
+ {
+ $configValue = $this->objectManager->create(Value::class);
+ $configValue->setPath($path)
+ ->setValue($value)
+ ->setScope($scope)
+ ->setScopeId($scopeId)
+ ->save();
+ $this->reinitConfig();
+ }
+
+ /**
+ * Delete config value from database.
+ *
+ * @param string $path
+ */
+ private function dropConfigValue(string $path)
+ {
+ $configValue = $this->objectManager->create(Value::class);
+ try {
+ $configValue->load($path, 'path');
+ $configValue->delete();
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ // do nothing
+ }
+ $this->reinitConfig();
+ }
+
+ /**
+ * Reinit config.
+ */
+ private function reinitConfig()
+ {
+ $this->reinitableConfig->reinit();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
new file mode 100644
index 0000000000000..b9f9046c4244c
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
@@ -0,0 +1,75 @@
+\get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+
+/** @var $product \Magento\Catalog\Model\Product */
+$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
+$product->isObjectNew(true);
+$product->setTypeId(
+ \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE
+)->setAttributeSetId(
+ 4
+)->setWebsiteIds(
+ [1]
+)->setName(
+ 'Grouped Product'
+)->setSku(
+ 'grouped-product'
+)->setPrice(
+ 100
+)->setTaxClassId(
+ 0
+)->setVisibility(
+ \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
+)->setStatus(
+ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
+);
+
+$newLinks = [];
+$productLinkFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductLinkInterfaceFactory::class);
+
+/** @var \Magento\Catalog\Api\Data\ProductLinkInterface $productLink */
+$productLink = $productLinkFactory->create();
+$linkedProduct = $productRepository->getById(1);
+$productLink->setSku($product->getSku())
+ ->setLinkType('associated')
+ ->setLinkedProductSku($linkedProduct->getSku())
+ ->setLinkedProductType($linkedProduct->getTypeId())
+ ->setPosition(1)
+ ->getExtensionAttributes()
+ ->setQty(1);
+$newLinks[] = $productLink;
+
+$subProductsSkus = ['virtual-product', 'virtual-product-out'];
+foreach ($subProductsSkus as $sku) {
+ /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $productLink */
+ $productLink = $productLinkFactory->create();
+ $linkedProduct = $productRepository->get($sku);
+ $productLink->setSku($product->getSku())
+ ->setLinkType('associated')
+ ->setLinkedProductSku($sku)
+ ->setLinkedProductType($linkedProduct->getTypeId())
+ ->getExtensionAttributes()
+ ->setQty(2);
+ $newLinks[] = $productLink;
+}
+$product->setProductLinks($newLinks);
+$product->save();
+
+/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */
+$categoryLinkManagement = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Catalog\Api\CategoryLinkManagementInterface::class);
+
+$categoryLinkManagement->assignProductToCategories(
+ $product->getSku(),
+ [2]
+);
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock_rollback.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock_rollback.php
new file mode 100644
index 0000000000000..48e7d495f8985
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock_rollback.php
@@ -0,0 +1,10 @@
+\
Date: Fri, 5 Jan 2018 18:40:48 +0200
Subject: [PATCH 0002/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Magento/GroupedProduct/Model/Product/Type/GroupedTest.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 554a20d8a18a7..cd45cb816ffbc 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -180,7 +180,6 @@ public function testOutOfStockSubProduct(bool $outOfStockShown, array $data, arr
);
}
}
-
}
/**
From da05e921b80ac0766b3965d1e693e7da742abb72 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Tue, 9 Jan 2018 14:19:44 +0200
Subject: [PATCH 0003/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Magento/GroupedProduct/Model/Product/Type/GroupedTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index cd45cb816ffbc..e177f77378985 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -145,7 +145,7 @@ public function testPrepareProduct()
}
/**
- * Test adding grouped product to cart then one of subproducts is out of stock.
+ * Test adding grouped product to cart when one of subproducts is out of stock.
*
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
* @magentoAppArea frontend
From 40600b9aea44981db11b8094fd9b78ba5a91c904 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Tue, 9 Jan 2018 14:22:48 +0200
Subject: [PATCH 0004/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Model/Product/Type/GroupedTest.php | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index e177f77378985..12221498eba4d 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -197,7 +197,7 @@ public function outOfStockSubProductDataProvider()
'qty' => 1,
'super_group' => [
1 => 4,
- 21 => 5
+ 21 => 5,
],
],
[
@@ -207,9 +207,9 @@ public function outOfStockSubProductDataProvider()
],
[
'sku' => 'simple',
- 'cart_qty' => 4
+ 'cart_qty' => 4,
],
- ]
+ ],
],
'Out of stock product are shown #2' => [
true,
@@ -223,9 +223,9 @@ public function outOfStockSubProductDataProvider()
[
[
'sku' => 'virtual-product',
- 'cart_qty' => 2 // This is a default quantity.
+ 'cart_qty' => 2, // This is a default quantity.
],
- ]
+ ],
],
'Out of stock product are hidden #1' => [
false,
@@ -234,19 +234,19 @@ public function outOfStockSubProductDataProvider()
'qty' => 1,
'super_group' => [
1 => 4,
- 21 => 5
+ 21 => 5,
],
],
[
[
'sku' => 'virtual-product',
- 'cart_qty' => 5
+ 'cart_qty' => 5,
],
[
'sku' => 'simple',
- 'cart_qty' => 4
+ 'cart_qty' => 4,
],
- ]
+ ],
],
'Out of stock product are hidden #2' => [
false,
@@ -260,9 +260,9 @@ public function outOfStockSubProductDataProvider()
[
[
'sku' => 'virtual-product',
- 'cart_qty' => 2 // This is a default quantity.
+ 'cart_qty' => 2, // This is a default quantity.
],
- ]
+ ],
],
];
}
From 63c7fc9b795d9ad284f546b80f8ae6a0c64b46f6 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Tue, 9 Jan 2018 14:24:38 +0200
Subject: [PATCH 0005/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Magento/GroupedProduct/Model/Product/Type/GroupedTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 12221498eba4d..475e3dcfab33f 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -203,7 +203,7 @@ public function outOfStockSubProductDataProvider()
[
[
'sku' => 'virtual-product',
- 'cart_qty' => 5
+ 'cart_qty' => 5,
],
[
'sku' => 'simple',
From cc1e013ff822aacccf9c8bf9c6c320f5a9f1f606 Mon Sep 17 00:00:00 2001
From: Burlacu Vasilii
Date: Sun, 1 Apr 2018 13:48:22 +0300
Subject: [PATCH 0006/1631] Updated Magento_Rule rules.js file
Added calendar initializaton for Conditional Rules when a rule is created for the 1st time
---
app/code/Magento/Rule/view/adminhtml/web/rules.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/Rule/view/adminhtml/web/rules.js b/app/code/Magento/Rule/view/adminhtml/web/rules.js
index 5c4be367b9cb3..8127ae77c3a13 100644
--- a/app/code/Magento/Rule/view/adminhtml/web/rules.js
+++ b/app/code/Magento/Rule/view/adminhtml/web/rules.js
@@ -220,6 +220,8 @@ define([
var elem = Element.down(elemContainer, 'input.input-text');
+ jQuery(elem).trigger('contentUpdated');
+
if (elem) {
elem.focus();
From 26b6a27ca619468f33165b4481bcc4bce9a56f95 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Mon, 2 Apr 2018 11:41:39 +0300
Subject: [PATCH 0007/1631] magento/magento2#12970: Can't add grouped product,
with out of stock sub product, to cart.
---
.../Magento/GroupedProduct/Model/Product/Type/GroupedTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 475e3dcfab33f..7e1dc4246e3fb 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -150,7 +150,7 @@ public function testPrepareProduct()
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
* @magentoAppArea frontend
* @magentoAppIsolation enabled
- * @magentoDbIsolation disabled
+ * @magentoDbIsolation enabled
* @dataProvider outOfStockSubProductDataProvider
* @param bool $outOfStockShown
* @param array $data
From 03e7de4dedd9336dabb90a267acb49b9a044c3f8 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Mon, 30 Apr 2018 11:57:03 +0200
Subject: [PATCH 0008/1631] FIX for issue #14849 - In Sales Emails no
translation using order.getStatusLabel()
\Magento\Sales\Model\Order\Config::getStatusLabel(), used by template email
was forcing the usage of getLabel() when in adminhtml area. I added a new
method getFrontendStatusLabel() in \Magento\Sales\Model\Order and modified
email template files to use it instead of the original implementation. I did
not modify the original implementation because still in use by backend and
frontend.
---
app/code/Magento/Sales/Model/Order.php | 12 ++++++++++++
app/code/Magento/Sales/Model/Order/Config.php | 6 ++++--
.../Sales/view/frontend/email/creditmemo_update.html | 4 ++--
.../view/frontend/email/creditmemo_update_guest.html | 4 ++--
.../Sales/view/frontend/email/invoice_update.html | 4 ++--
.../view/frontend/email/invoice_update_guest.html | 4 ++--
.../Sales/view/frontend/email/order_update.html | 4 ++--
.../view/frontend/email/order_update_guest.html | 4 ++--
.../Sales/view/frontend/email/shipment_update.html | 4 ++--
.../view/frontend/email/shipment_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/creditmemo_update.html | 4 ++--
.../Magento_Sales/email/creditmemo_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/invoice_update.html | 4 ++--
.../Magento_Sales/email/invoice_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/order_update.html | 4 ++--
.../luma/Magento_Sales/email/order_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/shipment_update.html | 4 ++--
.../Magento_Sales/email/shipment_update_guest.html | 4 ++--
18 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 85443ee7f4f11..25ba1a9594174 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -977,10 +977,22 @@ public function setState($state)
return $this->setData(self::STATE, $state);
}
+ /**
+ * Retrieve frontend label of order status
+ *
+ * @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function getFrontendStatusLabel()
+ {
+ return $this->getConfig()->getStatusLabel($this->getStatus(), \Magento\Framework\App\Area::AREA_FRONTEND);
+ }
+
/**
* Retrieve label of order status
*
* @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function getStatusLabel()
{
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index e00eda647dc8d..2e8ea910eb5b0 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -118,11 +118,13 @@ public function getStateDefaultStatus($state)
* Retrieve status label
*
* @param string $code
+ * @param null $forceArea
* @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
- public function getStatusLabel($code)
+ public function getStatusLabel($code, $forceArea = null)
{
- $area = $this->state->getAreaCode();
+ $area = $forceArea ?: $this->state->getAreaCode();
$code = $this->maskStatusForArea($area, $code);
$status = $this->orderStatusFactory->create()->load($code);
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
index 3a4aab19e9e7c..a6a10fb49e3f5 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
@@ -11,7 +11,7 @@
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
"var order.getCustomerName()":"Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
index bc7c079d7f21b..b7411d80d2ba6 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
@@ -10,7 +10,7 @@
"var creditmemo.increment_id":"Credit Memo Id",
"var billing.getName()":"Guest Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update.html b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
index cafdd65ff5208..4043e59f9d7d6 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
@@ -11,7 +11,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
index fafb533301efb..40cdec7fb4cab 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
@@ -10,7 +10,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update.html b/app/code/Magento/Sales/view/frontend/email/order_update.html
index a709a9ed8a7f1..a8f0068b70e87 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
index 5a39b01810c18..749fa3b60ad59 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -22,7 +22,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update.html b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
index 6d9efc37004bc..9d1c93287549a 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
index 4896a00b7bc5a..0d2dccd3377d2 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
index a7b9b330ab9ce..269e46d752084 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
@@ -11,7 +11,7 @@
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
"var order.getCustomerName()":"Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
index 36279eb26005e..c8bdae7b08fa5 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
@@ -10,7 +10,7 @@
"var creditmemo.increment_id":"Credit Memo Id",
"var billing.getName()":"Guest Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
index a739c9f54b08f..8ec54f1e64d9c 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
@@ -11,7 +11,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
index a56ee6da9fa25..6028db7b97730 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
@@ -10,7 +10,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
index 3e4bf8df2f107..fa16ac2196bf4 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
index 1075608db4341..8ead615fe01ca 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -22,7 +22,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
index 37bf92b866c74..4f9b7286f3ae4 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
index 954819949860b..3ef26463ea755 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
From 5d2b5be882918e36aa328b735c8bd00599b3b5c8 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Mon, 28 May 2018 10:10:20 +0200
Subject: [PATCH 0009/1631] FIX cs & docblock
---
app/code/Magento/Sales/Model/Order.php | 17 +++++++++--------
app/code/Magento/Sales/Model/Order/Config.php | 13 +++++++------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 25ba1a9594174..93909b5815616 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -8,6 +8,7 @@
use Magento\Directory\Model\Currency;
use Magento\Framework\Api\AttributeValueFactory;
use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Sales\Api\Data\OrderInterface;
@@ -981,7 +982,7 @@ public function setState($state)
* Retrieve frontend label of order status
*
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function getFrontendStatusLabel()
{
@@ -992,7 +993,7 @@ public function getFrontendStatusLabel()
* Retrieve label of order status
*
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function getStatusLabel()
{
@@ -1078,12 +1079,12 @@ public function place()
/**
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function hold()
{
if (!$this->canHold()) {
- throw new \Magento\Framework\Exception\LocalizedException(__('A hold action is not available.'));
+ throw new LocalizedException(__('A hold action is not available.'));
}
$this->setHoldBeforeState($this->getState());
$this->setHoldBeforeStatus($this->getStatus());
@@ -1096,12 +1097,12 @@ public function hold()
* Attempt to unhold the order
*
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function unhold()
{
if (!$this->canUnhold()) {
- throw new \Magento\Framework\Exception\LocalizedException(__('You cannot remove the hold.'));
+ throw new LocalizedException(__('You cannot remove the hold.'));
}
$this->setState($this->getHoldBeforeState())
@@ -1145,7 +1146,7 @@ public function isFraudDetected()
* @param string $comment
* @param bool $graceful
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function registerCancellation($comment = '', $graceful = true)
@@ -1184,7 +1185,7 @@ public function registerCancellation($comment = '', $graceful = true)
$this->addStatusHistoryComment($comment, false);
}
} elseif (!$graceful) {
- throw new \Magento\Framework\Exception\LocalizedException(__('We cannot cancel this order.'));
+ throw new LocalizedException(__('We cannot cancel this order.'));
}
return $this;
}
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index 2e8ea910eb5b0..d0875135c3c8f 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\Order;
+use Magento\Framework\Exception\LocalizedException;
/**
* Order configuration model
@@ -85,7 +86,7 @@ protected function _getCollection()
/**
* @param string $state
- * @return Status|null
+ * @return Status
*/
protected function _getState($state)
{
@@ -101,7 +102,7 @@ protected function _getState($state)
* Retrieve default status for state
*
* @param string $state
- * @return string
+ * @return string|null
*/
public function getStateDefaultStatus($state)
{
@@ -117,10 +118,10 @@ public function getStateDefaultStatus($state)
/**
* Retrieve status label
*
- * @param string $code
- * @param null $forceArea
- * @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @param string $code
+ * @param string|null $forceArea
+ * @return string
+ * @throws LocalizedException
*/
public function getStatusLabel($code, $forceArea = null)
{
From 1c9ce8467d3297703e1d899314728df8b387e716 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Tue, 29 May 2018 11:33:35 +0200
Subject: [PATCH 0010/1631] FIX CS
---
app/code/Magento/Sales/Model/Order/Config.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index d0875135c3c8f..c0c374b05226b 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\Order;
+
use Magento\Framework\Exception\LocalizedException;
/**
From 2d95bf9f7fa234dcfa33c8d5821b73c6f89e9137 Mon Sep 17 00:00:00 2001
From: Oleksandr Gorkun
Date: Fri, 8 Jun 2018 14:39:20 +0300
Subject: [PATCH 0011/1631] MAGETWO-92172: [Backport for 2.2.x] Redundant File
Names for Quote Attachments
---
lib/internal/Magento/Framework/File/Uploader.php | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/internal/Magento/Framework/File/Uploader.php b/lib/internal/Magento/Framework/File/Uploader.php
index 07de9941271c3..1c6e933020fb2 100644
--- a/lib/internal/Magento/Framework/File/Uploader.php
+++ b/lib/internal/Magento/Framework/File/Uploader.php
@@ -197,20 +197,22 @@ public function save($destinationFolder, $newFileName = null)
$this->_result = false;
$destinationFile = $destinationFolder;
$fileName = isset($newFileName) ? $newFileName : $this->_file['name'];
- $fileName = self::getCorrectFileName($fileName);
+ $fileName = static::getCorrectFileName($fileName);
if ($this->_enableFilesDispersion) {
$fileName = $this->correctFileNameCase($fileName);
$this->setAllowCreateFolders(true);
- $this->_dispretionPath = self::getDispersionPath($fileName);
+ $this->_dispretionPath = static::getDispersionPath($fileName);
$destinationFile .= $this->_dispretionPath;
$this->_createDestinationFolder($destinationFile);
}
if ($this->_allowRenameFiles) {
- $fileName = self::getNewFileName(self::_addDirSeparator($destinationFile) . $fileName);
+ $fileName = static::getNewFileName(
+ static::_addDirSeparator($destinationFile) . $fileName
+ );
}
- $destinationFile = self::_addDirSeparator($destinationFile) . $fileName;
+ $destinationFile = static::_addDirSeparator($destinationFile) . $fileName;
try {
$this->_result = $this->_moveFile($this->_file['tmp_name'], $destinationFile);
From 8287053417093ad684343e8558d5e5c8e7e5c368 Mon Sep 17 00:00:00 2001
From: Oleksandr Gorkun
Date: Fri, 8 Jun 2018 16:29:32 +0300
Subject: [PATCH 0012/1631] MAGETWO-92172: [Backport for 2.2.x] Redundant File
Names for Quote Attachments
---
nginx.conf.sample | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nginx.conf.sample b/nginx.conf.sample
index 1e20a51a511d3..a252d2aea0ffb 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -162,7 +162,7 @@ location /media/import/ {
}
# PHP entry point for main application
-location ~ (index|get|static|report|404|503|health_check)\.php$ {
+location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_buffers 1024 4k;
From 90b6803aab559cd0c345ab42d19bb712e4df8011 Mon Sep 17 00:00:00 2001
From: MaxNovik
Date: Fri, 22 Jun 2018 17:48:44 +0300
Subject: [PATCH 0013/1631]
#14020-Cart-Sales-Rule-with-negated-condition-over-special-price-does-not-work-for-configurable-products.
Use configurable product`s children for shopping cart rules validation for
cases when attribute exists for children only (E.g. special_price)
---
.../Model/Rule/Condition/Product.php | 42 ++++++++++++++++---
1 file changed, 36 insertions(+), 6 deletions(-)
diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
index 499e35db9dfd6..35ace4b6b089e 100644
--- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
@@ -5,10 +5,14 @@
*/
namespace Magento\SalesRule\Model\Rule\Condition;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
+
/**
* Product rule condition data model
*
* @author Magento Core Team
+ *
+ * @method string getAttribute()
*/
class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
{
@@ -26,20 +30,47 @@ protected function _addSpecialAttributes(array &$attributes)
$attributes['quote_item_row_total'] = __('Row total in cart');
}
+ /**
+ * @param \Magento\Framework\Model\AbstractModel $model
+ *
+ * @return \Magento\Catalog\Api\Data\ProductInterface|\Magento\Catalog\Model\Product
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ */
+ protected function getProductToValidate(\Magento\Framework\Model\AbstractModel $model)
+ {
+ /** @var \Magento\Catalog\Model\Product $product */
+ $product = $model->getProduct();
+ if (!$product instanceof \Magento\Catalog\Model\Product) {
+ $product = $this->productRepository->getById($model->getProductId());
+ }
+
+ $attrCode = $this->getAttribute();
+
+ /* Check for attributes which are not available for configurable products */
+ if ($product->getTypeId() == Configurable::TYPE_CODE && !$product->hasData($attrCode)) {
+ /** @var \Magento\Catalog\Api\Data\ProductInterface $childProduct */
+ $childProduct = current($model->getChildren())->getProduct();
+ if ($childProduct->hasData($attrCode)) {
+ $product = $childProduct;
+ }
+ }
+
+ return $product;
+ }
+
/**
* Validate Product Rule Condition
*
* @param \Magento\Framework\Model\AbstractModel $model
+ *
* @return bool
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function validate(\Magento\Framework\Model\AbstractModel $model)
{
//@todo reimplement this method when is fixed MAGETWO-5713
/** @var \Magento\Catalog\Model\Product $product */
- $product = $model->getProduct();
- if (!$product instanceof \Magento\Catalog\Model\Product) {
- $product = $this->productRepository->getById($model->getProductId());
- }
+ $product = $this->getProductToValidate($model);
$product->setQuoteItemQty(
$model->getQty()
@@ -49,9 +80,8 @@ public function validate(\Magento\Framework\Model\AbstractModel $model)
$model->getBaseRowTotal()
);
- $attrCode = $this->getAttribute();
- if ('category_ids' == $attrCode) {
+ if ('category_ids' == $this->getAttribute()) {
return $this->validateAttribute($this->_getAvailableInCategories($product->getId()));
}
From 2717cb1729b6f1b61040f3eb1582eb1d60622893 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Mon, 25 Jun 2018 22:19:16 +0200
Subject: [PATCH 0014/1631] Removed empty line due to failing static test
---
app/code/Magento/SalesRule/Model/Rule/Condition/Product.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
index 35ace4b6b089e..8a9e6f7f2b66c 100644
--- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
@@ -80,7 +80,6 @@ public function validate(\Magento\Framework\Model\AbstractModel $model)
$model->getBaseRowTotal()
);
-
if ('category_ids' == $this->getAttribute()) {
return $this->validateAttribute($this->_getAvailableInCategories($product->getId()));
}
From d2a0de83c0f73dd850925b4a70ab2e5cf233d74b Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Tue, 26 Jun 2018 16:25:41 +0200
Subject: [PATCH 0015/1631] Removed dependency to configurable product
---
app/code/Magento/SalesRule/Model/Rule/Condition/Product.php | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
index 8a9e6f7f2b66c..e17cc9b16535e 100644
--- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
@@ -5,8 +5,6 @@
*/
namespace Magento\SalesRule\Model\Rule\Condition;
-use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
-
/**
* Product rule condition data model
*
@@ -47,7 +45,7 @@ protected function getProductToValidate(\Magento\Framework\Model\AbstractModel $
$attrCode = $this->getAttribute();
/* Check for attributes which are not available for configurable products */
- if ($product->getTypeId() == Configurable::TYPE_CODE && !$product->hasData($attrCode)) {
+ if ($product->isComposite() && !$product->hasData($attrCode)) {
/** @var \Magento\Catalog\Api\Data\ProductInterface $childProduct */
$childProduct = current($model->getChildren())->getProduct();
if ($childProduct->hasData($attrCode)) {
From fae98c01e29ea9ca47eca00cf2081ede1f729ccb Mon Sep 17 00:00:00 2001
From: MaxNovik
Date: Wed, 4 Jul 2018 22:55:35 +0300
Subject: [PATCH 0016/1631]
#14020-Cart-Sales-Rule-with-negated-condition-over-special-price-does-not-work-for-configurable-products.
Revert "Removed dependency to configurable product"
This reverts commit d2a0de83c0f73dd850925b4a70ab2e5cf233d74b.
---
app/code/Magento/SalesRule/Model/Rule/Condition/Product.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
index e17cc9b16535e..8a9e6f7f2b66c 100644
--- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
@@ -5,6 +5,8 @@
*/
namespace Magento\SalesRule\Model\Rule\Condition;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
+
/**
* Product rule condition data model
*
@@ -45,7 +47,7 @@ protected function getProductToValidate(\Magento\Framework\Model\AbstractModel $
$attrCode = $this->getAttribute();
/* Check for attributes which are not available for configurable products */
- if ($product->isComposite() && !$product->hasData($attrCode)) {
+ if ($product->getTypeId() == Configurable::TYPE_CODE && !$product->hasData($attrCode)) {
/** @var \Magento\Catalog\Api\Data\ProductInterface $childProduct */
$childProduct = current($model->getChildren())->getProduct();
if ($childProduct->hasData($attrCode)) {
From 9a35b459f1b31b2b8d40c6597bd90ac9c5c865fe Mon Sep 17 00:00:00 2001
From: MaxNovik
Date: Wed, 4 Jul 2018 22:57:37 +0300
Subject: [PATCH 0017/1631]
#14020-Cart-Sales-Rule-with-negated-condition-over-special-price-does-not-work-for-configurable-products.
Made getProductToValidate method private according to Technical Guideline
(2.7)
---
app/code/Magento/SalesRule/Model/Rule/Condition/Product.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
index 8a9e6f7f2b66c..07a2ea1a87b6e 100644
--- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php
@@ -36,7 +36,7 @@ protected function _addSpecialAttributes(array &$attributes)
* @return \Magento\Catalog\Api\Data\ProductInterface|\Magento\Catalog\Model\Product
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
- protected function getProductToValidate(\Magento\Framework\Model\AbstractModel $model)
+ private function getProductToValidate(\Magento\Framework\Model\AbstractModel $model)
{
/** @var \Magento\Catalog\Model\Product $product */
$product = $model->getProduct();
From 887ee4aa918340a5933c9923c334cef6b97d44eb Mon Sep 17 00:00:00 2001
From: MaxNovik
Date: Sat, 7 Jul 2018 22:10:05 +0300
Subject: [PATCH 0018/1631]
#14020-Cart-Sales-Rule-with-negated-condition-over-special-price-does-not-work-for-configurable-products.
Added configurable product to dependencies
---
app/code/Magento/SalesRule/composer.json | 3 ++-
app/code/Magento/SalesRule/etc/module.xml | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index f030482bcf240..e282e035ad23f 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -19,7 +19,8 @@
"magento/module-widget": "101.0.*",
"magento/module-quote": "101.0.*",
"magento/module-ui": "101.0.*",
- "magento/framework": "101.0.*"
+ "magento/framework": "101.0.*",
+ "magento/module-configurable-product": "100.*"
},
"suggest": {
"magento/module-sales-rule-sample-data": "Sample Data version:100.2.*"
diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml
index f3f160eb7d40b..1df09b97b9353 100644
--- a/app/code/Magento/SalesRule/etc/module.xml
+++ b/app/code/Magento/SalesRule/etc/module.xml
@@ -12,6 +12,7 @@
+
From 607773051b9a7c409d69be3578909de114295749 Mon Sep 17 00:00:00 2001
From: Roman Leshchenko
Date: Wed, 11 Jul 2018 14:34:50 +0300
Subject: [PATCH 0019/1631] MAGETWO-90468: Added posibility to use captcha on
share wishlist page
---
.../Wishlist/Controller/Index/Send.php | 41 ++++++++++++++++++-
app/code/Magento/Wishlist/etc/config.xml | 22 ++++++++++
.../frontend/layout/wishlist_index_share.xml | 17 +++++++-
.../view/frontend/templates/sharing.phtml | 1 +
4 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php
index c2389af6a2282..780f4d94f04d9 100644
--- a/app/code/Magento/Wishlist/Controller/Index/Send.php
+++ b/app/code/Magento/Wishlist/Controller/Index/Send.php
@@ -8,11 +8,15 @@
use Magento\Framework\App\Action;
use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\Session\Generic as WishlistSession;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\View\Result\Layout as ResultLayout;
+use Magento\Captcha\Helper\Data as CaptchaHelper;
+use Magento\Captcha\Observer\CaptchaStringResolver;
+use Magento\Framework\App\ObjectManager;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -69,6 +73,16 @@ class Send extends \Magento\Wishlist\Controller\AbstractIndex
*/
protected $storeManager;
+ /**
+ * @var CaptchaHelper|null
+ */
+ protected $captchaHelper;
+
+ /**
+ * @var CaptchaStringResolver|null
+ */
+ protected $captchaStringResolver;
+
/**
* @param Action\Context $context
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
@@ -81,6 +95,8 @@ class Send extends \Magento\Wishlist\Controller\AbstractIndex
* @param WishlistSession $wishlistSession
* @param ScopeConfigInterface $scopeConfig
* @param StoreManagerInterface $storeManager
+ * @param CaptchaHelper $captchaHelper|null
+ * @param CaptchaStringResolver $captchaStringResolver|null
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -94,7 +110,9 @@ public function __construct(
\Magento\Customer\Helper\View $customerHelperView,
WishlistSession $wishlistSession,
ScopeConfigInterface $scopeConfig,
- StoreManagerInterface $storeManager
+ StoreManagerInterface $storeManager,
+ CaptchaHelper $captchaHelper = null,
+ CaptchaStringResolver $captchaStringResolver = null
) {
$this->_formKeyValidator = $formKeyValidator;
$this->_customerSession = $customerSession;
@@ -106,6 +124,9 @@ public function __construct(
$this->wishlistSession = $wishlistSession;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
+ $this->captchaHelper = $captchaHelper ?: ObjectManager::getInstance()->get(CaptchaHelper::class);
+ $this->captchaStringResolver = $captchaStringResolver ?
+ : ObjectManager::getInstance()->get(CaptchaStringResolver::class);
parent::__construct($context);
}
@@ -117,16 +138,34 @@ public function __construct(
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @throws \Zend_Validate_Exception
*/
public function execute()
{
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
+ $captchaFormName = 'share_wishlist_form';
+ /** @var \Magento\Captcha\Model\DefaultModel $captchaModel */
+ $captchaModel = $this->captchaHelper->getCaptcha($captchaFormName);
+
if (!$this->_formKeyValidator->validate($this->getRequest())) {
$resultRedirect->setPath('*/*/');
return $resultRedirect;
}
+ if ($captchaModel->isRequired()) {
+ $word = $this->captchaStringResolver->resolve(
+ $this->getRequest(),
+ $captchaFormName
+ );
+
+ if (!$captchaModel->isCorrect($word)) {
+ $this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
+ $resultRedirect->setPath('*/*/share');
+ return $resultRedirect;
+ }
+ }
+
$wishlist = $this->wishlistProvider->getWishlist();
if (!$wishlist) {
throw new NotFoundException(__('Page not found.'));
diff --git a/app/code/Magento/Wishlist/etc/config.xml b/app/code/Magento/Wishlist/etc/config.xml
index 1fec2d1baf9d4..d0e7354df41ac 100644
--- a/app/code/Magento/Wishlist/etc/config.xml
+++ b/app/code/Magento/Wishlist/etc/config.xml
@@ -17,6 +17,28 @@
10255
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml
index 09d8675f6b37e..08e1da699e2cb 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml
@@ -9,7 +9,22 @@
-
+
+
+
+ share_wishlist_form
+
+ 230
+
+
+ 50
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Wishlist/view/frontend/templates/sharing.phtml b/app/code/Magento/Wishlist/view/frontend/templates/sharing.phtml
index 430ebd384c82b..ff01cb4532cc7 100644
--- a/app/code/Magento/Wishlist/view/frontend/templates/sharing.phtml
+++ b/app/code/Magento/Wishlist/view/frontend/templates/sharing.phtml
@@ -40,6 +40,7 @@
+ = $block->getChildHtml('captcha'); ?>
-
\ No newline at end of file
+
From 66f06398a11841df014464f77cca94fe01678e4e Mon Sep 17 00:00:00 2001
From: Roman Leshchenko
Date: Thu, 26 Jul 2018 14:11:30 +0300
Subject: [PATCH 0047/1631] MAGETWO-90516: Wrong custom option behavior
---
.../Product/View/Options/View/Checkable.php | 2 +-
.../fieldset/options/view/checkable.phtml | 98 +++++++++----------
2 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/View/Checkable.php b/app/code/Magento/Catalog/Block/Product/View/Options/View/Checkable.php
index 45d7531a83623..6adaf56296439 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Options/View/Checkable.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Options/View/Checkable.php
@@ -57,4 +57,4 @@ public function getCurrencyByStore(ProductCustomOptionValuesInterface $value) :
false
);
}
-}
\ No newline at end of file
+}
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/view/checkable.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/view/checkable.phtml
index 827843c8a58bc..99f7018846d0a 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/view/checkable.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/view/checkable.phtml
@@ -4,39 +4,38 @@
*/
$option = $this->getOption();
-if ($option): ?>
- getProduct()->getPreconfiguredValues()->getData('options/' . $option->getId());
- $optionType = $option->getType();
- $arraySign = $optionType === 'checkbox' ? '[]' : '';
- $count = 1;
- ?>
-
-
getValues() as $value) : ?>
From 3b3edd930f4bf5a05c500dcb4722d1389f309f45 Mon Sep 17 00:00:00 2001
From: Roman Leshchenko
Date: Wed, 29 Aug 2018 22:55:18 +0300
Subject: [PATCH 0075/1631] MAGETWO-90516: Wrong custom option behavior
---
.../Catalog/Block/Product/View/Options/Select/Multiple.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Select/Multiple.php b/app/code/Magento/Catalog/Block/Product/View/Options/Select/Multiple.php
index 6395a493f7b44..56702919da5d5 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Options/Select/Multiple.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Options/Select/Multiple.php
@@ -12,7 +12,7 @@
use Magento\Framework\View\Element\Html\Select;
/**
- * CLass represents necessary logic for dropdown and multiselect option types
+ * Class represents necessary logic for dropdown and multiselect option types
*/
class Multiple extends AbstractOptions
{
From c5cbfc0da9786b67a6908f9df377a2a020f54272 Mon Sep 17 00:00:00 2001
From: Roman Leshchenko
Date: Fri, 31 Aug 2018 16:45:53 +0300
Subject: [PATCH 0076/1631] MAGETWO-92728: Fixed wrong admin notifications
behavior
---
.../Block/Grid/Renderer/Actions.php | 35 +++++++++++--------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
index 6f0e42bdcbef1..3c4549ba8017c 100644
--- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
+++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
@@ -37,28 +37,35 @@ public function __construct(
*/
public function render(\Magento\Framework\DataObject $row)
{
- $readDetailsHtml = $row->getUrl() ? '' .
+ $readDetailsHtml = $row->getUrl() ? '' .
__('Read Details') . '' : '';
- $markAsReadHtml = !$row->getIsRead() ? '' . __(
- 'Mark as Read'
- ) . '' : '';
+ $markAsReadHtml = !$row->getIsRead() ? '' . __(
+ 'Mark as Read'
+ ) . '' : '';
$encodedUrl = $this->_urlHelper->getEncodedUrl();
return sprintf(
'%s%s%s',
$readDetailsHtml,
$markAsReadHtml,
- $this->getUrl(
- '*/*/remove/',
- [
- '_current' => true,
- 'id' => $row->getId(),
- \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
- ]
+ $this->escapeHtml(
+ $this->getUrl(
+ '*/*/remove/',
+ [
+ '_current' => true,
+ 'id' => $row->getId(),
+ \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
+ ]
+ )
),
__('Are you sure?'),
__('Remove')
From f74460631c7feabb72c7ca3dec76a7bb92a17a41 Mon Sep 17 00:00:00 2001
From: Yaroslav Rogoza
Date: Sun, 2 Sep 2018 16:11:02 +0200
Subject: [PATCH 0077/1631] Fixed child items showing on My Account order view
---
app/code/Magento/Sales/Block/Order/Items.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/code/Magento/Sales/Block/Order/Items.php b/app/code/Magento/Sales/Block/Order/Items.php
index 028544cd56219..0b67e9a0746d3 100644
--- a/app/code/Magento/Sales/Block/Order/Items.php
+++ b/app/code/Magento/Sales/Block/Order/Items.php
@@ -71,7 +71,6 @@ protected function _prepareLayout()
$this->itemCollection = $this->itemCollectionFactory->create();
$this->itemCollection->setOrderFilter($this->getOrder());
- $this->itemCollection->filterByParent(null);
/** @var \Magento\Theme\Block\Html\Pager $pagerBlock */
$pagerBlock = $this->getChildBlock('sales_order_item_pager');
From 29680f7653167268f474af8929b87aa2d863b9b5 Mon Sep 17 00:00:00 2001
From: Magently
Date: Tue, 4 Sep 2018 13:53:08 +0200
Subject: [PATCH 0078/1631] Fix integration test
Changed test method to fit the new implementation of the class method
---
.../ResourceModel/Db/Collection/AbstractCollectionTest.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
index 4f27f083509d7..7989a265e0db1 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
@@ -267,10 +267,11 @@ public function addFieldToSelectDataProvider()
/**
* @dataProvider addExpressionFieldToSelectDataProvider
*/
- public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expected)
+ public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expectedFieldsToSelect)
{
- $this->selectMock->expects($this->once())->method('columns')->with($expected);
$this->assertTrue($this->uut->addExpressionFieldToSelect($alias, $expression, $fields) instanceof Uut);
+ $this->assertEquals($expectedFieldsToSelect, $this->uut->getFieldsToSelect());
+ $this->assertTrue($this->uut->wereFieldsToSelectChanged());
}
/**
From 5a702eff42e1907d8887281ed32857534d4066bd Mon Sep 17 00:00:00 2001
From: Magently
Date: Tue, 4 Sep 2018 15:24:11 +0200
Subject: [PATCH 0079/1631] Fix variable name in test class too long
---
.../ResourceModel/Db/Collection/AbstractCollectionTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
index 7989a265e0db1..0eae94dabbbe8 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
@@ -267,10 +267,10 @@ public function addFieldToSelectDataProvider()
/**
* @dataProvider addExpressionFieldToSelectDataProvider
*/
- public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expectedFieldsToSelect)
+ public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expected)
{
$this->assertTrue($this->uut->addExpressionFieldToSelect($alias, $expression, $fields) instanceof Uut);
- $this->assertEquals($expectedFieldsToSelect, $this->uut->getFieldsToSelect());
+ $this->assertEquals($expected, $this->uut->getFieldsToSelect());
$this->assertTrue($this->uut->wereFieldsToSelectChanged());
}
From c155cf4bfddb75c0f302c73fb38ae4ea77851e07 Mon Sep 17 00:00:00 2001
From: roman
Date: Thu, 6 Sep 2018 12:34:38 +0300
Subject: [PATCH 0080/1631] MAGETWO-92728: Fixed wrong admin notifications
behavior
---
.../AdminNotification/Block/Grid/Renderer/Actions.php | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
index 3c4549ba8017c..bc25f56faaf53 100644
--- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
+++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
@@ -38,16 +38,14 @@ public function __construct(
public function render(\Magento\Framework\DataObject $row)
{
$readDetailsHtml = $row->getUrl() ? '' .
__('Read Details') . '' : '';
$markAsReadHtml = !$row->getIsRead() ? '' . __(
'Mark as Read'
) . '' : '';
@@ -57,7 +55,6 @@ public function render(\Magento\Framework\DataObject $row)
'%s%s%s',
$readDetailsHtml,
$markAsReadHtml,
- $this->escapeHtml(
$this->getUrl(
'*/*/remove/',
[
@@ -65,8 +62,7 @@ public function render(\Magento\Framework\DataObject $row)
'id' => $row->getId(),
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
]
- )
- ),
+ ),
__('Are you sure?'),
__('Remove')
);
From f854982410be60c809549d1aa052a3fce14dc041 Mon Sep 17 00:00:00 2001
From: roman
Date: Thu, 6 Sep 2018 12:36:40 +0300
Subject: [PATCH 0081/1631] MAGETWO-92728: Fixed wrong admin notifications
behavior
---
.../Block/Grid/Renderer/Actions.php | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
index bc25f56faaf53..e3ebd8c16fe3a 100644
--- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
+++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
@@ -44,8 +44,8 @@ public function render(\Magento\Framework\DataObject $row)
$markAsReadHtml = !$row->getIsRead() ? '' . __(
'Mark as Read'
) . '' : '';
@@ -55,14 +55,14 @@ public function render(\Magento\Framework\DataObject $row)
'%s%s%s',
$readDetailsHtml,
$markAsReadHtml,
- $this->getUrl(
- '*/*/remove/',
- [
- '_current' => true,
- 'id' => $row->getId(),
- \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
- ]
- ),
+ $this->getUrl(
+ '*/*/remove/',
+ [
+ '_current' => true,
+ 'id' => $row->getId(),
+ \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
+ ]
+ ),
__('Are you sure?'),
__('Remove')
);
From 4daa54d98229cd4bca4835b044c5c2ca1f50c98d Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Thu, 6 Sep 2018 14:48:16 +0300
Subject: [PATCH 0082/1631] MAGETWO-71157: Servers Configurations Needs Update
---
.htaccess | 9 +++++++++
.htaccess.sample | 9 +++++++++
nginx.conf.sample | 5 +++++
pub/.htaccess | 10 ++++++++++
4 files changed, 33 insertions(+)
diff --git a/.htaccess b/.htaccess
index 4298b10d9ca7a..ad123614ae08e 100644
--- a/.htaccess
+++ b/.htaccess
@@ -364,6 +364,15 @@
Require all denied
+
+
+ order allow,deny
+ deny from all
+
+ = 2.4>
+ Require all denied
+
+
# For 404s and 403s that aren't handled by the application, show plain 404 response
ErrorDocument 404 /pub/errors/404.php
diff --git a/.htaccess.sample b/.htaccess.sample
index a521a347232f5..b405fd3a22b75 100644
--- a/.htaccess.sample
+++ b/.htaccess.sample
@@ -341,6 +341,15 @@
Require all denied
+
+
+ order allow,deny
+ deny from all
+
+ = 2.4>
+ Require all denied
+
+
# For 404s and 403s that aren't handled by the application, show plain 404 response
ErrorDocument 404 /pub/errors/404.php
diff --git a/nginx.conf.sample b/nginx.conf.sample
index 6f87a9a076666..856066e0ba72a 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -33,6 +33,11 @@ charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";
+# Deny access to sensitive files
+location /.user.ini {
+ deny all;
+}
+
# PHP entry point for setup application
location ~* ^/setup($|/) {
root $MAGE_ROOT;
diff --git a/pub/.htaccess b/pub/.htaccess
index 8ba04ff4415f3..9f07f3319837e 100644
--- a/pub/.htaccess
+++ b/pub/.htaccess
@@ -220,6 +220,16 @@ ErrorDocument 403 /errors/404.php
Require all denied
+## Deny access to .user.ini##
+
+
+ order allow,deny
+ deny from all
+
+ = 2.4>
+ Require all denied
+
+
############################################
From ad1bdacd5f760771ebecab40bbfa237dbd6cea99 Mon Sep 17 00:00:00 2001
From: Viktor Sevch
Date: Tue, 11 Sep 2018 09:17:05 +0300
Subject: [PATCH 0083/1631] MAGETWO-94468: Wrong session messages behavior
---
.../Model/System/Config/Backend/Ttl.php | 46 +++++++-
.../Model/System/Config/Backend/TtlTest.php | 106 ++++++++++++++++++
2 files changed, 148 insertions(+), 4 deletions(-)
create mode 100644 app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php
index dab8d7be16dd7..95b0ebe72ecd1 100644
--- a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php
+++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php
@@ -6,15 +6,49 @@
namespace Magento\PageCache\Model\System\Config\Backend;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Escaper;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\Exception\LocalizedException;
+
/**
- * Backend model for processing Public content cache lifetime settings
+ * Backend model for processing Public content cache lifetime settings.
*
* Class Ttl
*/
class Ttl extends \Magento\Framework\App\Config\Value
{
/**
- * Throw exception if Ttl data is invalid or empty
+ * @var Escaper
+ */
+ private $escaper;
+
+ /**
+ * @param \Magento\Framework\Model\Context $context
+ * @param \Magento\Framework\Registry $registry
+ * @param ScopeConfigInterface $config
+ * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
+ * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
+ * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
+ * @param array $data
+ * @param Escaper|null $escaper
+ */
+ public function __construct(
+ \Magento\Framework\Model\Context $context,
+ \Magento\Framework\Registry $registry,
+ ScopeConfigInterface $config,
+ \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
+ \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
+ \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
+ array $data = [],
+ Escaper $escaper = null
+ ) {
+ parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
+ $this->escaper = $escaper ?: ObjectManager::getInstance()->create(Escaper::class);
+ }
+
+ /**
+ * Throw exception if Ttl data is invalid or empty.
*
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
@@ -23,10 +57,14 @@ public function beforeSave()
{
$value = $this->getValue();
if ($value < 0 || !preg_match('/^[0-9]+$/', $value)) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('Ttl value "%1" is not valid. Please use only numbers equal or greater than zero.', $value)
+ throw new LocalizedException(
+ __(
+ 'Ttl value "%1" is not valid. Please use only numbers equal or greater than zero.',
+ $this->escaper->escapeHtml($value)
+ )
);
}
+
return $this;
}
}
diff --git a/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php b/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
new file mode 100644
index 0000000000000..f940564ecf34e
--- /dev/null
+++ b/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
@@ -0,0 +1,106 @@
+getMockForAbstractClass(ScopeConfigInterface::class);
+ $configMock->expects($this->any())
+ ->method('getValue')
+ ->with('system/full_page_cache/default')
+ ->willReturn(['ttl' => 86400]);
+
+ $this->escaperMock = $this->getMockBuilder(Escaper::class)->disableOriginalConstructor()->getMock();
+
+ $this->ttl = $objectManager->getObject(
+ Ttl::class,
+ [
+ 'config' => $configMock,
+ 'data' => ['field' => 'ttl'],
+ 'escaper' => $this->escaperMock,
+ ]
+ );
+ }
+
+ /**
+ * @return array
+ */
+ public function getValidValues(): array
+ {
+ return [
+ ['3600', '3600'],
+ ['10000', '10000'],
+ ['100000', '100000'],
+ ['1000000', '1000000'],
+ ];
+ }
+
+ /**
+ * @param string $value
+ * @param string $expectedValue
+ * @return void
+ * @dataProvider getValidValues
+ */
+ public function testBeforeSave(string $value, string $expectedValue)
+ {
+ $this->ttl->setValue($value);
+ $this->ttl->beforeSave();
+ $this->assertEquals($expectedValue, $this->ttl->getValue());
+ }
+
+ /**
+ * @return array
+ */
+ public function getInvalidValues(): array
+ {
+ return [
+ [''],
+ ['apple'],
+ ['123 street'],
+ ['-123'],
+ ];
+ }
+
+ /**
+ * @param string $value
+ * @return void
+ * @expectedException \Magento\Framework\Exception\LocalizedException
+ * @expectedExceptionMessageRegExp /Ttl value ".+" is not valid. Please .+ only numbers equal or greater than zero./
+ * @dataProvider getInvalidValues
+ */
+ public function testBeforeSaveInvalid(string $value)
+ {
+ $this->ttl->setValue($value);
+ $this->escaperMock->expects($this->any())->method('escapeHtml')->with($value)->willReturn($value);
+ $this->ttl->beforeSave();
+ }
+}
From 85660e6ad8dfad744d97c591c8bd543c9289422e Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Fri, 14 Sep 2018 08:51:24 +0300
Subject: [PATCH 0084/1631] magento/magento2#16887 Fix blocked a frame with
origin
Add logging of exception
---
app/code/Magento/PageCache/view/frontend/web/js/page-cache.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index 08e23d0f4d3f5..e455102d3bf7e 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -6,6 +6,7 @@
define([
'jquery',
'domReady',
+ 'consoleLogger',
'jquery/ui',
'mage/cookies'
], function ($, domReady) {
@@ -61,6 +62,7 @@ define([
elem.contentDocument || (elem.contentWindow ? elem.contentWindow.document : []) :
$.merge([], elem.childNodes);
} catch (e) {
+ consoleLogger.error(e);
return [];
}
});
From 3bf066a5a5d5ba17d8b0c38bbc981af974d2b244 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Fri, 14 Sep 2018 08:53:55 +0300
Subject: [PATCH 0085/1631] magento/magento2#16887 Fix blocked a frame with
origin
Add logging of exception
---
app/code/Magento/PageCache/view/frontend/web/js/page-cache.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index e455102d3bf7e..2a43ff29a3593 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -9,7 +9,7 @@ define([
'consoleLogger',
'jquery/ui',
'mage/cookies'
-], function ($, domReady) {
+], function ($, domReady, consoleLogger) {
'use strict';
/**
From 226aebf1caf9239c0c9f08dcaa65bd150a862eb4 Mon Sep 17 00:00:00 2001
From: Viktor Sevch
Date: Mon, 17 Sep 2018 12:07:50 +0300
Subject: [PATCH 0086/1631] MAGETWO-94468: Wrong session messages behavior
---
.../Test/Unit/Model/System/Config/Backend/TtlTest.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php b/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
index f940564ecf34e..6fd3307de726c 100644
--- a/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
+++ b/app/code/Magento/PageCache/Test/Unit/Model/System/Config/Backend/TtlTest.php
@@ -15,6 +15,9 @@
use Magento\Framework\Exception\LocalizedException;
use PHPUnit\Framework\TestCase;
+/**
+ * Class for tesing backend model for processing Public content cache lifetime settings.
+ */
class TtlTest extends TestCase
{
/**
From 6066468579f99abf6e1785a5df1b8e6d5ebb3a84 Mon Sep 17 00:00:00 2001
From: Oleksandr Miroshnichenko
Date: Mon, 17 Sep 2018 13:39:05 -0500
Subject: [PATCH 0087/1631] MAGETWO-92187: [Backport for 2.2.x] Setup
Application uses version of AngularJS with known vulnerabilities
---
.../angular-ng-storage.min.js | 2 +-
.../pub/angular-sanitize/angular-sanitize.js | 927 +-
.../angular-sanitize/angular-sanitize.min.js | 25 +-
.../angular-sanitize.min.js.map | 12 +-
.../angular-ui-bootstrap.min.js | 2 +-
.../angular-ui-router.min.js | 4 +-
setup/pub/angular/angular.js | 39722 ++++++++++------
setup/pub/angular/angular.min.js | 543 +-
setup/pub/magento/setup/add-database.js | 10 +-
setup/pub/magento/setup/app.js | 3 +-
setup/pub/magento/setup/complete-backup.js | 8 +-
.../pub/magento/setup/create-admin-account.js | 10 +-
.../pub/magento/setup/customize-your-store.js | 35 +-
setup/pub/magento/setup/data-option.js | 6 +-
setup/pub/magento/setup/extension-grid.js | 10 +-
.../magento/setup/install-extension-grid.js | 6 +-
setup/pub/magento/setup/install.js | 8 +-
setup/pub/magento/setup/main.js | 61 +-
.../magento/setup/marketplace-credentials.js | 11 +-
setup/pub/magento/setup/module-grid.js | 6 +-
setup/pub/magento/setup/readiness-check.js | 12 +-
setup/pub/magento/setup/select-version.js | 18 +-
setup/pub/magento/setup/start-updater.js | 11 +-
setup/pub/magento/setup/system-config.js | 3 +
.../magento/setup/update-extension-grid.js | 8 +-
setup/pub/magento/setup/web-configuration.js | 11 +-
.../magento/setup/customize-your-store.phtml | 2 +-
27 files changed, 27358 insertions(+), 14118 deletions(-)
diff --git a/setup/pub/angular-ng-storage/angular-ng-storage.min.js b/setup/pub/angular-ng-storage/angular-ng-storage.min.js
index f5526bbace8ef..54891ebb4087f 100644
--- a/setup/pub/angular-ng-storage/angular-ng-storage.min.js
+++ b/setup/pub/angular-ng-storage/angular-ng-storage.min.js
@@ -1 +1 @@
-/*! ngStorage 0.3.0 | Copyright (c) 2013 Gias Kay Lee | MIT License */"use strict";!function(){function a(a){return["$rootScope","$window",function(b,c){for(var d,e,f,g=c[a]||(console.warn("This browser does not support Web Storage!"),{}),h={$default:function(a){for(var b in a)angular.isDefined(h[b])||(h[b]=a[b]);return h},$reset:function(a){for(var b in h)"$"===b[0]||delete h[b];return h.$default(a)}},i=0;ib;b++)(a=p.key(b))&&e===a.slice(0,n)&&(q[a.slice(n)]=g(p.getItem(a)))},$apply:function(){var b;if(m=null,!a.equals(q,l)){b=a.copy(l),a.forEach(q,function(c,d){a.isDefined(c)&&"$"!==d[0]&&(p.setItem(e+d,f(c)),delete b[d])});for(var c in b)p.removeItem(e+c);l=a.copy(q)}},$supported:function(){return!!o}};return q.$sync(),l=a.copy(q),d.$watch(function(){m||(m=j(q.$apply,100,!1))}),h.addEventListener&&h.addEventListener("storage",function(b){if(b.key){var c=k[0];c.hasFocus&&c.hasFocus()||e!==b.key.slice(0,n)||(b.newValue?q[b.key.slice(n)]=g(b.newValue):delete q[b.key.slice(n)],l=a.copy(q),d.$apply())}}),h.addEventListener&&h.addEventListener("beforeunload",function(){q.$apply()}),q}]}}return a=a&&a.module?a:window.angular,a.module("ngStorage",[]).provider("$localStorage",c("localStorage")).provider("$sessionStorage",c("sessionStorage"))});
\ No newline at end of file
diff --git a/setup/pub/angular-sanitize/angular-sanitize.js b/setup/pub/angular-sanitize/angular-sanitize.js
index 6004460cd17eb..8faa84315009f 100644
--- a/setup/pub/angular-sanitize/angular-sanitize.js
+++ b/setup/pub/angular-sanitize/angular-sanitize.js
@@ -1,76 +1,79 @@
/**
- * @license AngularJS v1.2.14
- * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * @license AngularJS v1.6.9
+ * (c) 2010-2018 Google, Inc. http://angularjs.org
* License: MIT
*/
-(function(window, angular, undefined) {'use strict';
+(function(window, angular) {'use strict';
+
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var $sanitizeMinErr = angular.$$minErr('$sanitize');
+ var bind;
+ var extend;
+ var forEach;
+ var isDefined;
+ var lowercase;
+ var noop;
+ var nodeContains;
+ var htmlParser;
+ var htmlSanitizeWriter;
/**
* @ngdoc module
* @name ngSanitize
* @description
*
- * # ngSanitize
- *
* The `ngSanitize` module provides functionality to sanitize HTML.
*
- *
- *
- *
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
*/
- /*
- * HTML Parser By Misko Hevery (misko@hevery.com)
- * based on: HTML Parser By John Resig (ejohn.org)
- * Original code by Erik Arvidsson, Mozilla Public License
- * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
- *
- * // Use like so:
- * htmlParser(htmlString, {
- * start: function(tag, attrs, unary) {},
- * end: function(tag) {},
- * chars: function(text) {},
- * comment: function(text) {}
- * });
- *
- */
-
-
/**
* @ngdoc service
* @name $sanitize
- * @function
+ * @kind function
*
* @description
- * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are
+ * Sanitizes an html string by stripping all potentially dangerous tokens.
+ *
+ * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
* then serialized back to properly escaped html string. This means that no unsafe input can make
- * it into the returned string, however, since our parser is more strict than a typical browser
- * parser, it's possible that some obscure input, which would be recognized as valid HTML by a
- * browser, won't make it through the sanitizer.
- * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
- * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
+ * it into the returned string.
*
- * @param {string} html Html input.
- * @returns {string} Sanitized html.
+ * The whitelist for URL sanitization of attribute values is configured using the functions
+ * `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
+ * `$compileProvider`}.
+ *
+ * The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
+ *
+ * @param {string} html HTML input.
+ * @returns {string} Sanitized HTML.
*
* @example
-
+
-
+
Snippet:
@@ -105,410 +108,538 @@
it('should sanitize the html snippet by default', function() {
- expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('
an html\nclick here\nsnippet
');
});
+
it('should inline raw snippet if bound to a trusted value', function() {
- expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
+ expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
toBe("
an html\n" +
"click here\n" +
"snippet
");
});
+
it('should escape snippet without any filter', function() {
- expect(element(by.css('#bind-default div')).getInnerHtml()).
+ expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
+
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new text');
- expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('new text');
- expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
+ expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
'new text');
- expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
+ expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
"new <b onclick=\"alert(1)\">text</b>");
});
*/
+
+
+ /**
+ * @ngdoc provider
+ * @name $sanitizeProvider
+ * @this
+ *
+ * @description
+ * Creates and configures {@link $sanitize} instance.
+ */
function $SanitizeProvider() {
+ var svgEnabled = false;
+
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
+ if (svgEnabled) {
+ extend(validElements, svgElements);
+ }
return function(html) {
var buf = [];
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
- return !/^unsafe/.test($$sanitizeUri(uri, isImage));
+ return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
}));
return buf.join('');
};
}];
- }
- function sanitizeText(chars) {
- var buf = [];
- var writer = htmlSanitizeWriter(buf, angular.noop);
- writer.chars(chars);
- return buf.join('');
- }
-
-
-// Regular Expressions for parsing tags and attributes
- var START_TAG_REGEXP =
- /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,
- END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/,
- ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,
- BEGIN_TAG_REGEXP = /^,
- BEGIN_END_TAGE_REGEXP = /^<\s*\//,
- COMMENT_REGEXP = //g,
- DOCTYPE_REGEXP = /]*?)>/i,
- CDATA_REGEXP = //g,
- // Match everything outside of normal chars and " (quote character)
- NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
-
-
-// Good source of info about elements and attributes
-// http://dev.w3.org/html5/spec/Overview.html#semantics
-// http://simon.html5.org/html-elements
-
-// Safe Void Elements - HTML5
-// http://dev.w3.org/html5/spec/Overview.html#void-elements
- var voidElements = makeMap("area,br,col,hr,img,wbr");
-
-// Elements that you can, intentionally, leave open (and which close themselves)
-// http://dev.w3.org/html5/spec/Overview.html#optional-tags
- var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
- optionalEndTagInlineElements = makeMap("rp,rt"),
- optionalEndTagElements = angular.extend({},
- optionalEndTagInlineElements,
- optionalEndTagBlockElements);
-
-// Safe Block Elements - HTML5
- var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," +
- "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
- "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul"));
-
-// Inline Elements - HTML5
- var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," +
- "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
- "samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
-
-
-// Special Elements (can contain anything)
- var specialElements = makeMap("script,style");
-
- var validElements = angular.extend({},
- voidElements,
- blockElements,
- inlineElements,
- optionalEndTagElements);
-
-//Attributes that have href and hence need to be sanitized
- var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap");
- var validAttrs = angular.extend({}, uriAttrs, makeMap(
- 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+
- 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+
- 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+
- 'scope,scrolling,shape,size,span,start,summary,target,title,type,'+
- 'valign,value,vspace,width'));
-
- function makeMap(str) {
- var obj = {}, items = str.split(','), i;
- for (i = 0; i < items.length; i++) obj[items[i]] = true;
- return obj;
- }
+ /**
+ * @ngdoc method
+ * @name $sanitizeProvider#enableSvg
+ * @kind function
+ *
+ * @description
+ * Enables a subset of svg to be supported by the sanitizer.
+ *
+ *
+ *
By enabling this setting without taking other precautions, you might expose your
+ * application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
+ * outside of the containing element and be rendered over other elements on the page (e.g. a login
+ * link). Such behavior can then result in phishing incidents.
+ *
+ *
To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
+ * tags within the sanitized content: