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)
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...
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | events-disabled-tickets-3250757-8.patch | 9.49 KB | aleix |
| #2 | ct-3250757.patch | 1.48 KB | taggartj |
Issue fork commerce_ticketing-3320246
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
taggartj commentedComment #3
pcambraThanks for reporting! I think we should have a test for this so we avoid regressions.
Comment #6
aleixIn fact it doesn't affect only the assign event, it will affect the events without the conditional that checks if order entity hasn't the tickets field. The test in MR shows just the assign and paid event. But It's clear that the subscription will affect orders without tickets enabled, and testing all events will add noise to test files.
I think that title must be wider too to help others facing issues : Enabling this module breaks order events without tickets ??
Comment #7
aleixAfter adding the conditional, tests confirm that tickets
Field tickets is unknownerrors are not there anymore :) .Adding critical as this issue breaks some sites that are mixing orders with enabled and disabled tickets...
Comment #8
aleix(patch for composer purposes)
Comment #9
pcambra