Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestAPI add order comment without providing status sets status to NULL, preventing from showing in order grid #34180

Closed
1 of 5 tasks
edward-simpson opened this issue Sep 28, 2021 · 14 comments
Assignees
Labels
Area: APIs Area: Order Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Component: Order grid Component: order status Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@edward-simpson
Copy link
Contributor

edward-simpson commented Sep 28, 2021

Preconditions (*)

  1. Magento 2.3.x, 2.4.x
  2. Existing order to add comments to

Steps to reproduce (*)

  1. Using the orders/{id}/comments endpoint, POST a new comment, but exclude "status" field (as is not required)
  2. Check the order in the sales_order, sales_order_grid database tables
  3. Check the order in the admin > Sales > order grid and Front-end -Customer login > My Orders page

Expected result (*)

  1. Order should maintain existing status
  2. Order should appear in adminhtml order grid and Front-end - My Orders page

Actual result (*)

  1. Order gets status set to NULL
  2. Order no longer appears in adminhtml order grid
  3. Order no longer appears in front-end - My Orders page

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@edward-simpson
Copy link
Contributor Author

Occurs because \Magento\Sales\Model\Order::addStatusHistory used in API call does not check if provided $history param has status set before using it:

$this->setStatus($history->getStatus());

I would create a PR to fix this but a decision needs to be made whether to either:

  • Make the rest API endpoint's "status" parameter required
  • Modify the addStatusHistory method to check for status before setting
  • Potentially use addStatusHistoryComment instead? Although I guess this would remove the option to add a status/other history

@engcom-November engcom-November self-assigned this Sep 28, 2021
@m2-assistant
Copy link

m2-assistant bot commented Sep 28, 2021

Hi @engcom-November. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Verified the issue on Magento 2.4-develop branch and the issue is reproducible:

Steps performed:
Created Order from front-end for a logged in customer using check/money Order. Order status is "Pending"
Sent POST request to generate admin access token using: /rest/default/V1/integration/admin/token
Sent POST request to /rest/V1/orders/15/comments to update comments for existing order using below sample payload:
{ "statusHistory": { "comment": "my api comment", "created_at": "2021-09-29 12:45:40", "entity_id": 15, "is_visible_on_front": 1 } }
Issue: Order status is becoming NULL in "sales_order" table and "sales_order_grid" table
Order is not getting displayed on Front-end - My Orders page
Admin - View Order - Comment is also not added.
image

image

@engcom-November engcom-November added Area: Order Component: order status Component: Order grid Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: APIs Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Sep 29, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Sep 29, 2021
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-1342 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Sep 29, 2021

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Alfa engcom-Alfa added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 4, 2021
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Oct 4, 2021
@bireney
Copy link

bireney commented Jan 18, 2022

Assign to me

@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Jan 19, 2022
@m2-community-project m2-community-project bot added Progress: PR in progress Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. and removed Progress: ready for dev labels Jan 19, 2022
@koushikch7
Copy link

Assign to me

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Mar 9, 2023
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Mar 9, 2023
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Mar 13, 2023
@yogesh-valiya
Copy link
Member

@magento assign this to me

@yogesh-valiya
Copy link
Member

@magento I'm working on this

@m2-community-project m2-community-project bot added Progress: dev in progress and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Mar 16, 2023
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Mar 16, 2023
@github-jira-sync-bot github-jira-sync-bot added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Mar 20, 2023
@glo05363
Copy link
Contributor

glo05363 commented Mar 20, 2023

@yogesh-valiya @koushikch7
It will be taken care into one of the Internal JIRA ticket. Once Internal PR will get merged, we will notify.

Thank you!

@yogesh-valiya
Copy link
Member

@glo05363

I'm just repeating myself as this comment on 😞 - #36800 (comment)

When I started working on this issue, the issue wasn't assigned to anyone. If the internal team was addressing the issue, may I inquire as to why it had not been assigned to someone specifically?

It's frequent, where an individual is working on a particular issue and raises a pull request, only to find out that there is already a pull request from the internal team in progress.

In light of this, I question the value of the effort put forth to resolve the issue. Could you clarify why the pull request is not linked to the issue if it is already in progress?

@glo05363
Copy link
Contributor

@glo05363

I'm just repeating myself as this comment on 😞 - #36800 (comment)

When I started working on this issue, the issue wasn't assigned to anyone. If the internal team was addressing the issue, may I inquire as to why it had not been assigned to someone specifically?

It's frequent, where an individual is working on a particular issue and raises a pull request, only to find out that there is already a pull request from the internal team in progress.

In light of this, I question the value of the effort put forth to resolve the issue. Could you clarify why the pull request is not linked to the issue if it is already in progress?

I see your concern yogesh, Internal Team make sure to change status as per need, In this issue You will find above changes as PR:created by JIra-Sync_bot before you have tried to assign the same to yourself.
Irrespective of that we will make sure to be more clear in terms of adding comment.
As i can see the changes proposed in PR will not suffice , we will take care of the same in internal JIRA.
We highly appreciate all the efforts in community, Internal PRs will not be linked here, once it is merged it will be available.

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Apr 18, 2023
@m2-community-project m2-community-project bot removed Progress: PR Created Indicates that Pull Request has been created to fix issue Progress: PR in progress labels Apr 18, 2023
@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Apr 18, 2023

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-1342 by the internal team
Related commits: https://github.com/magento/magento2/search?q=AC-1342&type=commits

Based on the Jira ticket, the target version is 2.4.7-beta1.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: APIs Area: Order Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Component: Order grid Component: order status Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
10 participants