Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/imported-magento-magento2-31553'…
Browse files Browse the repository at this point in the history
… into 2.4-develop-pr120
  • Loading branch information
zakdma committed Jan 19, 2021
2 parents d5d5372 + 8417b88 commit 43a568e
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,32 @@ public function __construct(
) {
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
}

/**
* @inheritDoc
*/
protected function _translateCondition($field, $condition)
{
if ($field !== 'order_currency_code'
&& !isset($this->_map['fields'][$field])
) {
$this->_map['fields'][$field] = 'main_table.' . $field;
}

return parent::_translateCondition($field, $condition);
}

/**
* @inheritDoc
*/
protected function _renderFiltersBefore()
{
$this->getSelect()->joinLeft(
['cgf' => $this->getTable('sales_order_grid')],
'main_table.order_id = cgf.entity_id',
[
'order_currency_code' => 'order_currency_code',
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,32 @@ public function __construct(
) {
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
}

/**
* @inheritDoc
*/
protected function _translateCondition($field, $condition)
{
if ($field !== 'order_currency_code'
&& !isset($this->_map['fields'][$field])
) {
$this->_map['fields'][$field] = 'main_table.' . $field;
}

return parent::_translateCondition($field, $condition);
}

/**
* @inheritDoc
*/
protected function _renderFiltersBefore()
{
$this->getSelect()->joinLeft(
['cgf' => $this->getTable('sales_order_grid')],
'main_table.order_id = cgf.entity_id',
[
'order_currency_code' => 'order_currency_code',
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@
<visible>false</visible>
</settings>
</column>
<column name="subtotal" class="Magento\Sales\Ui\Component\Listing\Column\Price">
<column name="subtotal" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
<settings>
<filter>textRange</filter>
<label translate="true">Subtotal</label>
<visible>false</visible>
</settings>
</column>
<column name="shipping_and_handling" class="Magento\Sales\Ui\Component\Listing\Column\Price">
<column name="shipping_and_handling" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
<settings>
<filter>textRange</filter>
<label translate="true">Shipping &amp; Handling</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@
<visible>false</visible>
</settings>
</column>
<column name="subtotal" class="Magento\Sales\Ui\Component\Listing\Column\Price">
<column name="subtotal" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
<settings>
<filter>textRange</filter>
<label translate="true">Subtotal</label>
<visible>false</visible>
</settings>
</column>
<column name="shipping_and_handling" class="Magento\Sales\Ui\Component\Listing\Column\Price">
<column name="shipping_and_handling" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
<settings>
<filter>textRange</filter>
<label translate="true">Shipping &amp; Handling</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Sales\Model\ResourceModel\Order\Creditmemo\Grid;

use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;

/**
* Test Magento\Sales\Model\ResourceModel\Order\Creditmemo\Grid
*/
class CollectionTest extends TestCase
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;

/**
* @inheritDoc
*/
protected function setUp(): void
{
$this->objectManager = Bootstrap::getObjectManager();
}

/**
* @magentoDataFixture Magento/Sales/_files/creditmemo_list.php
*
* @return void
*/
public function testCollectionOrderCurrencyCodeExist(): void
{
/** @var $collection Collection */
$collection = $this->objectManager->get(Collection::class);
$collection->addFieldToFilter('increment_id', ['eq' => '456']);
foreach ($collection as $item) {
$this->assertNotNull($item->getOrderCurrencyCode());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Sales\Model\ResourceModel\Order\Creditmemo\Order\Grid;

use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;

/**
* Test Magento\Sales\Model\ResourceModel\Order\Creditmemo\Grid\Order\Grid
*/
class CollectionTest extends TestCase
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;

/**
* @inheritDoc
*/
protected function setUp(): void
{
$this->objectManager = Bootstrap::getObjectManager();
}

/**
* @magentoDataFixture Magento/Sales/_files/creditmemo_list.php
*
* @return void
*/
public function testCollectionOrderCurrencyCodeExist(): void
{
/** @var $collection Collection */
$collection = $this->objectManager->get(Collection::class);
$collection->addFieldToFilter('increment_id', ['eq' => '456']);
foreach ($collection as $item) {
$this->assertNotNull($item->getOrderCurrencyCode());
}
}
}

0 comments on commit 43a568e

Please sign in to comment.