Skip to content

Commit 77ebb2b

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-20989
2 parents 0f941ad + ff2fa21 commit 77ebb2b

File tree

194 files changed

+5039
-818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+5039
-818
lines changed

app/code/Magento/Analytics/Model/ExportDataHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function __construct(
8989
public function prepareExportData()
9090
{
9191
try {
92-
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
92+
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
9393

9494
$this->prepareDirectory($tmpDirectory, $this->getTmpFilesDirRelativePath());
9595
$this->reportWriter->write($tmpDirectory, $this->getTmpFilesDirRelativePath());
@@ -157,7 +157,9 @@ private function prepareDirectory(WriteInterface $directory, $path)
157157
private function prepareFileDirectory(WriteInterface $directory, $path)
158158
{
159159
$directory->delete($path);
160+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
160161
if (dirname($path) !== '.') {
162+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
161163
$directory->create(dirname($path));
162164
}
163165

@@ -176,6 +178,7 @@ private function pack($source, $destination)
176178
$this->archive->pack(
177179
$source,
178180
$destination,
181+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
179182
is_dir($source) ?: false
180183
);
181184

app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Framework\Archive;
1414
use Magento\Framework\Filesystem;
1515
use Magento\Framework\Filesystem\Directory\WriteInterface;
16-
use Magento\Framework\Filesystem\DirectoryList;
16+
use Magento\Framework\App\Filesystem\DirectoryList;
1717
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1818

1919
class ExportDataHandlerTest extends \PHPUnit\Framework\TestCase
@@ -137,7 +137,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
137137
$this->filesystemMock
138138
->expects($this->once())
139139
->method('getDirectoryWrite')
140-
->with(DirectoryList::SYS_TMP)
140+
->with(DirectoryList::VAR_DIR)
141141
->willReturn($this->directoryMock);
142142
$this->directoryMock
143143
->expects($this->exactly(4))
@@ -238,7 +238,7 @@ public function testPrepareExportDataWithLocalizedException()
238238
$this->filesystemMock
239239
->expects($this->once())
240240
->method('getDirectoryWrite')
241-
->with(DirectoryList::SYS_TMP)
241+
->with(DirectoryList::VAR_DIR)
242242
->willReturn($this->directoryMock);
243243
$this->reportWriterMock
244244
->expects($this->once())

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@
323323
</field>
324324
<field id="port" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
325325
<label>Port (25)</label>
326-
<comment>For Windows server only.</comment>
326+
<validate>validate-digits validate-digits-range digits-range-0-65535</validate>
327+
<comment>Please enter at least 0 and at most 65535 (For Windows server only).</comment>
327328
</field>
328329
<field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
329330
<label>Set Return-Path</label>

app/code/Magento/Backend/view/adminhtml/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
'mediaUploader': 'Magento_Backend/js/media-uploader'
9+
'mediaUploader': 'Magento_Backend/js/media-uploader',
10+
'mage/translate': 'Magento_Backend/js/translate'
1011
}
1112
}
1213
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/* eslint-disable strict */
7+
(function (factory) {
8+
if (typeof define === 'function' && define.amd) {
9+
define([
10+
'jquery',
11+
'mage/mage'
12+
], factory);
13+
} else {
14+
factory(jQuery);
15+
}
16+
}(function ($) {
17+
$.extend(true, $, {
18+
mage: {
19+
translate: (function () {
20+
/**
21+
* Key-value translations storage
22+
* @type {Object}
23+
* @private
24+
*/
25+
var _data = {};
26+
27+
/**
28+
* Add new translation (two string parameters) or several translations (object)
29+
*/
30+
this.add = function () {
31+
if (arguments.length > 1) {
32+
_data[arguments[0]] = arguments[1];
33+
} else if (typeof arguments[0] === 'object') {
34+
$.extend(_data, arguments[0]);
35+
}
36+
};
37+
38+
/**
39+
* Make a translation with parsing (to handle case when _data represents tuple)
40+
* @param {String} text
41+
* @return {String}
42+
*/
43+
this.translate = function (text) {
44+
return _data[text] ? _data[text] : text;
45+
};
46+
47+
return this;
48+
}())
49+
}
50+
});
51+
$.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);
52+
53+
return $.mage.__;
54+
}));
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# BraintreeGraphQl
1+
# Magento_BraintreeGraphQl module
22

3-
**BraintreeGraphQl** provides type and resolver for method additional
4-
information.
3+
The Magento_BraintreeGraphQl module provides type and resolver information for the GraphQL module to pass payment information data from the client to Magento.
4+
5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_BraintreeGraphQl module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
8+
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_BraintreeGraphQl module.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\BundleGraphQl\Model\Resolver\Product\Price;
9+
10+
use Magento\Bundle\Pricing\Price\FinalPrice;
11+
use Magento\Catalog\Pricing\Price\BasePrice;
12+
use Magento\Bundle\Model\Product\Price;
13+
use Magento\Catalog\Pricing\Price\RegularPrice;
14+
use Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface;
15+
use Magento\Framework\Pricing\Amount\AmountInterface;
16+
use Magento\Framework\Pricing\SaleableInterface;
17+
18+
/**
19+
* Provides pricing information for Bundle products
20+
*/
21+
class Provider implements ProviderInterface
22+
{
23+
/**
24+
* @inheritdoc
25+
*/
26+
public function getMinimalFinalPrice(SaleableInterface $product): AmountInterface
27+
{
28+
return $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getMinimalPrice();
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function getMinimalRegularPrice(SaleableInterface $product): AmountInterface
35+
{
36+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getMinimalPrice();
37+
}
38+
39+
/**
40+
* @inheritdoc
41+
*/
42+
public function getMaximalFinalPrice(SaleableInterface $product): AmountInterface
43+
{
44+
return $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getMaximalPrice();
45+
}
46+
47+
/**
48+
* @inheritdoc
49+
*/
50+
public function getMaximalRegularPrice(SaleableInterface $product): AmountInterface
51+
{
52+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getMaximalPrice();
53+
}
54+
55+
/**
56+
* @inheritdoc
57+
*/
58+
public function getRegularPrice(SaleableInterface $product): AmountInterface
59+
{
60+
if ($product->getPriceType() == Price::PRICE_TYPE_FIXED) {
61+
return $product->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getAmount();
62+
}
63+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getAmount();
64+
}
65+
}

app/code/Magento/BundleGraphQl/etc/graphql/di.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,22 @@
4040
</argument>
4141
</arguments>
4242
</type>
43+
44+
45+
<type name="Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderPool">
46+
<arguments>
47+
<argument name="providers" xsi:type="array">
48+
<item name="bundle" xsi:type="object">Magento\BundleGraphQl\Model\Resolver\Product\Price\Provider</item>
49+
</argument>
50+
</arguments>
51+
</type>
52+
<type name="Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessor\AttributeProcessor">
53+
<arguments>
54+
<argument name="fieldToAttributeMap" xsi:type="array">
55+
<item name="price_range" xsi:type="array">
56+
<item name="price_type" xsi:type="string">price_type</item>
57+
</item>
58+
</argument>
59+
</arguments>
60+
</type>
4361
</config>

app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function execute(array $entityIds = [], $useTempTable = false)
105105
* @throws \Exception if metadataPool doesn't contain metadata for ProductInterface
106106
* @throws \DomainException
107107
*/
108-
private function getProductIdsWithParents(array $childProductIds)
108+
private function getProductIdsWithParents(array $childProductIds): array
109109
{
110110
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
111111
$metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
@@ -123,8 +123,12 @@ private function getProductIdsWithParents(array $childProductIds)
123123
);
124124

125125
$parentProductIds = $this->connection->fetchCol($select);
126+
$ids = array_unique(array_merge($childProductIds, $parentProductIds));
127+
foreach ($ids as $key => $id) {
128+
$ids[$key] = (int) $id;
129+
}
126130

127-
return array_unique(array_merge($childProductIds, $parentProductIds));
131+
return $ids;
128132
}
129133

130134
/**
@@ -175,7 +179,7 @@ protected function removeEntries()
175179
protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
176180
{
177181
$select = parent::getNonAnchorCategoriesSelect($store);
178-
return $select->where('ccp.product_id IN (?) OR relation.child_id IN (?)', $this->limitationByProducts);
182+
return $select->where('ccp.product_id IN (?)', $this->limitationByProducts);
179183
}
180184

181185
/**
@@ -216,28 +220,28 @@ protected function isRangingNeeded()
216220
* Returns a list of category ids which are assigned to product ids in the index
217221
*
218222
* @param array $productIds
219-
* @return \Magento\Framework\Indexer\CacheContext
223+
* @return array
220224
*/
221-
private function getCategoryIdsFromIndex(array $productIds)
225+
private function getCategoryIdsFromIndex(array $productIds): array
222226
{
223227
$categoryIds = [];
224228
foreach ($this->storeManager->getStores() as $store) {
225-
$categoryIds = array_merge(
226-
$categoryIds,
227-
$this->connection->fetchCol(
228-
$this->connection->select()
229-
->from($this->getIndexTable($store->getId()), ['category_id'])
230-
->where('product_id IN (?)', $productIds)
231-
->distinct()
232-
)
229+
$storeCategories = $this->connection->fetchCol(
230+
$this->connection->select()
231+
->from($this->getIndexTable($store->getId()), ['category_id'])
232+
->where('product_id IN (?)', $productIds)
233+
->distinct()
233234
);
235+
$categoryIds[] = $storeCategories;
234236
}
235-
$parentCategories = $categoryIds;
237+
$categoryIds = array_merge(...$categoryIds);
238+
239+
$parentCategories = [$categoryIds];
236240
foreach ($categoryIds as $categoryId) {
237241
$parentIds = explode('/', $this->getPathFromCategoryId($categoryId));
238-
$parentCategories = array_merge($parentCategories, $parentIds);
242+
$parentCategories[] = $parentIds;
239243
}
240-
$categoryIds = array_unique($parentCategories);
244+
$categoryIds = array_unique(array_merge(...$parentCategories));
241245

242246
return $categoryIds;
243247
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageActionGroup.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@
1818
<amOnPage url="{{StorefrontProductPage.url(productUrl)}}" stepKey="openProductPage"/>
1919
<waitForPageLoad stepKey="waitForProductPageLoaded"/>
2020
</actionGroup>
21+
<actionGroup name="StorefrontOpenProductPageOnSecondStore">
22+
<annotations>
23+
<description>Goes to the Storefront Product page for the provided store code and Product URL.</description>
24+
</annotations>
25+
<arguments>
26+
<argument name="storeCode" type="string"/>
27+
<argument name="productUrl" type="string"/>
28+
</arguments>
29+
30+
<amOnPage url="{{StorefrontStoreViewProductPage.url(storeCode,productUrl)}}" stepKey="openProductPage"/>
31+
</actionGroup>
2132
</actionGroups>

0 commit comments

Comments
 (0)