Skip to content

Commit fff55a7

Browse files
committed
ACP2E-4239: Date Filter not working according to store timezone on Credit Memos grid
1 parent 9c35563 commit fff55a7

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

app/code/Magento/Catalog/Ui/Component/Listing/Columns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Columns extends \Magento\Ui\Component\Listing\Columns
1616
/**
1717
* Default columns max order value
1818
*/
19-
const DEFAULT_COLUMNS_MAX_ORDER = 100;
19+
public const DEFAULT_COLUMNS_MAX_ORDER = 100;
2020

2121
/**
2222
* @var \Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Ui\Component;
77

@@ -21,7 +21,7 @@
2121
*/
2222
class Filters extends AbstractComponent implements ObserverInterface
2323
{
24-
const NAME = 'filters';
24+
public const NAME = 'filters';
2525

2626
/**
2727
* Filters created from columns
@@ -114,8 +114,8 @@ public function update(UiComponentInterface $component)
114114
}
115115

116116
if (isset($this->filterMap[$filterType]) && !isset($this->columnFilters[$component->getName()])) {
117-
$config = (array) $component->getConfig();
118-
$userDefined = (bool) ($config['userDefined'] ?? 0);
117+
$config = (array) $component->getData('config');
118+
$userDefined = (bool) ($config['userDefined'] ?? false);
119119

120120
$filterComponent = $this->uiComponentFactory->create(
121121
$component->getName(),

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ protected function setUp(): void
6363
*
6464
* @param string $filterType
6565
* @param string $filterName
66+
* @param bool $userDefined
6667
* @dataProvider updateDataProvider
6768
*/
68-
public function testUpdate(string $filterType, string $filterName)
69+
public function testUpdate(string $filterType, string $filterName, bool $userDefined)
6970
{
7071
$componentName = 'component_name';
7172
$componentConfig = [0, 1, 2];
@@ -75,8 +76,12 @@ public function testUpdate(string $filterType, string $filterName)
7576
->getMockForAbstractClass();
7677
$columnInterface->expects($this->atLeastOnce())
7778
->method('getData')
78-
->with('config/filter')
79-
->willReturn($filterType);
79+
->willReturnOnConsecutiveCalls(
80+
$filterType,
81+
['userDefined' => $userDefined],
82+
$filterType,
83+
['userDefined' => $userDefined]
84+
);
8085
$columnInterface->expects($this->atLeastOnce())->method('getName')->willReturn($componentName);
8186
$columnInterface->expects($this->once())->method('getConfiguration')->willReturn($componentConfig);
8287
$filterComponent = $this->getMockBuilder(UiComponentInterface::class)
@@ -87,7 +92,7 @@ public function testUpdate(string $filterType, string $filterName)
8792
->willReturnSelf();
8893
$filterComponent->expects($this->once())->method('prepare')->willReturnSelf();
8994
$this->uiComponentFactory->expects($this->once())->method('create')
90-
->with($componentName, $filterName, ['context' => $this->context])
95+
->with($componentName, $filterName, ['context' => $this->context, 'userDefined' => $userDefined])
9196
->willReturn($filterComponent);
9297

9398
$this->filters->update($columnInterface);
@@ -101,8 +106,8 @@ public function testUpdate(string $filterType, string $filterName)
101106
public static function updateDataProvider(): array
102107
{
103108
return [
104-
['text', 'filterInput'],
105-
['datetimeRange', 'filterDate'],
109+
['text', 'filterInput', false],
110+
['datetimeRange', 'filterDate', true],
106111
];
107112
}
108113
}

0 commit comments

Comments
 (0)