Waitlist submodule assumes USD currency in its price resolver

Created on 17 March 2024, 4 months ago
Updated 21 April 2024, 2 months ago

Problem/Motivation

Hello John, Commerce Registration is a great module, but something went wrong with the database update and commerce registrations needs to be fixed.

Steps to reproduce

I may have forgotten to make a DB update after updating the module when the wait lists were introduced or updated. Maybe two weeks ago I found out that the wait list function was visible in the options but could not be activated. With # drush updbst I could see that several database changes had not been made. However, the update aborted with error messages. I wasn't able to uninstall and reinstall the module, couldn't reinstall the module with the help of the Dev module, and finally resorted to using the Entity Update 2.0.0-rc2 module. It showed the fields as updateable and I ran the command. The update allegedly had succeeded, the error messages were gone, wait lists were now working.

My Commerce registrations were currently handling a single event that took place yesterday and is now taking registrations for a follow up event in two months. Somebody had canceled for the past event, someone else registered but got no mail and an error message that no mail could be sent. Yesterday I masqueraded as her, allowed more than one registration, added a free space to the wait list and every time when I registered an invoice was created but no registration dialog appeared. At my third attempt the mails were sent. Meanwhile other registrations for the next event were made but again only the order is visible and no registration.

I have backups but unfortunately I did not mark the DB backups, so I wouldn't know to which state to roll back the DB except by trial and error on this low traffic site. I could get back to the missing table rows state of the DB before the orders without saved registrations, but this would mean some loss of recent data (I could live with that), but of what help would such a rollback be? I also noticed that there's only a white screen when going to admin/commerce/registrations, perhaps also a result of my forgotten DB update and later maybe insufficient fix.

What could be a viable way to get back to a functioning commerce registration module? Any suggestions would be highly appreciated.
And how could I add later a registration for the event which by now is in the past so that the person who filled the canceled registration would be included in the mail address roster of the event for email messages to the group? If nothing else works, I could bite the bullet and revert the DB to a much earlier state with much more data loss, but perhaps there is a better way out? Regards, Andreas

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dgwolf
  • πŸ‡ΊπŸ‡ΈUnited States john.oltman

    Hey dgwolf, what I recommend is (make a backup of the current DB first) restore back to the last known good state when things were working. Both code and DB need to be restored to the same date. Clear cache and run database updates. Then update the registration and commerce registration modules to the latest versions and run database updates again. You can then enable the registration_admin_overrides submodule to allow you to create registrations manually for events that are already closed that you lost because of the DB restore. See the instructions in that module's README for more info.

  • Hi John, now I have reverted the DB to 9 Feb before the last updates and, following your instructions, am trying to re-add registrations lost through the DB rollback. Strangely the DB was consistent on 9 Feb and performing the updates no DB update was required at any time although the pending updates had shown up with # drush updbst only two or three weeks after your 10 Feb update IIRC. Anyway, the admin/commerce/registrations summary is no longer white, and WL can be switched on and off as intended, this is a success.
    I did enable the admin overrides but there is now one registration (I'll call her person C) that was on the waiting list on 9 Feb and of which I now, after the event, can't manually change the status - only one option, i.e. waiting list, is available. I also raised the capacity so that there is now a space for the person C, enabled auto-fill but this doesn't work either (although it did when the DB was not reverted yet and registrations were still open). Furthermore, while auto-fill may be a good thing for some events, my use case would rather need the "manual fill" option. We had a cancellation for a recent event, person A, and only a new registrant, person D, who had left her phone number, could be reached and in the end she was the one who was able and willing to attend. Immediately opening a space could theoretically have sucked person C into the open space, or even person B from the WL whom I reached and who stepped back. I canceled the two registrations of persons A (Open) and B (WL) and only then asked person D to register which didn't work properly (customer not saved as registrant, no confirmation mail) due to the now apparent recent DB problem.
    This raises for me the question: Are manual changes of the registration state possible? Depending on whether a manual payment (bank transfer) has already being made or not this would mean a change to either Open or to Completed state. Maybe I misunderstood the overrides, or are registrations after an event so far only possible on the Commerce order and not on the registration level? The latter would be a big help for managing registrants on the WL.
    Regards, Andreas

  • πŸ‡ΊπŸ‡ΈUnited States john.oltman

    Hello again Andreas - you should disable "auto fill" during this recovery period (and maybe afterwards) - it is designed for high volume sites where an admin would not be able to manage the wait list manually. Yes, the state can be modified manually by an admin - go to Configuration > Workflows in Drupal admin and edit the Registration workflow - edit each state and mark them as "Show on Form". Also make sure the Registration Status field is an enabled field on the Form Display for your Registration types, this allows the state to be set when you are editing registrations. The overrides only apply to registrations and not to anything in Commerce. Hopefully this gets you further along.

  • Hello John, thanks again for your kind and reliable help. I followed your suggestions and could change the states now, just as needed.
    Then I wanted to register person D who filled the cancellation gap in the past event, but interestingly now the EUR currency of the seminar fee for which I was trying to register her (i. e., the product price) is not being picked up when I click "Check Basket". Is this related to the non-standard workflow of registering person D through Commerce Registration for an event as an admin, or would I report this as a Commerce Core bug?

    Drupal\Core\Entity\EntityStorageException: Could not load the "USD" currency. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

    Drupal\commerce_order\Entity\OrderItem->recalculateTotalPrice() (Line: 135)
    Drupal\commerce_order\Entity\OrderItem->setUnitPrice() (Line: 185)
    Drupal\commerce_order\OrderRefresh->refresh() (Line: 123)
    Drupal\commerce_order\OrderStorage->doOrderPreSave() (Line: 86)
    Drupal\commerce_order\OrderStorage->invokeHook() (Line: 529)
    Drupal\Core\Entity\EntityStorageBase->doPreSave() (Line: 753)
    Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (Line: 483)
    Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 169)
    Drupal\commerce_order\OrderStorage->save() (Line: 354)
    Drupal\Core\Entity\EntityBase->save() (Line: 463)
    Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->submitForm() (Line: 614)
    Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm()
    call_user_func_array() (Line: 129)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67)
    Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 224)
    Drupal\Core\Form\FormBuilder->getForm() (Line: 143)
    Drupal\commerce_checkout\Controller\CheckoutController->formPage()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
    Drupal\ban\BanMiddleware->handle() (Line: 270)
    Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
    Drupal\shield\ShieldMiddleware->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • πŸ‡ΊπŸ‡ΈUnited States john.oltman

    Do you need to re-install EU currency for Commerce maybe? Not sure. The error message references trying to load USD currency. I doubt this is a Commerce Core bug. Something has gone haywire in your install, I am guessing related to multiple languages and multiple currencies. There are special settings for the Registration module for multilingual installs - view the README for more info. I'm going to have a hard time unraveling the mysteries of your site from afar. Send me a DM through my Drupal contact form if you want to provide web files and DB dump.

  • πŸ‡ΊπŸ‡ΈUnited States john.oltman

    Confirming after further research that the price resolver in the commerce_registration_waitlist submodule has a hardcoded reference to USD currency. This needs to be changed to use the currency associated with the current store or current order.

  • Status changed to Fixed 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States john.oltman

    The fix has been committed to the Dev branch and will be in the upcoming April release.

  • πŸ‡ΊπŸ‡ΈUnited States john.oltman
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024