Skip to content

Commit 0b0d98d

Browse files
authored
ENGCOM-6786: 17847 Fixed wrong state title #26569
2 parents 241fa71 + 47ae5a2 commit 0b0d98d

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

app/code/Magento/Sales/Block/Status/Grid/Column/State.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Sales\Block\Status\Grid\Column;
77

88
/**
9+
* Column State class
10+
*
911
* @api
1012
* @since 100.0.2
1113
*/
@@ -53,12 +55,15 @@ public function getFrameCallback()
5355
*/
5456
public function decorateState($value, $row, $column, $isExport)
5557
{
56-
$status = $row->getStatus();
57-
if ($value) {
58-
$cell = $value . '[' . $this->_config->getStateLabelByStateAndStatus($value, $status) . ']';
59-
} else {
60-
$cell = $value;
58+
$states = $this->_config->getStates();
59+
if (isset($states[$value])) {
60+
return sprintf(
61+
"%s[%s]",
62+
$value,
63+
$states[$value]
64+
);
6165
}
62-
return $cell;
66+
67+
return $value;
6368
}
6469
}

app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ public function testDecorateState()
5555
[
5656
'status' => 'fraud',
5757
'state' => 'processing',
58+
'is_default' => '0',
5859
'label' => 'Suspected Fraud',
5960
]
6061
),
6162
new \Magento\Framework\DataObject(
6263
[
6364
'status' => 'processing',
6465
'state' => 'processing',
66+
'is_default' => '1',
6567
'label' => 'Processing',
6668
]
6769
)
@@ -78,6 +80,6 @@ public function testDecorateState()
7880
->will($this->returnValue($statuses));
7981

8082
$result = $this->stateColumn->decorateState('processing', $rowMock, $columnMock, false);
81-
$this->assertSame('processing[Suspected Fraud]', $result);
83+
$this->assertSame('processing[Processing]', $result);
8284
}
8385
}

app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Sales\Model\ResourceModel\Order\Status\Collection;
1010

1111
/**
12-
* Class ConfigTest
12+
* Test for Magento\Sales\Model\Order\Config class
1313
*/
1414
class ConfigTest extends \PHPUnit\Framework\TestCase
1515
{

0 commit comments

Comments
 (0)