When viewing the escrow (/user/funds/escrow) and funds transfer pages (/user/funds/transfer), I get the following PHP notice:
Notice: Undefined variable: default_currency in Drupal\commerce_funds\FundsDefaultCurrency->printTransactionCurrency() (line 74 of modules/contrib/commerce_funds/src/FundsDefaultCurrency.php).
Drupal\commerce_funds\FundsDefaultCurrency->printTransactionCurrency() (Line: 215)
Drupal\commerce_funds\Services\FeesManager->printTransactionFees('transfer') (Line: 82)
Drupal\commerce_funds\Form\FundsTransfer->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 518)
Drupal\Core\Form\FormBuilder->retrieveForm('commerce_funds_transfer_funds', Object) (Line: 275)
Drupal\Core\Form\FormBuilder->buildForm('commerce_funds_transfer_funds', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
jackson.cooper commentedHere's the patch.
Comment #3
aporieHi jackson cooper,
I can't reproduce your issue and I don't see how your code is changing anything from the actual one.
Can you lead me on how to reproduce it?
Thanks
Comment #4
jackson.cooper commentedAfter installing the module, configuring a dummy product in AUD, and viewing the pages /user/funds/escrow and /user/funds/transfer, I got that error.
I think to trigger that condition, you will need to ensure your store only has 1 currency configured, so it triggers the
elseif ($currency_qty == 1)condition. The$default_currencyvariable isn't defined inFundsDefaultCurrency::printTransactionCurrency()like it is inFundsDefaultCurrency::printTransactionCurrency(), but it tries to return it.The patch replaces the return of an undefined variable
$default_currencywith the default currency code ($this->defaultCurrencyCode).Comment #5
aporieCan you make sure your store is configured to use AUD as a default currency? (In admin/commerce/config/stores --> your store edit --> default currency)
Tells me if it changes anything.
Comment #6
jackson.cooper commentedAUD was the default currency. If I delete AUD, add USD as the only currency, and update the products to use USD, I now get:
Error: Call to a member function getSymbol() on null in Drupal\commerce_funds\Plugin\Block\FundsAdminSiteBalance->build() (line 65 of modules/contrib/commerce_funds/src/Plugin/Block/FundsAdminSiteBalance.php).It's because I already had $100 AUD credit and $0 USD credit, and my balance is:
array(2) { ["USD"]=> int(0) ["AUD"]=> string(3) "110" }So it's trying to lookup a deleted currency symbol.
I still see the
Notice: Undefined variable: default_currencyon/admin/commercefromFundsDefaultCurrency::printTransactionCurrency()though, because my currency quantity is now 1.Comment #8
aporieYou're right, I was actually looking at printConfigureFeesCurrency().
Variable was undefined.
Comment #9
aporie