Skip to content

Commit 000f153

Browse files
committed
Merge remote-tracking branch 'magento2/2.3-develop' into MAGETWO-99736
# Conflicts: # composer.lock
2 parents 165b2cd + 890bf89 commit 000f153

File tree

156 files changed

+8249
-2235
lines changed

Some content is hidden

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

156 files changed

+8249
-2235
lines changed

app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99

1010
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
1111
use Magento\Framework\Stdlib\ArrayManager;
12-
use Magento\Framework\GraphQL\DataObjectConverter;
1312

1413
/**
1514
* DataProvider Model for Authorizenet
1615
*/
1716
class AuthorizenetDataProvider implements AdditionalDataProviderInterface
1817
{
19-
private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data/authorizenet_acceptjs';
18+
private const PATH_ADDITIONAL_DATA = 'authorizenet_acceptjs';
2019

2120
/**
2221
* @var ArrayManager
@@ -36,12 +35,12 @@ public function __construct(
3635
/**
3736
* Return additional data
3837
*
39-
* @param array $args
38+
* @param array $data
4039
* @return array
4140
*/
42-
public function getData(array $args): array
41+
public function getData(array $data): array
4342
{
44-
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $args) ?? [];
43+
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data) ?? [];
4544
foreach ($additionalData as $key => $value) {
4645
$additionalData[$this->snakeCaseToCamelCase($key)] = $value;
4746
unset($additionalData[$key]);

app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,11 @@ define([
295295

296296
self.$selector.validate().form();
297297
self.$selector.trigger('afterValidate.beforeSubmit');
298-
$('body').trigger('processStop');
299298

300299
// validate parent form
301300
if (self.$selector.validate().errorList.length) {
301+
$('body').trigger('processStop');
302+
302303
return false;
303304
}
304305

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Catalog\Model\Product\Attribute\Source\Status;
12+
use Magento\Framework\EntityManager\MetadataPool;
1213
use Magento\Store\Model\Store;
1314

1415
/**
@@ -31,19 +32,28 @@ class Eraser
3132
*/
3233
protected $storeManager;
3334

35+
/**
36+
* @var MetadataPool
37+
*/
38+
private $metadataPool;
39+
3440
/**
3541
* @param \Magento\Framework\App\ResourceConnection $resource
3642
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
3743
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
44+
* @param MetadataPool|null $metadataPool
3845
*/
3946
public function __construct(
4047
\Magento\Framework\App\ResourceConnection $resource,
4148
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
42-
\Magento\Store\Model\StoreManagerInterface $storeManager
49+
\Magento\Store\Model\StoreManagerInterface $storeManager,
50+
MetadataPool $metadataPool = null
4351
) {
4452
$this->productIndexerHelper = $productHelper;
4553
$this->connection = $resource->getConnection();
4654
$this->storeManager = $storeManager;
55+
$this->metadataPool = $metadataPool ?:
56+
\Magento\Framework\App\ObjectManager::getInstance()->get(MetadataPool::class);
4757
}
4858

4959
/**
@@ -81,17 +91,24 @@ public function removeDisabledProducts(array &$ids, $storeId)
8191
/* @var $statusAttribute \Magento\Eav\Model\Entity\Attribute */
8292
$statusAttribute = $this->productIndexerHelper->getAttribute('status');
8393

94+
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
95+
$metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
96+
8497
$select = $this->getSelectForProducts($ids);
8598
$select->joinLeft(
8699
['status_global_attr' => $statusAttribute->getBackendTable()],
87100
' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
88-
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID,
101+
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID
102+
. ' AND status_global_attr.' . $statusAttribute->getEntityIdField() . '='
103+
. 'product_table.' . $metadata->getLinkField(),
89104
[]
90105
);
91106
$select->joinLeft(
92107
['status_attr' => $statusAttribute->getBackendTable()],
93108
' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
94-
. ' AND status_attr.store_id = ' . $storeId,
109+
. ' AND status_attr.store_id = ' . $storeId
110+
. ' AND status_attr.' . $statusAttribute->getEntityIdField() . '='
111+
. 'product_table.' . $metadata->getLinkField(),
95112
[]
96113
);
97114
$select->where('IFNULL(status_attr.value, status_global_attr.value) = ?', Status::STATUS_DISABLED);

app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private function getUsedImagesSelect(): Select
158158
'value as filepath'
159159
)->joinInner(
160160
['image_value' => $this->resourceConnection->getTableName(Gallery::GALLERY_VALUE_TABLE)],
161-
'images.value_id = image_value.value_id'
161+
'images.value_id = image_value.value_id',
162+
[]
162163
)->where(
163164
'images.disabled = 0 AND image_value.disabled = 0'
164165
);

app/code/Magento/CatalogUrlRewrite/Model/ResourceModel/Category/Product.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\CatalogUrlRewrite\Model\ResourceModel\Category;
710

811
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
@@ -49,7 +52,7 @@ protected function _construct()
4952
public function saveMultiple(array $insertData)
5053
{
5154
$connection = $this->getConnection();
52-
if (sizeof($insertData) <= self::CHUNK_SIZE) {
55+
if (count($insertData) <= self::CHUNK_SIZE) {
5356
return $connection->insertMultiple($this->getTable(self::TABLE_NAME), $insertData);
5457
}
5558
$data = array_chunk($insertData, self::CHUNK_SIZE);
@@ -98,10 +101,13 @@ public function removeMultipleByProductCategory(array $filter)
98101
private function prepareSelect($data)
99102
{
100103
$select = $this->getConnection()->select();
101-
$select->from($this->getTable(DbStorage::TABLE_NAME), 'url_rewrite_id');
102-
104+
$select->from(DbStorage::TABLE_NAME);
105+
$select->join(
106+
self::TABLE_NAME,
107+
DbStorage::TABLE_NAME . '.url_rewrite_id = ' . self::TABLE_NAME . '.url_rewrite_id'
108+
);
103109
foreach ($data as $column => $value) {
104-
$select->where($this->getConnection()->quoteIdentifier($column) . ' IN (?)', $value);
110+
$select->where(DbStorage::TABLE_NAME . '.' . $column . ' IN (?)', $value);
105111
}
106112
return $select;
107113
}

app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,19 @@ public function generateProductUrlRewrites(Category $category): array
143143
if ($category->getChangedProductIds()) {
144144
$this->generateChangedProductUrls($mergeDataProvider, $category, $storeId, $saveRewriteHistory);
145145
} else {
146-
$mergeDataProvider->merge(
147-
$this->getCategoryProductsUrlRewrites(
148-
$category,
149-
$storeId,
150-
$saveRewriteHistory,
151-
$category->getEntityId()
152-
)
153-
);
146+
$categoryStoreIds = $this->getCategoryStoreIds($category);
147+
148+
foreach ($categoryStoreIds as $categoryStoreId) {
149+
$this->isSkippedProduct[$category->getEntityId()] = [];
150+
$mergeDataProvider->merge(
151+
$this->getCategoryProductsUrlRewrites(
152+
$category,
153+
$categoryStoreId,
154+
$saveRewriteHistory,
155+
$category->getEntityId()
156+
)
157+
);
158+
}
154159
}
155160

156161
foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) {
@@ -241,7 +246,7 @@ private function getCategoryProductsUrlRewrites(
241246
$productCollection = $this->productCollectionFactory->create();
242247

243248
$productCollection->addCategoriesFilter(['eq' => [$category->getEntityId()]])
244-
->setStoreId($storeId)
249+
->addStoreFilter($storeId)
245250
->addAttributeToSelect('name')
246251
->addAttributeToSelect('visibility')
247252
->addAttributeToSelect('url_key')

app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/UrlRewriteHandlerTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ public function testGenerateProductUrlRewrites()
138138
->willReturn(1);
139139
$category->expects($this->any())
140140
->method('getData')
141-
->with('save_rewrites_history')
142-
->willReturn(true);
141+
->withConsecutive(
142+
[$this->equalTo('save_rewrites_history')],
143+
[$this->equalTo('initial_setup_flag')]
144+
)
145+
->willReturnOnConsecutiveCalls(
146+
true,
147+
null
148+
);
143149

144150
/* @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject $childCategory1 */
145151
$childCategory1 = $this->getMockBuilder(\Magento\Catalog\Model\Category::class)
@@ -175,6 +181,7 @@ public function testGenerateProductUrlRewrites()
175181
->method('addIdFilter')
176182
->willReturnSelf();
177183
$productCollection->expects($this->any())->method('setStoreId')->willReturnSelf();
184+
$productCollection->expects($this->any())->method('addStoreFilter')->willReturnSelf();
178185
$productCollection->expects($this->any())->method('addAttributeToSelect')->willReturnSelf();
179186
$iterator = new \ArrayIterator([]);
180187
$productCollection->expects($this->any())->method('getIterator')->will($this->returnValue($iterator));

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ define([
99

1010
return Sizes.extend({
1111
defaults: {
12-
excludedOptions: ['100', '200']
13-
},
14-
15-
/**
16-
* @override
17-
*/
18-
initialize: function () {
19-
this._super();
20-
21-
this.excludedOptions.forEach(function (excludedOption) {
22-
delete this.options[excludedOption];
23-
}, this);
24-
this.updateArray();
25-
26-
return this;
12+
options: {
13+
'20': {
14+
value: 20,
15+
label: 20
16+
},
17+
'30': {
18+
value: 30,
19+
label: 30
20+
},
21+
'50': {
22+
value: 50,
23+
label: 50
24+
}
25+
},
26+
value: 20
2727
}
2828
});
2929
});

app/code/Magento/CustomerGraphQl/Model/Context/AddUserInfoToContext.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,27 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
3939
if (null !== $currentUserId) {
4040
$currentUserId = (int)$currentUserId;
4141
}
42+
$contextParameters->setUserId($currentUserId);
4243

4344
$currentUserType = $this->userContext->getUserType();
4445
if (null !== $currentUserType) {
4546
$currentUserType = (int)$currentUserType;
4647
}
47-
48-
$contextParameters->setUserId($currentUserId);
4948
$contextParameters->setUserType($currentUserType);
49+
50+
$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));
5051
return $contextParameters;
5152
}
53+
54+
/**
55+
* Checking if current user is logged
56+
*
57+
* @param int|null $customerId
58+
* @param int|null $customerType
59+
* @return bool
60+
*/
61+
private function isCustomer(?int $customerId, ?int $customerType): bool
62+
{
63+
return !empty($customerId) && !empty($customerType) && $customerType !== UserContextInterface::USER_TYPE_GUEST;
64+
}
5265
}

app/code/Magento/CustomerGraphQl/Model/Customer/GetCustomer.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CustomerGraphQl\Model\Customer;
99

10-
use Magento\Authorization\Model\UserContextInterface;
1110
use Magento\Customer\Api\AccountManagementInterface;
1211
use Magento\Customer\Api\CustomerRepositoryInterface;
1312
use Magento\Customer\Api\Data\CustomerInterface;
@@ -18,7 +17,7 @@
1817
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
1918
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
2019
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
21-
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
20+
use Magento\GraphQl\Model\Query\ContextInterface;
2221

2322
/**
2423
* Get customer
@@ -68,11 +67,6 @@ public function __construct(
6867
public function execute(ContextInterface $context): CustomerInterface
6968
{
7069
$currentUserId = $context->getUserId();
71-
$currentUserType = $context->getUserType();
72-
73-
if (true === $this->isUserGuest($currentUserId, $currentUserType)) {
74-
throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.'));
75-
}
7670

7771
try {
7872
$customer = $this->customerRepository->getById($currentUserId);
@@ -100,19 +94,4 @@ public function execute(ContextInterface $context): CustomerInterface
10094
}
10195
return $customer;
10296
}
103-
104-
/**
105-
* Checking if current customer is guest
106-
*
107-
* @param int|null $customerId
108-
* @param int|null $customerType
109-
* @return bool
110-
*/
111-
private function isUserGuest(?int $customerId, ?int $customerType): bool
112-
{
113-
if (null === $customerId || null === $customerType) {
114-
return true;
115-
}
116-
return 0 === (int)$customerId || (int)$customerType === UserContextInterface::USER_TYPE_GUEST;
117-
}
11897
}

0 commit comments

Comments
 (0)