Skip to content

Commit 07f0fad

Browse files
committed
MC-23915: Wrong currency symbol in creditmemo_grid & sales_order_view > creditmemo grid for subtotal & Shipping and Handling fee
1 parent af8443c commit 07f0fad

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/PurchasedPriceTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ class PurchasedPriceTest extends TestCase
2222
/**
2323
* @var Price
2424
*/
25-
protected $model;
25+
private $model;
2626

2727
/**
2828
* @var Currency|MockObject
2929
*/
30-
protected $currencyMock;
30+
private $currencyMock;
3131

3232
/**
3333
* @var OrderRepositoryInterface|MockObject
3434
*/
35-
protected $orderMock;
35+
private $orderRepository;
3636

3737
protected function setUp(): void
3838
{
@@ -47,7 +47,7 @@ protected function setUp(): void
4747
->setMethods(['load', 'format'])
4848
->disableOriginalConstructor()
4949
->getMock();
50-
$this->orderMock = $this->getMockBuilder(OrderRepositoryInterface::class)
50+
$this->orderRepository = $this->getMockBuilder(OrderRepositoryInterface::class)
5151
->setMethods(['getList','get','delete','save','getOrderCurrencyCode'])
5252
->disableOriginalConstructor()
5353
->getMock();
@@ -56,7 +56,7 @@ protected function setUp(): void
5656
[
5757
'currency' => $this->currencyMock,
5858
'context' => $contextMock,
59-
'order' => $this->orderMock,
59+
'order' => $this->orderRepository,
6060
]
6161
);
6262
}
@@ -90,10 +90,10 @@ public function testPrepareDataSource(
9090
$currencyCode = $dataSource['data']['items'][0]['order_currency_code'];
9191
} else {
9292
$currencyCode = 'FR';
93-
$this->orderMock->expects($this->once())
93+
$this->orderRepository->expects($this->once())
9494
->method('get')
9595
->willReturnSelf();
96-
$this->orderMock->expects($this->once())
96+
$this->orderRepository->expects($this->once())
9797
->method('getOrderCurrencyCode')
9898
->willReturn($currencyCode);
9999
}

app/code/Magento/Sales/Ui/Component/Listing/Column/PurchasedPrice.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PurchasedPrice extends Column
3232
/**
3333
* @var OrderRepositoryInterface
3434
*/
35-
private $order;
35+
private $orderRepository;
3636

3737
/**
3838
* Constructor
@@ -43,7 +43,7 @@ class PurchasedPrice extends Column
4343
* @param array $components
4444
* @param array $data
4545
* @param Currency $currency
46-
* @param OrderRepositoryInterface $order
46+
* @param OrderRepositoryInterface $orderRepository
4747
*/
4848
public function __construct(
4949
ContextInterface $context,
@@ -52,12 +52,12 @@ public function __construct(
5252
array $components = [],
5353
array $data = [],
5454
Currency $currency = null,
55-
OrderRepositoryInterface $order = null
55+
OrderRepositoryInterface $orderRepository = null
5656
) {
5757
$this->priceFormatter = $priceFormatter;
5858
$this->currency = $currency ?: \Magento\Framework\App\ObjectManager::getInstance()
5959
->create(Currency::class);
60-
$this->order = $order ?: \Magento\Framework\App\ObjectManager::getInstance()
60+
$this->orderRepository = $orderRepository ?: \Magento\Framework\App\ObjectManager::getInstance()
6161
->create(OrderRepositoryInterface::class);
6262
parent::__construct($context, $uiComponentFactory, $components, $data);
6363
}
@@ -72,9 +72,8 @@ public function prepareDataSource(array $dataSource)
7272
{
7373
if (isset($dataSource['data']['items'])) {
7474
foreach ($dataSource['data']['items'] as & $item) {
75-
$currencyCode = isset($item['order_currency_code'])
76-
? $item['order_currency_code']
77-
: $this->order->get($item['order_id'])->getOrderCurrencyCode();
75+
$currencyCode = $item['order_currency_code']
76+
?? $this->orderRepository->get($item['order_id'])->getOrderCurrencyCode();
7877
$purchaseCurrency = $this->currency->load($currencyCode);
7978
$item[$this->getData('name')] = $purchaseCurrency
8079
->format($item[$this->getData('name')], [], false);

0 commit comments

Comments
 (0)