For shop administrators (non site admins) the order status column is empty on the view orders page (admin/store/orders/view).

This is because Views require a field to have an AccessResult::allowed() to show it. The access() method is not implemented yet for the uc_order_status entity type. Implementing it solves the problem.

Please review / commit patch.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

bjaxelsen created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, order_status_access.patch, failed testing.

bjaxelsen’s picture

the failing test (product kit discounts) appears to be unrelated to the patch

The last submitted patch, order_status_access.patch, failed testing.

TR’s picture

Status: Needs work » Needs review
david.czinege’s picture

I tested the uploaded patch. When i wanted to see my order history with an authenticated user, i got a fatal error:

Fatal error: Call to a member function isAllowed() on null in /var/www/drupalvm/drupal/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php on line 58

You can try this if you visit for example te next page:
/user/10/orders

I rewrite the patch, and I added the view own orders permission also.

Please review it.

longwave’s picture

Status: Needs review » Needs work

I think instead we need an OrderStatusAccessControlHandler class that extends EntityAccessControlHandler and performs permission checks for view, create, update and delete.

bjaxelsen’s picture

Updated patch

david.czinege’s picture

Status: Needs work » Needs review
FileSize
2.63 KB

I have created the OrderStatusAccessControlHandler class and set it as access handler for the OrderStatus configuration entity.

david.czinege’s picture

I updated the OrderTest's testOrderCustomerView test case.

Now, in that test case, the order's status is updated to pending, so the user can see the order on the My order history page. I also added a new assertText assertion, which search for the Pending text.

Now i am uploading a patch, which only contains the updated test case, so this patch should fail.

Status: Needs review » Needs work

The last submitted patch, 10: 2770411-order-status-access-10-test-only.patch, failed testing.

david.czinege’s picture

Status: Needs work » Needs review
FileSize
3.52 KB

My previous patch, witch contains only the updated test case, has successfully failed.
Now i upload the a new patch, which contains the updated test case and the bug fix.

This should pass.

TR’s picture

Rerolled patch #12 with minor coding standards changes.
Testbot will show one failure in the uc_tax test, caused by a regression in core Drupal 8.5.x. The test still works in core 8.4.x.

Status: Needs review » Needs work

The last submitted patch, 13: 2770411-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • TR committed dcc5f6c on 8.x-4.x authored by david.czinege
    Issue #2770411 by david.czinege, bjaxelsen: Order status invisible on...
TR’s picture

Status: Needs work » Fixed

Committed #13. Thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.