Skip to content

Commit 18dc53f

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #22364: Fix buttonId for credit memo button on admin invoice view (by @kassner) - #22291: Fixed #22223 Missing/Wrong data display on downloadable report table � (by @shikhamis11) - #22033: Add multibyte support for attributeSource getOptionId method (by @gomencal) - #19806: Fixed Changing sample for downloadable product failure (by @ravi-chandra3197) - #22089: Fotorama - disabling swipe on the item with class "disableSwipe" (by @iGerchak) - #22082: Remove fotorama.min.js (by @iGerchak) - #21979: [Component Rule] Revert es6 variable declarations (by @Den4ik) - #21797: #8035: Join extension attributes are not added to Order results (REST api) (by @swnsma) - #21772: Make sure Yes/No attribute Layered Navigation filter uses index (by @stkec) - #18336: add more CDATA-related tests for `Magento\Framework\Config\Dom::merge` and fix failing ones (by @enl) Fixed GitHub Issues: - #22223: Missing/Wrong data display on downloadable report table reports>downloads in BO (reported by @seyuf) has been fixed in #22291 by @shikhamis11 in 2.3-develop branch Related commits: 1. b881a5d 2. bf8e919 3. 0453184 - #6272: Changing sample for downloadable product failure (reported by @bartoszkubicki) has been fixed in #19806 by @ravi-chandra3197 in 2.3-develop branch Related commits: 1. 7cd48fc 2. b39550a 3. d598262 - #8035: Join extension attributes are not added to Order results (REST api) (reported by @Bbbrinks) has been fixed in #21797 by @swnsma in 2.3-develop branch Related commits: 1. 961e05c 2. 4603abc 3. a45fb74 - #3283: «Yes/No» attributes should be allowed in the Layered Navigation (reported by @dmitry-fedyuk) has been fixed in #21772 by @stkec in 2.3-develop branch Related commits: 1. dc3bdb8 2. b34eb7a 3. 3c50c7c - #21771: Performance degradation in Layered navigation using Yes/No attribute (reported by @stkec) has been fixed in #21772 by @stkec in 2.3-develop branch Related commits: 1. dc3bdb8 2. b34eb7a 3. 3c50c7c
2 parents 45a6365 + a44f50a commit 18dc53f

File tree

37 files changed

+547
-59
lines changed

37 files changed

+547
-59
lines changed

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
use Magento\Catalog\Api\Data\ProductInterface;
99
use Magento\Catalog\Model\Product;
1010
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
11+
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;
1112
use Magento\CatalogSearch\Model\Search\TableMapper;
13+
use Magento\Customer\Model\Session;
1214
use Magento\Eav\Model\Config;
1315
use Magento\Framework\App\Config\ScopeConfigInterface;
1416
use Magento\Framework\App\ObjectManager;
@@ -20,10 +22,11 @@
2022
use Magento\Framework\Search\Adapter\Mysql\Filter\PreprocessorInterface;
2123
use Magento\Framework\Search\Request\FilterInterface;
2224
use Magento\Store\Model\Store;
23-
use Magento\Customer\Model\Session;
24-
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;
2525

2626
/**
27+
* ElasticSearch search filter pre-processor.
28+
*
29+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2730
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2831
* @deprecated
2932
* @see \Magento\ElasticSearch
@@ -128,18 +131,21 @@ public function __construct(
128131
}
129132

130133
/**
131-
* {@inheritdoc}
134+
* @inheritdoc
132135
*/
133136
public function process(FilterInterface $filter, $isNegation, $query)
134137
{
135138
return $this->processQueryWithField($filter, $isNegation, $query);
136139
}
137140

138141
/**
142+
* Process query with field.
143+
*
139144
* @param FilterInterface $filter
140145
* @param bool $isNegation
141146
* @param string $query
142147
* @return string
148+
* @throws \Magento\Framework\Exception\LocalizedException
143149
*/
144150
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
145151
{
@@ -170,7 +176,7 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
170176
} elseif ($filter->getField() === VisibilityFilter::VISIBILITY_FILTER_FIELD) {
171177
return '';
172178
} elseif ($filter->getType() === FilterInterface::TYPE_TERM &&
173-
in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
179+
in_array($attribute->getFrontendInput(), ['select', 'multiselect', 'boolean'], true)
174180
) {
175181
$resultQuery = $this->processTermSelect($filter, $isNegation);
176182
} elseif ($filter->getType() === FilterInterface::TYPE_RANGE &&
@@ -204,19 +210,23 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
204210
->where('main_table.store_id = ?', Store::DEFAULT_STORE_ID)
205211
->having($query);
206212

207-
$resultQuery = 'search_index.entity_id IN (
208-
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
209-
)';
213+
$resultQuery = 'search_index.entity_id IN ('
214+
. 'select entity_id from '
215+
. $this->conditionManager->wrapBrackets($select)
216+
. ' as filter)';
210217
}
211218

212219
return $resultQuery;
213220
}
214221

215222
/**
223+
* Process range numeric.
224+
*
216225
* @param FilterInterface $filter
217226
* @param string $query
218227
* @param Attribute $attribute
219228
* @return string
229+
* @throws \Exception
220230
*/
221231
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
222232
{
@@ -238,14 +248,17 @@ private function processRangeNumeric(FilterInterface $filter, $query, $attribute
238248
->where('main_table.store_id = ?', $currentStoreId)
239249
->having($query);
240250

241-
$resultQuery = 'search_index.entity_id IN (
242-
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
243-
)';
251+
$resultQuery = 'search_index.entity_id IN ('
252+
. 'select entity_id from '
253+
. $this->conditionManager->wrapBrackets($select)
254+
. ' as filter)';
244255

245256
return $resultQuery;
246257
}
247258

248259
/**
260+
* Process term select.
261+
*
249262
* @param FilterInterface $filter
250263
* @param bool $isNegation
251264
* @return string

app/code/Magento/CatalogSearch/Model/Search/CustomAttributeFilterCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function isCustom(FilterInterface $filter)
4444

4545
return $attribute
4646
&& $filter->getType() === FilterInterface::TYPE_TERM
47-
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true);
47+
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect', 'boolean'], true);
4848
}
4949

5050
/**

app/code/Magento/Downloadable/Model/SampleRepository.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/**
2525
* Class SampleRepository
26+
*
2627
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2728
*/
2829
class SampleRepository implements \Magento\Downloadable\Api\SampleRepositoryInterface
@@ -100,7 +101,7 @@ public function __construct(
100101
}
101102

102103
/**
103-
* {@inheritdoc}
104+
* @inheritdoc
104105
*/
105106
public function getList($sku)
106107
{
@@ -209,6 +210,8 @@ public function save(
209210
}
210211

211212
/**
213+
* Save sample.
214+
*
212215
* @param \Magento\Catalog\Api\Data\ProductInterface $product
213216
* @param SampleInterface $sample
214217
* @param bool $isGlobalScopeContent
@@ -257,6 +260,8 @@ protected function saveSample(
257260
}
258261

259262
/**
263+
* Update sample.
264+
*
260265
* @param \Magento\Catalog\Api\Data\ProductInterface $product
261266
* @param SampleInterface $sample
262267
* @param bool $isGlobalScopeContent
@@ -308,15 +313,18 @@ protected function updateSample(
308313
$existingSample->setTitle($sample->getTitle());
309314
}
310315

311-
if ($sample->getSampleType() === 'file' && $sample->getSampleFileContent() === null) {
312-
$sample->setSampleFile($existingSample->getSampleFile());
316+
if ($sample->getSampleType() === 'file'
317+
&& $sample->getSampleFileContent() === null
318+
&& $sample->getSampleFile() !== null
319+
) {
320+
$existingSample->setSampleFile($sample->getSampleFile());
313321
}
314322
$this->saveSample($product, $sample, $isGlobalScopeContent);
315323
return $existingSample->getId();
316324
}
317325

318326
/**
319-
* {@inheritdoc}
327+
* @inheritdoc
320328
*/
321329
public function delete($id)
322330
{

app/code/Magento/Eav/Model/Entity/Attribute/Source/AbstractSource.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Eav\Model\Entity\Attribute\Source;
78

89
/**
910
* Entity/Attribute/Model - attribute selection source abstract
10-
*
11+
* phpcs:disable Magento2.Classes.AbstractApi
1112
* @api
1213
* @author Magento Core Team <core@magentocommerce.com>
1314
* @SuppressWarnings(PHPMD.NumberOfChildren)
@@ -65,7 +66,7 @@ public function getOptionText($value)
6566
{
6667
$options = $this->getAllOptions();
6768
// Fixed for tax_class_id and custom_design
68-
if (sizeof($options) > 0) {
69+
if (count($options) > 0) {
6970
foreach ($options as $option) {
7071
if (isset($option['value']) && $option['value'] == $value) {
7172
return isset($option['label']) ? $option['label'] : $option['value'];
@@ -88,7 +89,7 @@ public function getOptionText($value)
8889
public function getOptionId($value)
8990
{
9091
foreach ($this->getAllOptions() as $option) {
91-
if (strcasecmp($option['label'], $value) == 0 || $option['value'] == $value) {
92+
if ($this->mbStrcasecmp($option['label'], $value) == 0 || $option['value'] == $value) {
9293
return $option['value'];
9394
}
9495
}
@@ -166,4 +167,20 @@ public function toOptionArray()
166167
{
167168
return $this->getAllOptions();
168169
}
170+
171+
/**
172+
* Multibyte support strcasecmp function version.
173+
*
174+
* @param string $str1
175+
* @param string $str2
176+
* @return int
177+
*/
178+
private function mbStrcasecmp($str1, $str2)
179+
{
180+
$encoding = mb_internal_encoding();
181+
return strcmp(
182+
mb_strtoupper($str1, $encoding),
183+
mb_strtoupper($str2, $encoding)
184+
);
185+
}
169186
}

app/code/Magento/Reports/Model/ResourceModel/Product/Downloads/Collection.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Reports\Model\ResourceModel\Product\Downloads;
8+
79
/**
810
* Product Downloads Report collection
911
*
1012
* @author Magento Core Team <core@magentocommerce.com>
11-
*/
12-
namespace Magento\Reports\Model\ResourceModel\Product\Downloads;
13-
14-
/**
13+
*
1514
* @api
1615
* @since 100.0.2
16+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1717
*/
1818
class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
1919
{
@@ -97,4 +97,14 @@ public function addFieldToFilter($field, $condition = null)
9797
}
9898
return $this;
9999
}
100+
101+
/**
102+
* @inheritDoc
103+
*/
104+
public function getSelectCountSql()
105+
{
106+
$countSelect = parent::getSelectCountSql();
107+
$countSelect->reset(\Zend\Db\Sql\Select::GROUP);
108+
return $countSelect;
109+
}
100110
}

app/code/Magento/Rule/view/adminhtml/web/rules.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define([
1313
'mage/translate',
1414
'prototype'
1515
], function (jQuery) {
16+
'use strict';
1617

1718
var VarienRulesForm = new Class.create();
1819

@@ -125,7 +126,7 @@ define([
125126
var values = this.updateElement.value.split(','),
126127
s = '';
127128

128-
for (i = 0; i < values.length; i++) {
129+
for (var i = 0; i < values.length; i++) {
129130
s = values[i].strip();
130131

131132
if (s != '') {
@@ -254,7 +255,7 @@ define([
254255
if (elem && elem.options) {
255256
var selectedOptions = [];
256257

257-
for (i = 0; i < elem.options.length; i++) {
258+
for (var i = 0; i < elem.options.length; i++) {
258259
if (elem.options[i].selected) {
259260
selectedOptions.push(elem.options[i].text);
260261
}
@@ -299,14 +300,14 @@ define([
299300
},
300301

301302
changeVisibilityForValueRuleParam: function(elem) {
302-
let parsedElementId = elem.id.split('__');
303-
if (parsedElementId[2] != 'operator') {
303+
var parsedElementId = elem.id.split('__');
304+
if (parsedElementId[2] !== 'operator') {
304305
return false;
305306
}
306307

307-
let valueElement = jQuery('#' + parsedElementId[0] + '__' + parsedElementId[1] + '__value');
308+
var valueElement = jQuery('#' + parsedElementId[0] + '__' + parsedElementId[1] + '__value');
308309

309-
if(elem.value == '<=>') {
310+
if(elem.value === '<=>') {
310311
valueElement.closest('.rule-param').hide();
311312
} else {
312313
valueElement.closest('.rule-param').show();

app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ protected function _construct()
113113
$orderPayment->canRefund() && !$this->getInvoice()->getIsUsedForRefund()
114114
) {
115115
$this->buttonList->add(
116-
'capture',
117-
[ // capture?
116+
'credit-memo',
117+
[
118118
'label' => __('Credit Memo'),
119119
'class' => 'credit-memo',
120120
'onclick' => 'setLocation(\'' . $this->getCreditMemoUrl() . '\')'

app/code/Magento/Sales/Model/OrderRepository.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
namespace Magento\Sales\Model;
88

9+
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
910
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
11+
use Magento\Framework\App\ObjectManager;
1012
use Magento\Framework\Exception\InputException;
1113
use Magento\Framework\Exception\NoSuchEntityException;
1214
use Magento\Sales\Api\Data\OrderExtensionFactory;
@@ -16,7 +18,6 @@
1618
use Magento\Sales\Api\Data\ShippingAssignmentInterface;
1719
use Magento\Sales\Model\Order\ShippingAssignmentBuilder;
1820
use Magento\Sales\Model\ResourceModel\Metadata;
19-
use Magento\Framework\App\ObjectManager;
2021
use Magento\Tax\Api\OrderTaxManagementInterface;
2122
use Magento\Payment\Api\Data\PaymentAdditionalInfoInterface;
2223
use Magento\Payment\Api\Data\PaymentAdditionalInfoInterfaceFactory;
@@ -74,6 +75,11 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
7475
*/
7576
private $serializer;
7677

78+
/**
79+
* @var JoinProcessorInterface
80+
*/
81+
private $extensionAttributesJoinProcessor;
82+
7783
/**
7884
* Constructor
7985
*
@@ -84,6 +90,7 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
8490
* @param OrderTaxManagementInterface|null $orderTaxManagement
8591
* @param PaymentAdditionalInfoInterfaceFactory|null $paymentAdditionalInfoFactory
8692
* @param JsonSerializer|null $serializer
93+
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
8794
*/
8895
public function __construct(
8996
Metadata $metadata,
@@ -92,7 +99,8 @@ public function __construct(
9299
\Magento\Sales\Api\Data\OrderExtensionFactory $orderExtensionFactory = null,
93100
OrderTaxManagementInterface $orderTaxManagement = null,
94101
PaymentAdditionalInfoInterfaceFactory $paymentAdditionalInfoFactory = null,
95-
JsonSerializer $serializer = null
102+
JsonSerializer $serializer = null,
103+
JoinProcessorInterface $extensionAttributesJoinProcessor = null
96104
) {
97105
$this->metadata = $metadata;
98106
$this->searchResultFactory = $searchResultFactory;
@@ -106,6 +114,8 @@ public function __construct(
106114
->get(PaymentAdditionalInfoInterfaceFactory::class);
107115
$this->serializer = $serializer ?: ObjectManager::getInstance()
108116
->get(JsonSerializer::class);
117+
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor
118+
?: ObjectManager::getInstance()->get(JoinProcessorInterface::class);
109119
}
110120

111121
/**
@@ -198,6 +208,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
198208
{
199209
/** @var \Magento\Sales\Api\Data\OrderSearchResultInterface $searchResult */
200210
$searchResult = $this->searchResultFactory->create();
211+
$this->extensionAttributesJoinProcessor->process($searchResult);
201212
$this->collectionProcessor->process($searchCriteria, $searchResult);
202213
$searchResult->setSearchCriteria($searchCriteria);
203214
foreach ($searchResult->getItems() as $order) {

dev/tests/api-functional/_files/Magento/TestModuleJoinDirectives/etc/extension_attributes.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,16 @@
3131
</join>
3232
</attribute>
3333
</extension_attributes>
34+
<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
35+
<attribute code="orderApiTestAttribute" type="Magento\User\Api\Data\UserInterface">
36+
<join reference_table="admin_user"
37+
join_on_field="store_id"
38+
reference_field="user_id"
39+
>
40+
<field>firstname</field>
41+
<field>lastname</field>
42+
<field>email</field>
43+
</join>
44+
</attribute>
45+
</extension_attributes>
3446
</config>

0 commit comments

Comments
 (0)