Skip to content

Commit 217cda3

Browse files
committed
ACP2E-56 : [On Prem] Magento invoice order date filter not working
1 parent 7c9fd81 commit 217cda3

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

app/code/Magento/Sales/Model/ResourceModel/Order/CollectionFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CollectionFilter extends SearchResult
1818
/**
1919
* @var TimezoneInterface
2020
*/
21-
private $timeZone;
21+
private TimezoneInterface $timeZone;
2222

2323
/**
2424
* Initialize dependencies.

app/code/Magento/Sales/Model/ResourceModel/Order/Invoice/Grid/CollectionFilter.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CollectionFilter extends SearchResult
2222
/**
2323
* @var TimezoneInterface
2424
*/
25-
private $timeZone;
25+
private TimezoneInterface $timeZone;
2626

2727
/**
2828
* Initialize dependencies.
@@ -55,9 +55,10 @@ public function _initSelect()
5555
{
5656
parent::_initSelect();
5757

58-
$tableDescription = $this->getConnection()->describeTable($this->getMainTable());
59-
if ($tableDescription) {
60-
foreach ($tableDescription as $columnInfo) {
58+
$invoiceTableDescription = $this->getConnection()->describeTable($this->getMainTable());
59+
60+
if ($invoiceTableDescription) {
61+
foreach ($invoiceTableDescription as $columnInfo) {
6162
$this->addFilterToMap($columnInfo['COLUMN_NAME'], 'main_table.'.$columnInfo['COLUMN_NAME']);
6263
}
6364
}
@@ -68,16 +69,16 @@ public function _initSelect()
6869
/**
6970
* @inheritDoc
7071
*/
71-
public function addFieldToFilter($field, $condition = null)
72+
public function addFieldToFilter($column, $condition = null)
7273
{
73-
if ($field === 'created_at' || $field === 'order_created_at') {
74+
if ($column === 'created_at' || $column === 'order_created_at') {
7475
if (is_array($condition)) {
7576
foreach ($condition as $key => $value) {
7677
$condition[$key] = $this->timeZone->convertConfigTimeToUtc($value);
7778
}
7879
}
7980
}
8081

81-
return parent::addFieldToFilter($field, $condition);
82+
return parent::addFieldToFilter($column, $condition);
8283
}
8384
}

dev/tests/integration/testsuite/Magento/Cms/Model/ResourceModel/Block/Grid/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testAddFieldToFilter($field): void
5151

5252
$collection = $gridCollection->addFieldToFilter($field, ['qteq' => $filterDate]);
5353
$expectedSelect = "SELECT `main_table`.* FROM `cms_block` AS `main_table` " .
54-
"WHERE ((((`{$field}` = '{$convertedDate}')))) AND (main_table.created_in <= 1) AND (main_table.updated_in > 1)";
54+
"WHERE (((`{$field}` = '{$convertedDate}')))";
5555

5656
$this->assertEquals($expectedSelect, $collection->getSelectSql(true));
5757
}

dev/tests/integration/testsuite/Magento/Cms/Model/ResourceModel/Page/Grid/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testAddFieldToFilter($field): void
5151

5252
$collection = $gridCollection->addFieldToFilter($field, ['qteq' => $filterDate]);
5353
$expectedSelect = "SELECT `main_table`.* FROM `cms_page` AS `main_table` " .
54-
"WHERE ((((`{$field}` = '{$convertedDate}')))) AND (main_table.created_in <= 1) AND (main_table.updated_in > 1)";
54+
"WHERE (((`{$field}` = '{$convertedDate}')))";
5555

5656
$this->assertEquals($expectedSelect, $collection->getSelectSql(true));
5757
}

0 commit comments

Comments
 (0)