Skip to content

Commit 7d9180b

Browse files
committed
Reverted AC-2442
1 parent 73f4efe commit 7d9180b

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public function testPrepareDataSource(
7676
array $dataSource,
7777
string $currencyCode,
7878
?int $expectedStoreId = null
79-
): void {
79+
): void
80+
{
8081
$itemName = 'itemName';
8182
$oldItemValue = 'oldItemValue';
8283
$newItemValue = 'newItemValue';
@@ -158,24 +159,11 @@ public function testPrepareDataSourceDataProvider(): array
158159
]
159160
]
160161
];
161-
$dataSource5 = [
162-
'data' => [
163-
'items' => [
164-
[
165-
'itemName' => 'oldItemValue',
166-
'store_id' => '123Test',
167-
'base_currency_code' => '',
168-
]
169-
]
170-
]
171-
];
172-
173162
return [
174163
[true, $dataSource1, 'US'],
175164
[false, $dataSource2, 'SAR'],
176165
[false, $dataSource3, 'SAR', 2],
177166
[false, $dataSource4, 'SAR'],
178-
[false, $dataSource5, 'INR'],
179167
];
180168
}
181169
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,15 @@ public function prepareDataSource(array $dataSource)
7676
{
7777
if (isset($dataSource['data']['items'])) {
7878
foreach ($dataSource['data']['items'] as & $item) {
79-
$currencyCode = $item['base_currency_code'] ?? null;
80-
79+
$currencyCode = isset($item['base_currency_code']) ? $item['base_currency_code'] : null;
8180
if (!$currencyCode) {
82-
$itemStoreId = $item['store_id'] ?? '';
83-
$storeId = (int)$itemStoreId;
84-
$storeId = $storeId && ($storeId == $itemStoreId) ? $storeId :
81+
$storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] :
8582
$this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID);
86-
$store = $this->storeManager->getStore($storeId);
83+
$store = $this->storeManager->getStore(
84+
$storeId
85+
);
8786
$currencyCode = $store->getBaseCurrency()->getCurrencyCode();
8887
}
89-
9088
$basePurchaseCurrency = $this->currency->load($currencyCode);
9189
$item[$this->getData('name')] = $basePurchaseCurrency
9290
->format($item[$this->getData('name')], [], false);

0 commit comments

Comments
 (0)