Closed Nuranto closed 2 months ago
Hi @Nuranto. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://fe74e6b08484c0858eb929e57e74a885.instances-prod.magento-community.engineering Admin access: https://fe74e6b08484c0858eb929e57e74a885.instances-prod.magento-community.engineering/admin_f188 Login: 64dd48de Password: 68a200a92f49
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://fe74e6b08484c0858eb929e57e74a885.instances-prod.magento-community.engineering Admin access: https://fe74e6b08484c0858eb929e57e74a885.instances-prod.magento-community.engineering/admin_058a Login: 60dbf855 Password: 7a60f5716929
Hi @Nuranto
Thanks for reporting and collaboration.
Can you please provide detailed steps to reproduce with screenshots which would help us reproduce the issue accurately
Thanks!
Hi @Nuranto
Verified the issue in 2.4.7 and 2.4 dev instances.
But I am seeing only processing and suspend fraud options in order status after generating invoice.
Please refer to the screenshots. Let us know if we are missing anything.
I added a custom status on your temporary env.
As you can see in the code :
private function getOrderStatus(string $orderStatus, string $historyStatus): string
{
return ($orderStatus === Order::STATE_PROCESSING || $orderStatus === Order::STATUS_FRAUD) ? $historyStatus
: $orderStatus;
}
We can update status, but only if current status is processing or fraud.
Hi @Nuranto
Thanks for reporting and collaboration.
Verified the issue on magento 2.4 dev and 2.4.7 instances and the issue is reproducible. Hence, we are confirming the issue.
We are able to update the status only if the current status is in a processing or fraud state. If the status is anything other than processing or fraud state we are not able to update the status.
Please refer the attached screen recording.
https://github.com/magento/magento2/assets/60198592/6b72cbc4-fdc1-4b7c-b09c-48d80e667aba
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11877 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-11877
Related to the order status update, this commit https://github.com/magento/magento2/commit/632f253106e0a2d68cbf0b5a58b12eeeb0a014bf also involves integration with Bling Erp. This integration updates the order via comment.
We have the same error in our Magento instances. Is there already a patch?
I used a workaround and sharing it so it can be helpful to anyone:
Create app/code/DevStone/Bugfix/Controller/Adminhtml/Order/AddComment.php
<?php
namespace DevStone\Bugfix\Controller\Adminhtml\Order;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Sales\Model\Order\Email\Sender\OrderCommentSender;
/**
* Class AddComment
*
* Controller responsible for addition of the order comment to the order
*/
class AddComment extends \Magento\Sales\Controller\Adminhtml\Order implements HttpPostActionInterface
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
public const ADMIN_RESOURCE = 'Magento_Sales::comment';
/**
* ACL resource needed to send comment email notification
*/
public const ADMIN_SALES_EMAIL_RESOURCE = 'Magento_Sales::emails';
/**
* Add order comment action
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$order = $this->_initOrder();
if ($order) {
try {
$data = $this->getRequest()->getPost('history');
if (empty($data['comment']) && $data['status'] == $order->getDataByKey('status')) {
$error = 'Please provide a comment text or ' .
'update the order status to be able to submit a comment for this order.';
throw new \Magento\Framework\Exception\LocalizedException(__($error));
}
$order->setStatus($data['status']);
$notify = $data['is_customer_notified'] ?? false;
$visible = $data['is_visible_on_front'] ?? false;
if ($notify && !$this->_authorization->isAllowed(self::ADMIN_SALES_EMAIL_RESOURCE)) {
$notify = false;
}
$comment = trim(strip_tags($data['comment']));
$history = $order->addStatusHistoryComment($comment, $data['status']);
$history->setIsVisibleOnFront($visible);
$history->setIsCustomerNotified($notify);
$history->save();
$order->save();
/** @var OrderCommentSender $orderCommentSender */
$orderCommentSender = $this->_objectManager
->create(\Magento\Sales\Model\Order\Email\Sender\OrderCommentSender::class);
$orderCommentSender->send($order, $notify, $comment);
return $this->resultPageFactory->create();
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$response = ['error' => true, 'message' => $e->getMessage()];
} catch (\Exception $e) {
$response = ['error' => true, 'message' => __('We cannot add order history.')];
}
if (is_array($response)) {
$resultJson = $this->resultJsonFactory->create();
$resultJson->setData($response);
return $resultJson;
}
}
return $this->resultRedirectFactory->create()->setPath('sales/*/');
}
}
Create app/code/DevStone/Bugfix/etc/di.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Controller\Adminhtml\Order\AddComment" type="DevStone\Bugfix\Controller\Adminhtml\Order\AddComment" />
</config>
Of course update the paths and namespace to match an existing module you may have or create a new one with the usual module.xml and registration.php
This will revert the behavior to pre 2.4.7
Issue can be reproduced with 2.4.7-p1
If anyone is trying to find the respective lines in their local Magento instance, it's at the end of magento/vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment.php
Something like this should work too
cat patches/github-issue-38659_cannot-update-orderstatus-magento-2-4-7.diff
diff --git a/vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment.php b/vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment.php
index ea8af5828c..34608db2bd 100644
--- a/vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment.php 2024-06-29 09:53:19.997829986 +0200
+++ b/vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment.php 2024-06-29 10:15:35.983809521 +0200
@@ -91,7 +91,12 @@
*/
private function getOrderStatus(string $orderStatus, string $historyStatus): string
{
- return ($orderStatus === Order::STATE_PROCESSING || $orderStatus === Order::STATUS_FRAUD) ? $historyStatus
- : $orderStatus;
+ // BUGFIX for https://github.com/magento/magento2/issues/38659
+ return $historyStatus;
+
+
+// return ($orderStatus === Order::STATE_PROCESSING || $orderStatus === Order::STATUS_FRAUD) ? $historyStatus
+// : $orderStatus;
+
}
}
cat magento/composer.json
...
"extra": {
"magento-force": "override",
"enable-patching": true,
"composer-exit-on-patch-failure": true,
"patches": {
...
"magento/module-sales": {
"fix Magento 2.4.7 can not set update order status": "patches/github-issue-38659_cannot-update-orderstatus-magento-2-4-7.diff"
}
}
}
Nothing seems to have happend with the pull request #38659 in all of May and all of June. While absolutely basic functionality is broken for all users out there.
Checked out the pull request and basically 1 static code analyser complained that the @param coment wasn't updated to reflect the new method signature and some unit test where $order->config is null failed. Probably because the unit test didn't set it up with proper values. All the other automatic test failures look like the codebase the PR was applied to was already broken.
The initial author hasn't responded in 2 month, no other developer picked it up and to do it yourself Adobe wants you to jump through even more (legal) hoops then you already have to in order to clone the repository, check it out, do your branch and create a new PR. No time for that.
Having same issue with 2.4.7 - Need solution soon have to send email for every process to update customers.
Having same issue. Major functionality broken. Issue been open for nearly 2 months. Fixes like this are taking far too long to review/release. I am not sure why we always need 100's of fixes in each release; it shouldn't be a huge deal to release a 2.4.7.1, 2.4.7.2, etc. with a couple dozen critical fixes.
@magento I am working on this
is there any patch or hotfix? this is quite important as many integrations (incl. payment) are failing that are using the comment api for webhooks etc
The order state should be checked rather than the status to begin with; no clue how this got greenlit.
You can make custom order statuses for a singular order state. With the changes that have been made it's impossible to change order status after it's been set.
You should be able to switch freely between order statuses for the same order state.
This needs to be rectified ASAP.
edit: In fact; since only the statuses for the current state are displayed, it should be impossible to enter an incorrect status...
Almost four months since the bug was reported... is there any hope that a patch will be released soon?
We are also waiting for a patch for this issue.
I haven't seen it yet, but does 2.4.7-p2 solve this?
At least the patch was still applied by Compose.
As you can see here, even the current 2.4 development branch doesn't have a fix yet. https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php#L94
in a quick solution for an integration here, i just removed this code from that file.
vendor/magento/module-sales/Model/Service/OrderService.php
/**
Internal team is working on this issue
Any update on issue? We are using Magento 2.4.7.
The internal team already fixed this issue. Currently, in delivery queue.
The internal team already fixed this issue. Currently, in delivery queue.
So what about tagging this ticket with the milestone/release it is intended for?
The internal team already fixed this issue. Currently, in delivery queue.
So what about tagging this ticket with the milestone/release it is intended for?
we can determine relese when the code changes will be delivered, since they are in delivery process and not delivered yet we can't specify release which will contain the changes
@hostep Yes
Hi,
As per this comment https://github.com/magento/magento2/issues/38917#issuecomment-2348086896 we are closing this issue.
Thanks.
No milestone = release set?
Based on the Jira ticket, the target version is 2.4.8-beta1.
Source: https://github.com/magento/magento2/issues/38917#issuecomment-2348086896
same issue here on 2.4.7-p2
Preconditions and environment
Steps to reproduce
Expected result
Status updated
Actual result
Status not updated
Additional information
I don't understand this change introduced in 2.4.7 : https://github.com/magento/magento2/issues/36562
Why would we be able to change status only if current status is processing or fraud ? (Also,
Order::STATE_PROCESSING
instead ofOrder::STATUS_PROCESSING
)If I understand correctly the issue #36562, the fix should be something like this instead :
Or am I missing something ?
Release note
No response
Triage and priority