Skip to content

Commit 39121b0

Browse files
committed
ACP2E-56 : [On Prem] Magento invoice order date filter not working
1 parent 4dad4bc commit 39121b0

File tree

2 files changed

+8
-38
lines changed

2 files changed

+8
-38
lines changed

app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public function aroundAddFieldToFilter(
4444
$field,
4545
$condition = null
4646
) {
47-
$fieldMap = $this->getFilterFieldsMap();
48-
$fieldName = $fieldMap['fields'][$field] ?? null;
49-
if (!$fieldName) {
50-
return $proceed($field, $condition);
51-
}
5247

5348
if ($field === 'created_at' || $field === 'order_created_at') {
5449
if (is_array($condition)) {
@@ -64,21 +59,6 @@ public function aroundAddFieldToFilter(
6459
return $subject;
6560
}
6661

67-
return $proceed();
68-
}
69-
70-
/**
71-
* Map the columns needs to filter out
72-
*
73-
* @return \string[][]
74-
*/
75-
private function getFilterFieldsMap(): array
76-
{
77-
return [
78-
'fields' => [
79-
'created_at' => 'main_table.created_at',
80-
'order_created_at' => 'main_table.order_created_at',
81-
],
82-
];
62+
return $proceed($field, $condition);
8363
}
8464
}

dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function setUp(): void
5151
$this->objectManager = Bootstrap::getObjectManager();
5252
$this->timeZone = $this->objectManager->get(TimezoneInterface::class);
5353
$this->proceed = function () {
54-
$this->proceed;
54+
$this->proceed;
5555
};
5656
$this->plugin = $this->objectManager->create(
5757
OrderGridCollectionFilter::class,
@@ -82,7 +82,12 @@ public function testAroundAddFieldToFilter($mainTable, $resourceModel, $field):
8282
'resourceModel' => $resourceModel
8383
]
8484
);
85-
$result = $this->plugin->aroundAddFieldToFilter($this->searchResult, $this->proceed, $field, ['qteq' => $filterDate]);
85+
$result = $this->plugin->aroundAddFieldToFilter(
86+
$this->searchResult,
87+
$this->proceed,
88+
$field,
89+
['qteq' => $filterDate]
90+
);
8691

8792
$expectedSelect = "SELECT `main_table`.* FROM `{$mainTable}` AS `main_table` " .
8893
"WHERE (((`{$field}` = '{$convertedDate}')))";
@@ -93,21 +98,6 @@ public function testAroundAddFieldToFilter($mainTable, $resourceModel, $field):
9398
/**
9499
* @return array
95100
*/
96-
public function getCollectionFiltersDataProvider2(): array
97-
{
98-
return [
99-
'shipment_grid_collection_for_created_at' => [
100-
'mainTable' => 'sales_shipment_grid',
101-
'resourceModel' => Shipment::class,
102-
'field' => 'created_at',
103-
],
104-
'shipment_grid_collection_for_order_created_at' => [
105-
'mainTable' => 'sales_shipment_grid',
106-
'resourceModel' => Shipment::class,
107-
'field' => 'order_created_at',
108-
]
109-
];
110-
}
111101
public function getCollectionFiltersDataProvider(): array
112102
{
113103
return [

0 commit comments

Comments
 (0)