Skip to content

Commit f09c222

Browse files
committed
Merge branch 'fix-issue-36719' of https://github.com/ananth-iyer/magento2 into ACP2E-2944
2 parents 488c103 + 01199a4 commit f09c222

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function aroundAddFieldToFilter(
5555
}
5656
}
5757

58-
$fieldName = $subject->getConnection()->quoteIdentifier($field);
58+
$fieldName = $subject->getConnection()->quoteIdentifier('main_table.' . $field);
5959
$condition = $subject->getConnection()->prepareSqlCondition($fieldName, $condition);
6060
$subject->getSelect()->where($condition, null, Select::TYPE_CONDITION);
6161

app/code/Magento/Sales/etc/adminhtml/di.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,18 @@
4949
</arguments>
5050
<plugin name="orderGridExportFilterColumnPlugin" type="Magento\Sales\Plugin\Model\Export\OrderGridExportFilterColumn"/>
5151
</type>
52-
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
52+
<type name="Magento\Sales\Model\ResourceModel\Order\Grid\Collection">
5353
<plugin name="orderGridCollectionFilterPlugin" type="Magento\Sales\Plugin\Model\ResourceModel\Order\OrderGridCollectionFilter"/>
5454
</type>
55+
<type name="Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection">
56+
<plugin name="invoiceGridCollectionFilterPlugin" type="Magento\Sales\Plugin\Model\ResourceModel\Order\OrderGridCollectionFilter"/>
57+
</type>
58+
<type name="Magento\Sales\Model\ResourceModel\Order\Creditmemo\Order\Grid\Collection">
59+
<plugin name="creditmemoGridCollectionFilterPlugin" type="Magento\Sales\Plugin\Model\ResourceModel\Order\OrderGridCollectionFilter"/>
60+
</type>
61+
<type name="Magento\Sales\Model\ResourceModel\Order\Shipment\Order\Grid\Collection">
62+
<plugin name="shipmentGridCollectionFilterPlugin" type="Magento\Sales\Plugin\Model\ResourceModel\Order\OrderGridCollectionFilter"/>
63+
</type>
5564
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider\ProductCollection">
5665
<arguments>
5766
<argument name="collectionFactory" xsi:type="object">\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory</argument>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public function testAroundAddFieldToFilter($mainTable, $resourceModel, $field, $
8080

8181
if ($mainTable == 'sales_order_grid') {
8282
$condition = ['from' => $fieldValue , 'locale' => "en_US", 'datetime' => true];
83-
$selectCondition = "WHERE (`{$field}` >= '{$convertedDate}')";
83+
$selectCondition = "WHERE (`main_table`.`{$field}` >= '{$convertedDate}')";
8484
} else {
8585
$condition = ['qteq' => $fieldValue];
86-
$selectCondition = "WHERE (((`{$field}` = '{$convertedDate}')))";
86+
$selectCondition = "WHERE (((`main_table`.`{$field}` = '{$convertedDate}')))";
8787
}
8888

8989
$this->searchResult = $this->objectManager->create(

0 commit comments

Comments
 (0)