Skip to content

Commit 8ecf903

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #23335: Correct spelling (by @ravi-chandra3197) - #23286: Fixed Credit memo submit button(refund) stays disable after validation fails & unable to enable button issue. (by @nishantjariwala) - #23267: Add filter index for ID column in adminhtml user grid (by @JeroenVanLeusden) - #23292: revert Properly transliterate German Umlauts (by @Nazar65) - #23307: [Ui] Allow to define listing configuration via ui component xml (by @Den4ik) - #23100: Resolve issue with improper EAV attribute join statement (by @udovicic) Fixed GitHub Issues: - #23285: Credit memo submit button(refund) stays disable after validation fails & unable to enable button (reported by @nishantjariwala) has been fixed in #23286 by @nishantjariwala in 2.3-develop branch Related commits: 1. 2485940 - #23266: Cannot filter admin user by ID (reported by @JeroenVanLeusden) has been fixed in #23267 by @JeroenVanLeusden in 2.3-develop branch Related commits: 1. 6e497a6
2 parents 80fd646 + b978083 commit 8ecf903

File tree

13 files changed

+127
-119
lines changed

13 files changed

+127
-119
lines changed

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/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/Sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
enableElements('submit-button');
6767
}
6868
});
69+
$(id).observe('change', function (event) {
70+
enableElements('submit-button');
71+
});
6972
}
7073
//]]>
7174

app/code/Magento/Ui/Block/Wrapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
use Magento\Ui\Model\UiComponentGenerator;
1111

1212
/**
13-
* This block is wrapper for UI component, this done in order to save compatability with old
14-
* widgets mechanism
13+
* This block is wrapper for UI component, this done in order to save compatibility with old widgets mechanism
1514
*/
1615
class Wrapper extends \Magento\Framework\View\Element\Template
1716
{

app/code/Magento/Ui/Component/Paging.php

Lines changed: 61 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,61 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Ui\Component;
78

89
/**
10+
* Class Paging
11+
*
912
* @api
1013
* @since 100.0.2
1114
*/
1215
class Paging extends AbstractComponent
1316
{
1417
const NAME = 'paging';
1518

19+
/**
20+
* Default paging options
21+
*
22+
* @var array
23+
*/
24+
private $defaultOptions = [
25+
'20' => [
26+
'value' => 20,
27+
'label' => 20
28+
],
29+
'30' => [
30+
'value' => 30,
31+
'label' => 30
32+
],
33+
'50' => [
34+
'value' => 50,
35+
'label' => 50
36+
],
37+
'100' => [
38+
'value' => 100,
39+
'label' => 100
40+
],
41+
'200' => [
42+
'value' => 200,
43+
'label' => 200
44+
],
45+
];
46+
47+
/**
48+
* Default page size
49+
*
50+
* @var int
51+
*/
52+
private $defaultPageSize = 20;
53+
1654
/**
1755
* Default component data
1856
*
1957
* @var array
2058
*/
2159
protected $_data = [
2260
'config' => [
23-
'options' => [
24-
'20' => [
25-
'value' => 20,
26-
'label' => 20
27-
],
28-
'30' => [
29-
'value' => 30,
30-
'label' => 30
31-
],
32-
'50' => [
33-
'value' => 50,
34-
'label' => 50
35-
],
36-
'100' => [
37-
'value' => 100,
38-
'label' => 100
39-
],
40-
'200' => [
41-
'value' => 200,
42-
'label' => 200
43-
],
44-
],
45-
'pageSize' => 20,
4661
'current' => 1
4762
]
4863
];
@@ -65,13 +80,13 @@ public function getComponentName()
6580
public function prepare()
6681
{
6782
$this->prepareOptions();
83+
$this->preparePageSize();
6884
$paging = $this->getContext()->getRequestParam('paging');
6985
if (!isset($paging['notLimits'])) {
7086
$this->getContext()
7187
->getDataProvider()
7288
->setLimit($this->getOffset($paging), $this->getSize($paging));
7389
}
74-
7590
parent::prepare();
7691
}
7792

@@ -83,12 +98,26 @@ public function prepare()
8398
protected function prepareOptions()
8499
{
85100
$config = $this->getData('config');
86-
if (isset($config['options'])) {
87-
$config['options'] = array_values($config['options']);
88-
foreach ($config['options'] as &$item) {
89-
$item['value'] = (int) $item['value'];
90-
}
91-
unset($item);
101+
if (!isset($config['options'])) {
102+
$config['options'] = $this->defaultOptions;
103+
}
104+
foreach ($config['options'] as &$item) {
105+
$item['value'] = (int)$item['value'];
106+
}
107+
unset($item);
108+
$this->setData('config', $config);
109+
}
110+
111+
/**
112+
* Prepare page size
113+
*
114+
* @return void
115+
*/
116+
private function preparePageSize()
117+
{
118+
$config = $this->getData('config');
119+
if (!isset($config['pageSize'])) {
120+
$config['pageSize'] = $this->defaultPageSize;
92121
$this->setData('config', $config);
93122
}
94123
}
@@ -102,7 +131,7 @@ protected function prepareOptions()
102131
protected function getOffset($paging)
103132
{
104133
$defaultPage = $this->getData('config/current') ?: 1;
105-
return (int) (isset($paging['current']) ? $paging['current'] : $defaultPage);
134+
return (int)(isset($paging['current']) ? $paging['current'] : $defaultPage);
106135
}
107136

108137
/**
@@ -113,7 +142,6 @@ protected function getOffset($paging)
113142
*/
114143
protected function getSize($paging)
115144
{
116-
$defaultLimit = $this->getData('config/pageSize') ?: 20;
117-
return (int) (isset($paging['pageSize']) ? $paging['pageSize'] : $defaultLimit);
145+
return (int)(isset($paging['pageSize']) ? $paging['pageSize'] : $this->getData('config/pageSize'));
118146
}
119147
}

app/code/Magento/Ui/Test/Unit/Component/PagingTest.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,11 @@ public function testPrepare()
8181
],
8282
'config' => [
8383
'options' => [
84-
[
85-
'value' => 20,
86-
'label' => 20
87-
],
88-
[
89-
'value' => 30,
90-
'label' => 30
91-
],
92-
[
93-
'value' => 50,
94-
'label' => 50
95-
],
96-
[
97-
'value' => 100,
98-
'label' => 100
99-
],
100-
[
101-
'value' => 200,
102-
'label' => 200
103-
],
104-
[
84+
'options1' => [
10585
'value' => 20,
10686
'label' => 'options1'
10787
],
108-
[
88+
'options2' => [
10989
'value' => 40,
11090
'label' => 'options2'
11191
],

app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ define([
2020
template: 'ui/grid/paging/paging',
2121
totalTmpl: 'ui/grid/paging-total',
2222
totalRecords: 0,
23-
pageSize: 20,
2423
pages: 1,
2524
current: 1,
2625
selectProvider: 'ns = ${ $.ns }, index = ids',
@@ -35,7 +34,6 @@ define([
3534
},
3635

3736
imports: {
38-
pageSize: '${ $.sizesConfig.name }:value',
3937
totalSelected: '${ $.selectProvider }:totalSelected',
4038
totalRecords: '${ $.provider }:data.totalRecords',
4139
filters: '${ $.provider }:params.filters'
@@ -46,6 +44,11 @@ define([
4644
current: '${ $.provider }:params.paging.current'
4745
},
4846

47+
links: {
48+
options: '${ $.sizesConfig.name }:options',
49+
pageSize: '${ $.sizesConfig.name }:value'
50+
},
51+
4952
statefull: {
5053
pageSize: true,
5154
current: true
@@ -231,10 +234,10 @@ define([
231234
* previous and current page size values.
232235
*/
233236
updateCursor: function () {
234-
var cursor = this.current - 1,
235-
size = this.pageSize,
237+
var cursor = this.current - 1,
238+
size = this.pageSize,
236239
oldSize = _.isUndefined(this.previousSize) ? this.pageSize : this.previousSize,
237-
delta = cursor * (oldSize - size) / size;
240+
delta = cursor * (oldSize - size) / size;
238241

239242
delta = size > oldSize ?
240243
Math.ceil(delta) :

app/code/Magento/Ui/view/base/web/js/grid/paging/sizes.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,8 @@ define([
1717
return Element.extend({
1818
defaults: {
1919
template: 'ui/grid/paging/sizes',
20-
value: 20,
2120
minSize: 1,
2221
maxSize: 999,
23-
options: {
24-
'20': {
25-
value: 20,
26-
label: 20
27-
},
28-
'30': {
29-
value: 30,
30-
label: 30
31-
},
32-
'50': {
33-
value: 50,
34-
label: 50
35-
},
36-
'100': {
37-
value: 100,
38-
label: 100
39-
},
40-
'200': {
41-
value: 200,
42-
label: 200
43-
}
44-
},
4522
statefull: {
4623
options: true,
4724
value: true

app/code/Magento/User/view/adminhtml/layout/adminhtml_user_grid_block.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<argument name="index" xsi:type="string">user_id</argument>
3737
<argument name="column_css_class" xsi:type="string">col-id</argument>
3838
<argument name="header_css_class" xsi:type="string">col-id</argument>
39+
<argument name="filter_index" xsi:type="string">main_table.user_id</argument>
3940
</arguments>
4041
</block>
4142
<block class="Magento\Backend\Block\Widget\Grid\Column" name="permission.user.grid.columnSet.username" as="username">

lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function filterDataProvider()
4848
['привет мир', 'privet mir', 'privet mir', $isIconv],
4949
[
5050
'Weiß, Goldmann, Göbel, Weiss, Göthe, Goethe und Götz',
51-
'Weiss, Goldmann, Goebel, Weiss, Goethe, Goethe und Goetz',
52-
'Weiss, Goldmann, Goebel, Weiss, Goethe, Goethe und Goetz',
51+
'Weiss, Goldmann, Gobel, Weiss, Gothe, Goethe und Gotz',
52+
'Weiss, Goldmann, Gobel, Weiss, Gothe, Goethe und Gotz',
5353
$isIconv
5454
],
5555
[

0 commit comments

Comments
 (0)