Order Assign Event Error if not a ticket

Created on 10 November 2022, about 2 years ago
Updated 12 March 2024, 8 months ago

Problem/Motivation

If you have a product type that is not a ticket and you try to re assign it via commerce backend the subscriber
(onOrderAssign) will throw an error

Steps to reproduce

1) create normal default product that is not associated with tickets
2) Buy it and go through all checkout steps ...
this will be very hard if you don't have a payment gateway on your site but here is a patch for this ( https://www.drupal.org/project/commerce_ticketing/issues/3250757 📌 How to make the QR Code data configurable? Fixed )

3) as an admin user attempt to re assign the order at:
(admin/commerce/orders/YOUR-ORDERID-HERE/reassign)
see error

The website encountered an unexpected error. Please try again later.
InvalidArgumentException: Field tickets is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 587 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->get('tickets') (Line: 194)
Drupal\commerce_ticketing\EventSubscriber\OrderEventSubscriber->onOrderAssign(Object, 'commerce_order.order.assign', Object)
call_user_func(Array, Object, 'commerce_order.order.assign', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'commerce_order.order.assign') (Line: 48)

Proposed resolution

Use the attached patch...

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇦🇺Australia taggartj

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024