Skip to content

Commit 7b9e802

Browse files
committed
ACP2E-1775: Dialog box error message when submitting comment in Order Details page
1 parent a047c76 commit 7b9e802

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function execute()
4040
try {
4141
$data = $this->getRequest()->getPost('history');
4242
if (empty($data['comment']) && $data['status'] == $order->getDataByKey('status')) {
43-
throw new \Magento\Framework\Exception\LocalizedException(
44-
__('The comment is missing. Enter and try again.')
45-
);
43+
$error = 'Please provide a comment text or ' .
44+
'update the order status to be able to submit a comment for this order.';
45+
throw new \Magento\Framework\Exception\LocalizedException(__($error));
4646
}
4747

4848
$orderStatus = $this->getOrderStatus($order->getDataByKey('status'), $data['status']);

app/code/Magento/Sales/i18n/en_US.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,3 +808,5 @@ If set YES Email field will be required during Admin order creation for new Cust
808808
"This creditmemo no longer exists.","This creditmemo no longer exists."
809809
"Add to address book","Add to address book"
810810
"Logo for PDF Print-outs","Logo for PDF Print-outs"
811+
"Please provide a comment text or update the order status to be able to submit a comment for this order.", "Please provide a comment text or update the order status to be able to submit a comment for this order."
812+
"A status change or comment text is required to submit a comment.", "A status change or comment text is required to submit a comment."

app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
cols="5"
3737
id="history_comment"
3838
class="admin__control-textarea"></textarea>
39+
<div class="admin__field-note">
40+
<span>
41+
<?= $block->escapeHtml(__(
42+
'A status change or comment text is required to submit a comment.'
43+
)) ?>
44+
</span>
45+
</div>
3946
</div>
4047
</div>
4148

0 commit comments

Comments
 (0)