Skip to content

Commit dbb159a

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #26251: [Customer] Removing the delete buttons for default customer groups (by @eduard13) - #26270: Fix #22964 (by @marcoaacoliveira) - #26290: [Fixed Jump Datepicker issue in Catalog Price Rule] (by @hitesh-wagento) - #26263: Fix #14913 - bookmark views become uneditable after deleting the first bookmark view (by @Bartlomiejsz) - #26048: Fixed spelling and adjusted white spaces (by @pawankparmar) - #25985: Fixed ability to save configuration in field without label (by @AndreyChorniy) - #25337: #14971 Improper Handling of Pagination SEO (by @chickenland) - #22990: [Catalog|Sales] Fix wrong behavior of grid row click event (by @Den4ik) - #26218: FIX issue#26217 - Wrong fields selection while using fragments on GraphQL (by @phoenix128) - #26281: HOTFIX: Invalid use of OpenOrderById (by @lbajsarowicz) Fixed GitHub Issues: - #22964: Unable to save any dates if the user interface locale is not english (US) in 2.3.1 (reported by @ioweb-gr) has been fixed in #26270 by @marcoaacoliveira in 2.4-develop branch Related commits: 1. bb16e33 2. d12ac21 3. 32be472 4. 6a19b12 5. 6e80158 6. 8ee89af 7. c85410d - #26289: Jump Datepicker in Catalog Price Rule (reported by @hitesh-wagento) has been fixed in #26290 by @hitesh-wagento in 2.4-develop branch Related commits: 1. 557247f - #14913: bookmark views become uneditable after deleting the first bookmark view. (reported by @Jakhotiya) has been fixed in #26263 by @Bartlomiejsz in 2.4-develop branch Related commits: 1. fe98438 - #23899: system.xml file validation issue (reported by @Gurdit) has been fixed in #25985 by @AndreyChorniy in 2.4-develop branch Related commits: 1. c273067 2. eb40893 3. cfd7771 4. 1308074 5. 5e6c595 6. f30a06a - #14971: Improper Handling of Pagination SEO (reported by @winterk80) has been fixed in #25337 by @chickenland in 2.4-develop branch Related commits: 1. c57d98c 2. 3f4642e 3. 2860283 4. 94e8685 5. 9c4991a - #22988: Wrong behavior of grid row and checkbox click (reported by @Den4ik) has been fixed in #22990 by @Den4ik in 2.4-develop branch Related commits: 1. 0105e4c 2. 22aa250 3. 2b19c93 4. 0988b6e 5. 69447cb 6. 021b5d8 7. 27a57de 8. d2af286 9. 8b7458e - #26217: Wrong fields selection while using fragments on GraphQL products query (reported by @phoenix128) has been fixed in #26218 by @phoenix128 in 2.4-develop branch Related commits: 1. 2b5720c 2. 631282e
2 parents 7ccd640 + 47e4b4e commit dbb159a

File tree

20 files changed

+1021
-385
lines changed

20 files changed

+1021
-385
lines changed

app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function getFinalPrice();
2929

3030
/**
3131
* Set the final price: usually it calculated as minimal price of the product
32+
*
3233
* Can be different depends on type of product
3334
*
3435
* @param string $finalPrice
@@ -39,6 +40,7 @@ public function setFinalPrice($finalPrice);
3940

4041
/**
4142
* Retrieve max price of a product
43+
*
4244
* E.g. for product with custom options is price with the most expensive custom option
4345
*
4446
* @return string
@@ -57,6 +59,7 @@ public function setMaxPrice($maxPrice);
5759

5860
/**
5961
* Retrieve the minimal price of the product or variation
62+
*
6063
* The minimal price is for example, the lowest price of all variations for complex product
6164
*
6265
* @return string
@@ -66,7 +69,7 @@ public function getMinimalPrice();
6669

6770
/**
6871
* Set max regular price
69-
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalogules
72+
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules
7073
* in it
7174
*
7275
* @param string $maxRegularPrice
@@ -130,6 +133,7 @@ public function setMinimalPrice($minimalPrice);
130133

131134
/**
132135
* Regular price - is price of product without discounts and special price with taxes and fixed product tax
136+
*
133137
* Usually this price is corresponding to price in admin panel of product
134138
*
135139
* @return string

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,29 @@ define([
5151
*/
5252
function categoryProductRowClick(grid, event) {
5353
var trElement = Event.findElement(event, 'tr'),
54-
isInput = Event.element(event).tagName === 'INPUT',
54+
eventElement = Event.element(event),
55+
isInputCheckbox = eventElement.tagName === 'INPUT' && eventElement.type === 'checkbox',
56+
isInputPosition = grid.targetElement &&
57+
grid.targetElement.tagName === 'INPUT' &&
58+
grid.targetElement.name === 'position',
5559
checked = false,
5660
checkbox = null;
5761

58-
if (trElement) {
62+
if (eventElement.tagName === 'LABEL' &&
63+
trElement.querySelector('#' + eventElement.htmlFor) &&
64+
trElement.querySelector('#' + eventElement.htmlFor).type === 'checkbox'
65+
) {
66+
event.stopPropagation();
67+
trElement.querySelector('#' + eventElement.htmlFor).trigger('click');
68+
69+
return;
70+
}
71+
72+
if (trElement && !isInputPosition) {
5973
checkbox = Element.getElementsBySelector(trElement, 'input');
6074

6175
if (checkbox[0]) {
62-
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
76+
checked = isInputCheckbox ? checkbox[0].checked : !checkbox[0].checked;
6377
gridJsObject.setCheckboxChecked(checkbox[0], checked);
6478
}
6579
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/FieldSelection.php

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver\Products\Query;
99

10-
use GraphQL\Language\AST\SelectionNode;
1110
use Magento\Framework\GraphQl\Query\FieldTranslator;
1211
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1312

@@ -37,57 +36,18 @@ public function __construct(FieldTranslator $fieldTranslator)
3736
*/
3837
public function getProductsFieldSelection(ResolveInfo $resolveInfo): array
3938
{
40-
return $this->getProductFields($resolveInfo);
41-
}
39+
$productFields = $resolveInfo->getFieldSelection(1);
40+
$sectionNames = ['items', 'product'];
4241

43-
/**
44-
* Return field names for all requested product fields.
45-
*
46-
* @param ResolveInfo $info
47-
* @return string[]
48-
*/
49-
private function getProductFields(ResolveInfo $info): array
50-
{
5142
$fieldNames = [];
52-
foreach ($info->fieldNodes as $node) {
53-
if ($node->name->value !== 'products' && $node->name->value !== 'variants') {
54-
continue;
55-
}
56-
foreach ($node->selectionSet->selections as $selection) {
57-
if ($selection->name->value !== 'items' && $selection->name->value !== 'product') {
58-
continue;
59-
}
60-
$fieldNames[] = $this->collectProductFieldNames($selection, $fieldNames);
61-
}
62-
}
63-
if (!empty($fieldNames)) {
64-
$fieldNames = array_merge(...$fieldNames);
65-
}
66-
return $fieldNames;
67-
}
68-
69-
/**
70-
* Collect field names for each node in selection
71-
*
72-
* @param SelectionNode $selection
73-
* @param array $fieldNames
74-
* @return array
75-
*/
76-
private function collectProductFieldNames(SelectionNode $selection, array $fieldNames = []): array
77-
{
78-
foreach ($selection->selectionSet->selections as $itemSelection) {
79-
if ($itemSelection->kind === 'InlineFragment') {
80-
foreach ($itemSelection->selectionSet->selections as $inlineSelection) {
81-
if ($inlineSelection->kind === 'InlineFragment') {
82-
continue;
83-
}
84-
$fieldNames[] = $this->fieldTranslator->translate($inlineSelection->name->value);
43+
foreach ($sectionNames as $sectionName) {
44+
if (isset($productFields[$sectionName])) {
45+
foreach (array_keys($productFields[$sectionName]) as $fieldName) {
46+
$fieldNames[] = $this->fieldTranslator->translate($fieldName);
8547
}
86-
continue;
8748
}
88-
$fieldNames[] = $this->fieldTranslator->translate($itemSelection->name->value);
8949
}
9050

91-
return $fieldNames;
51+
return array_unique($fieldNames);
9252
}
9353
}

app/code/Magento/Config/Model/Config/Structure.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ public function getFieldPathsByAttribute($attributeName, $attributeValue)
292292
foreach ($section['children'] as $group) {
293293
if (isset($group['children'])) {
294294
$path = $section['id'] . '/' . $group['id'];
295+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge
295296
$result = array_merge(
296297
$result,
297298
$this->_getGroupFieldPathsByAttribute(
@@ -398,7 +399,7 @@ private function getFieldsRecursively(array $elements = [])
398399
$this->getFieldsRecursively($element['children'])
399400
);
400401
} else {
401-
if ($element['_elementType'] === 'field' && isset($element['label'])) {
402+
if ($element['_elementType'] === 'field') {
402403
$structurePath = (isset($element['path']) ? $element['path'] . '/' : '') . $element['id'];
403404
$configPath = isset($element['config_path']) ? $element['config_path'] : $structurePath;
404405

app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php

Lines changed: 98 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class StructureTest extends \PHPUnit\Framework\TestCase
5050
*/
5151
protected $_structureData;
5252

53+
/**
54+
* @inheritdoc
55+
*/
5356
protected function setUp()
5457
{
5558
$this->_flyweightFactory = $this->getMockBuilder(FlyweightFactory::class)
@@ -82,7 +85,12 @@ protected function setUp()
8285
);
8386
}
8487

85-
public function testGetTabsBuildsSectionTree()
88+
/**
89+
* Verify tabs build section tree
90+
*
91+
* @return void
92+
*/
93+
public function testGetTabsBuildsSectionTree(): void
8694
{
8795
$expected = ['tab1' => ['children' => ['section1' => ['tab' => 'tab1']]]];
8896

@@ -108,7 +116,12 @@ public function testGetTabsBuildsSectionTree()
108116
$this->assertEquals($this->_tabIteratorMock, $model->getTabs());
109117
}
110118

111-
public function testGetSectionList()
119+
/**
120+
* Verify get section list method
121+
*
122+
* @return void
123+
*/
124+
public function testGetSectionList(): void
112125
{
113126
$expected = [
114127
'section1_child_id_1' => true,
@@ -152,6 +165,8 @@ public function testGetSectionList()
152165
}
153166

154167
/**
168+
* Verify Get Element return empty element if element is requested
169+
*
155170
* @param string $path
156171
* @param string $expectedType
157172
* @param string $expectedId
@@ -174,6 +189,8 @@ public function testGetElementReturnsEmptyElementIfNotExistingElementIsRequested
174189
}
175190

176191
/**
192+
* Verify get Element return empty by path element if not exist
193+
*
177194
* @param string $path
178195
* @param string $expectedType
179196
* @param string $expectedId
@@ -196,6 +213,8 @@ public function testGetElementReturnsEmptyByConfigPathElementIfNotExistingElemen
196213
}
197214

198215
/**
216+
* Verify Element return e,pty element if not exists
217+
*
199218
* @param string $expectedType
200219
* @param string $expectedId
201220
* @param string $expectedPath
@@ -234,21 +253,33 @@ public function emptyElementDataProvider()
234253
];
235254
}
236255

237-
public function testGetElementReturnsProperElementByPath()
256+
/**
257+
* Verify get element returns proper element by path
258+
*
259+
* @return void
260+
*/
261+
public function testGetElementReturnsProperElementByPath(): void
238262
{
239263
$elementMock = $this->getElementPathReturnsProperElementByPath();
240264

241265
$this->assertEquals($elementMock, $this->_model->getElement('section_1/group_level_1/field_3'));
242266
}
243267

244-
public function testGetElementByConfigPathReturnsProperElementByPath()
268+
/**
269+
* Verify get element by config path return proper path
270+
*
271+
* @return void
272+
*/
273+
public function testGetElementByConfigPathReturnsProperElementByPath(): void
245274
{
246275
$elementMock = $this->getElementPathReturnsProperElementByPath();
247276

248277
$this->assertEquals($elementMock, $this->_model->getElementByConfigPath('section_1/group_level_1/field_3'));
249278
}
250279

251280
/**
281+
* Build mock element
282+
*
252283
* @return Mock
253284
*/
254285
private function getElementPathReturnsProperElementByPath()
@@ -271,7 +302,12 @@ private function getElementPathReturnsProperElementByPath()
271302
return $elementMock;
272303
}
273304

274-
public function testGetElementByPathPartsIfSectionDataIsEmpty()
305+
/**
306+
* Verefy get element by path part
307+
*
308+
* @return void
309+
*/
310+
public function testGetElementByPathPartsIfSectionDataIsEmpty(): void
275311
{
276312
$fieldData = [
277313
'id' => 'field_3',
@@ -342,15 +378,25 @@ public function testGetFirstSectionReturnsFirstAllowedSection()
342378
$this->assertEquals('currentSection', $this->_model->getFirstSection()->getData());
343379
}
344380

345-
public function testGetElementReturnsProperElementByPathCachesObject()
381+
/**
382+
* Verify get element return element by path caches object
383+
*
384+
* @return void
385+
*/
386+
public function testGetElementReturnsProperElementByPathCachesObject(): void
346387
{
347388
$elementMock = $this->getElementReturnsProperElementByPathCachesObject();
348389

349390
$this->assertEquals($elementMock, $this->_model->getElement('section_1/group_level_1/field_3'));
350391
$this->assertEquals($elementMock, $this->_model->getElement('section_1/group_level_1/field_3'));
351392
}
352393

353-
public function testGetElementByConfigPathReturnsProperElementByPathCachesObject()
394+
/**
395+
* Verify Get Element by id returns proper element
396+
*
397+
* @return void
398+
*/
399+
public function testGetElementByConfigPathReturnsProperElementByPathCachesObject(): void
354400
{
355401
$elementMock = $this->getElementReturnsProperElementByPathCachesObject();
356402

@@ -393,6 +439,8 @@ public function testGetFieldPathsByAttribute($attributeName, $attributeValue, $p
393439
}
394440

395441
/**
442+
* DataProvider
443+
*
396444
* @return array
397445
*/
398446
public function getFieldPathsByAttributeDataProvider()
@@ -411,33 +459,53 @@ public function getFieldPathsByAttributeDataProvider()
411459
];
412460
}
413461

414-
public function testGetFieldPaths()
462+
/**
463+
* Verify get Fields paths method
464+
*
465+
* @dataProvider getFieldPaths
466+
* @param array $expected
467+
* @return void
468+
*/
469+
public function testGetFieldPaths(array $expected): void
415470
{
416-
$expected = [
417-
'section/group/field2' => [
418-
'field_2'
419-
],
420-
'field_3' => [
421-
'field_3',
422-
'field_3'
423-
],
424-
'field_3_1' => [
425-
'field_3_1'
426-
],
427-
'field_3_1_1' => [
428-
'field_3_1_1'
429-
],
430-
'section/group/field4' => [
431-
'field_4',
432-
],
433-
'field_5' => [
434-
'field_5',
435-
],
436-
];
437-
438471
$this->assertSame(
439472
$expected,
440473
$this->_model->getFieldPaths()
441474
);
442475
}
476+
477+
/**
478+
* dataprovider for Field Paths
479+
*
480+
* @return array
481+
*/
482+
public function getFieldPaths(): array
483+
{
484+
return [
485+
[
486+
[
487+
'section/group/field2' => [
488+
'field_2'
489+
],
490+
'field_3' => [
491+
'field_3',
492+
'field_3'
493+
],
494+
'field_3_1' => [
495+
'field_3_1'
496+
],
497+
'field_3_1_1' => [
498+
'field_3_1_1'
499+
],
500+
'section/group/field4' => [
501+
'field_4',
502+
],
503+
'field_5' => [
504+
'field_5',
505+
'field_5'
506+
]
507+
]
508+
]
509+
];
510+
}
443511
}

0 commit comments

Comments
 (0)