Repository navigation
Refuse to delete a currency that orders were placed in - #1125
Open
KrzysztofPajak wants to merge 1 commit into
Open
KrzysztofPajak wants to merge 1 commit into
KrzysztofPajak wants to merge 1 commit into
Conversation
An order keeps the code of the currency it was placed in. Once that currency was deleted, the order's edit page in the admin and the store panel failed with a 500, and completing or cancelling the order failed where loyalty points are converted. The currency now cannot be deleted while an order uses it; it can be unpublished instead. An installation that already deleted one gets its orders back by creating the currency again with the same code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
An order keeps the code of the currency it was placed in. After an admin deleted that currency:
Cannot load order currency);ConvertToPrimaryStoreCurrencyrefuses a missing currency).Solution
ValidateCurrencyDeletenow refuses a currency that any order was placed in, next to the existing refusals for the primary and the exchange-rate currency. The admin is told to unpublish it instead. The check is one paged query (GetOrderQuerygained aCustomerCurrencyCodefilter, read withPageSize = 1).An installation that already deleted such a currency gets its orders back by creating the currency again with the same code; it can stay unpublished.
New resource
Admin.Configuration.Currencies.CantDeleteUsedByOrdersinDefaultLanguage.xmlandUpgrade/en_250.xml.Breaking changes
A currency used by orders can no longer be deleted.
Testing
Tests:
CurrencyViewModelServiceTests(refused when orders use it) andGetOrderQueryHandlerTests(the new filter).