kennethormandy / craft-marketplace

Make your Craft Commerce site a Marketplace, via Stripe
https://plugins.craftcms.com/marketplace
Other
7 stars 0 forks source link

Soft-deleted fee name or handle can conflict with new #16

Closed kennethormandy closed 3 days ago

kennethormandy commented 3 years ago

Fees need to have a unique handle or name. Fees are soft-deleted. It’s possible that you might add a fee, delete it, and then add another fee back with the same handle or name as a soft-deleted fee.

The UniqueValidator::class rule doesn’t seem to account for this automatically, so I am showing an error when this happens, to avoid a much more confusing error. Now:

Screen Shot 2021-03-15 at 7 37 05 PM

Instead, should probably hard-delete the old fee, and continue creating the new fee? Getting the trashed record and continuing to modify it from there doesn’t seem to work. It restores the trashed record as it was, and you get a notice that (now) the fee handle is a duplicate.