Skip to content

Commit a93b0c3

Browse files
committed
Merge branch '2.4-develop' into MC-42938
2 parents 15614a6 + c4003e8 commit a93b0c3

File tree

26 files changed

+3020
-2468
lines changed

26 files changed

+3020
-2468
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,15 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
205205
return $valid;
206206
}
207207

208-
if (!strlen(trim($rowData[$attrCode]))) {
208+
if ($rowData[$attrCode] === null || trim($rowData[$attrCode]) === '') {
209209
return true;
210210
}
211211

212212
if ($rowData[$attrCode] === $this->context->getEmptyAttributeValueConstant() && !$attrParams['is_required']) {
213213
return true;
214214
}
215215

216+
$valid = false;
216217
switch ($attrParams['type']) {
217218
case 'varchar':
218219
case 'text':

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,29 @@ class PersonalInfo extends \Magento\Backend\Block\Template
2323
* since his last activity. Used only if it's impossible to get such setting
2424
* from configuration.
2525
*/
26-
const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
26+
public const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
2727

2828
/**
29-
* Customer
30-
*
3129
* @var \Magento\Customer\Api\Data\CustomerInterface
3230
*/
3331
protected $customer;
3432

3533
/**
36-
* Customer log
37-
*
3834
* @var \Magento\Customer\Model\Log
3935
*/
4036
protected $customerLog;
4137

4238
/**
43-
* Customer logger
44-
*
4539
* @var \Magento\Customer\Model\Logger
4640
*/
4741
protected $customerLogger;
4842

4943
/**
50-
* Customer registry
51-
*
5244
* @var \Magento\Customer\Model\CustomerRegistry
5345
*/
5446
protected $customerRegistry;
5547

5648
/**
57-
* Account management
58-
*
5949
* @var AccountManagementInterface
6050
*/
6151
protected $accountManagement;
@@ -68,43 +58,31 @@ class PersonalInfo extends \Magento\Backend\Block\Template
6858
protected $groupRepository;
6959

7060
/**
71-
* Customer data factory
72-
*
7361
* @var \Magento\Customer\Api\Data\CustomerInterfaceFactory
7462
*/
7563
protected $customerDataFactory;
7664

7765
/**
78-
* Address helper
79-
*
8066
* @var \Magento\Customer\Helper\Address
8167
*/
8268
protected $addressHelper;
8369

8470
/**
85-
* Date time
86-
*
8771
* @var \Magento\Framework\Stdlib\DateTime
8872
*/
8973
protected $dateTime;
9074

9175
/**
92-
* Core registry
93-
*
9476
* @var \Magento\Framework\Registry
9577
*/
9678
protected $coreRegistry;
9779

9880
/**
99-
* Address mapper
100-
*
10181
* @var Mapper
10282
*/
10383
protected $addressMapper;
10484

10585
/**
106-
* Data object helper
107-
*
10886
* @var \Magento\Framework\Api\DataObjectHelper
10987
*/
11088
protected $dataObjectHelper;
@@ -439,7 +417,8 @@ public function getLastLoginDate()
439417
*/
440418
public function getStoreLastLoginDate()
441419
{
442-
$date = strtotime($this->getCustomerLog()->getLastLoginAt());
420+
$lastLogin = $this->getCustomerLog()->getLastLoginAt();
421+
$date = $lastLogin !== null ? strtotime($lastLogin) : false;
443422

444423
if ($date) {
445424
$date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true);

app/code/Magento/Customer/Model/Options.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getNamePrefixOptions($store = null)
4949
{
5050
return $this->prepareNamePrefixSuffixOptions(
5151
$this->addressHelper->getConfig('prefix_options', $store),
52-
$this->addressHelper->getConfig('prefix_show', $store) == NooptreqSource::VALUE_OPTIONAL
52+
$this->addressHelper->getConfig('prefix_show', $store) === NooptreqSource::VALUE_OPTIONAL
5353
);
5454
}
5555

@@ -63,7 +63,7 @@ public function getNameSuffixOptions($store = null)
6363
{
6464
return $this->prepareNamePrefixSuffixOptions(
6565
$this->addressHelper->getConfig('suffix_options', $store),
66-
$this->addressHelper->getConfig('suffix_show', $store) == NooptreqSource::VALUE_OPTIONAL
66+
$this->addressHelper->getConfig('suffix_show', $store) === NooptreqSource::VALUE_OPTIONAL
6767
);
6868
}
6969

@@ -93,13 +93,12 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false
9393
*/
9494
private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
9595
{
96-
$options = trim($options);
97-
if (empty($options)) {
96+
if ($options === null || empty(trim($options))) {
9897
return false;
9998
}
100-
10199
$result = [];
102-
$options = explode(';', $options);
100+
$options = explode(';', trim($options));
101+
103102
foreach ($options as $value) {
104103
$result[] = $this->escaper->escapeHtml(trim($value)) ?: ' ';
105104
}

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,12 @@ public function setRequest(\Magento\Framework\DataObject $request)
482482
);
483483

484484
$shippingWeight = $request->getPackageWeight();
485+
$destStreet = $request->getDestStreet() !== null ? str_replace("\n", '', $request->getDestStreet()) : '';
485486

486487
$requestObject->setValue(sprintf('%.2f', $request->getPackageValue()))
487488
->setValueWithDiscount($request->getPackageValueWithDiscount())
488489
->setCustomsValue($request->getPackageCustomsValue())
489-
->setDestStreet($this->string->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35))
490+
->setDestStreet($this->string->substr($destStreet, 0, 35))
490491
->setDestStreetLine2($request->getDestStreetLine2())
491492
->setDestCity($request->getDestCity())
492493
->setOrigCompanyName($request->getOrigCompanyName())
@@ -939,7 +940,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)
939940
);
940941
}
941942

942-
return round($dimension, 3);
943+
return round((float) $dimension, 3);
943944
}
944945

945946
/**

app/code/Magento/Elasticsearch/Elasticsearch5/SearchAdapter/Query/Builder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ public function initQuery(RequestInterface $request)
9191
'body' => [
9292
'from' => min(self::ELASTIC_INT_MAX, $request->getFrom()),
9393
'size' => $request->getSize(),
94-
'stored_fields' => ['_id', '_score'],
94+
'stored_fields' => '_none_',
95+
'docvalue_fields' => ['_id', '_score'],
9596
'sort' => $this->sortBuilder->getSort($request),
9697
'query' => [],
9798
],

app/code/Magento/Elasticsearch/SearchAdapter/Aggregation/Builder/Dynamic.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ private function getEntityStorage(array $queryResult)
5959
{
6060
$ids = [];
6161
foreach ($queryResult['hits']['hits'] as $document) {
62+
if (!array_key_exists('_id', $document) && isset($document['fields']['_id'][0])) {
63+
$document['_id'] = $document['fields']['_id'][0];
64+
unset($document['fields']);
65+
}
6266
$ids[] = $document['_id'];
6367
}
6468

app/code/Magento/Elasticsearch/SearchAdapter/ResponseFactory.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Magento\Framework\ObjectManagerInterface;
99

1010
/**
11-
* Response Factory
11+
* Query Response Factory
1212
* @api
1313
* @since 100.1.0
1414
*/
@@ -23,15 +23,15 @@ class ResponseFactory
2323
protected $objectManager;
2424

2525
/**
26-
* Document Factory
26+
* Document Factory to create Search Document instance
2727
*
2828
* @var DocumentFactory
2929
* @since 100.1.0
3030
*/
3131
protected $documentFactory;
3232

3333
/**
34-
* Aggregation Factory
34+
* Aggregation Factory to create Aggregation instance
3535
*
3636
* @var AggregationFactory
3737
* @since 100.1.0
@@ -64,6 +64,10 @@ public function create($response)
6464
{
6565
$documents = [];
6666
foreach ($response['documents'] as $rawDocument) {
67+
if (!array_key_exists('_id', $rawDocument) && isset($rawDocument['fields']['_id'][0])) {
68+
$rawDocument['_id'] = $rawDocument['fields']['_id'][0];
69+
unset($rawDocument['fields']);
70+
}
6771
/** @var \Magento\Framework\Api\Search\Document[] $documents */
6872
$documents[] = $this->documentFactory->create(
6973
$rawDocument

app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/ResponseFactoryTest.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,32 @@ protected function setUp(): void
7272
public function testCreate(): void
7373
{
7474
$documents = [
75-
['title' => 'oneTitle', 'description' => 'oneDescription'],
76-
['title' => 'twoTitle', 'description' => 'twoDescription']
75+
[
76+
'title' => 'oneTitle',
77+
'description' => 'oneDescription',
78+
'fields' => [
79+
'_id' => ['1']
80+
]
81+
],
82+
[
83+
'title' => 'twoTitle',
84+
'description' => 'twoDescription',
85+
'fields' => [
86+
'_id' => ['2']
87+
]
88+
]
89+
];
90+
$modifiedDocuments = [
91+
[
92+
'title' => 'oneTitle',
93+
'description' => 'oneDescription',
94+
'_id' => '1'
95+
],
96+
[
97+
'title' => 'twoTitle',
98+
'description' => 'twoDescription',
99+
'_id' => '2'
100+
]
77101
];
78102
$aggregations = [
79103
'aggregation1' => [
@@ -113,7 +137,7 @@ public function testCreate(): void
113137

114138
$this->documentFactory
115139
->method('create')
116-
->withConsecutive([$documents[0]], [$documents[1]])
140+
->withConsecutive([$modifiedDocuments[0]], [$modifiedDocuments[1]])
117141
->willReturnOnConsecutiveCalls('document1', 'document2');
118142

119143
$this->aggregationFactory

app/code/Magento/Elasticsearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"magento/module-store": "*",
1313
"magento/module-catalog-inventory": "*",
1414
"magento/framework": "*",
15-
"elasticsearch/elasticsearch": "~7.15.0"
15+
"elasticsearch/elasticsearch": "~7.16.0"
1616
},
1717
"suggest": {
1818
"magento/module-config": "*"

app/code/Magento/Elasticsearch6/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"magento/module-catalog-search": "*",
99
"magento/module-search": "*",
1010
"magento/module-elasticsearch": "*",
11-
"elasticsearch/elasticsearch": "~7.15.0"
11+
"elasticsearch/elasticsearch": "~7.16.0"
1212
},
1313
"suggest": {
1414
"magento/module-config": "*"

0 commit comments

Comments
 (0)