Skip to content

Commit f675c08

Browse files
committed
Merge remote-tracking branch 'origin/BUG#AC-2664' into Hammer_Quality_Backlog_GraphQl_13042022
2 parents d8bd717 + f406686 commit f675c08

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ public function testPrepareDataSource(
7676
array $dataSource,
7777
string $currencyCode,
7878
?int $expectedStoreId = null
79-
): void
80-
{
79+
): void {
8180
$itemName = 'itemName';
8281
$oldItemValue = 'oldItemValue';
8382
$newItemValue = 'newItemValue';
@@ -159,11 +158,24 @@ public function testPrepareDataSourceDataProvider(): array
159158
]
160159
]
161160
];
161+
$dataSource5 = [
162+
'data' => [
163+
'items' => [
164+
[
165+
'itemName' => 'oldItemValue',
166+
'store_id' => '123Test',
167+
'base_currency_code' => '',
168+
]
169+
]
170+
]
171+
];
172+
162173
return [
163174
[true, $dataSource1, 'US'],
164175
[false, $dataSource2, 'SAR'],
165176
[false, $dataSource3, 'SAR', 2],
166177
[false, $dataSource4, 'SAR'],
178+
[false, $dataSource5, 'INR'],
167179
];
168180
}
169181
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function prepareDataSource(array $dataSource)
7676
{
7777
if (isset($dataSource['data']['items'])) {
7878
foreach ($dataSource['data']['items'] as & $item) {
79-
$currencyCode = isset($item['base_currency_code']) ? $item['base_currency_code'] : null;
79+
$currencyCode = $item['base_currency_code'] ?? null;
80+
8081
if (!$currencyCode) {
81-
$storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] :
82+
$itemStoreId = $item['store_id'] ?? '';
83+
$storeId = $itemStoreId && is_numeric($itemStoreId) ? $itemStoreId :
8284
$this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID);
83-
$store = $this->storeManager->getStore(
84-
$storeId
85-
);
85+
$store = $this->storeManager->getStore($storeId);
8686
$currencyCode = $store->getBaseCurrency()->getCurrencyCode();
8787
}
8888
$basePurchaseCurrency = $this->currency->load($currencyCode);

0 commit comments

Comments
 (0)