Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: Switching from a plain text field to a Money field causes an unrecoverable error everywhere #15413

Closed
MoritzLost opened this issue Jul 25, 2024 · 1 comment
Assignees
Labels

Comments

@MoritzLost
Copy link
Contributor

What happened?

Description

We had to convert a Plaintext field to a money field. Those fields are not compatible, so you are warned about the potential for data loss when switching the field type. That's fine and I expected to have to re-enter all the values. What I did not expect is that this is basically impossible, because the money field throws errors everywhere:

  • The entry editing form throws an error if the field has an unexpected value.

Screenshot 2024-07-25 at 12 43 21

  • The element indexes don't load any more if the field is displayed as a column, because the controller returns a 500 response.

Screenshot 2024-07-25 at 12 44 46

  • I tried to resave the entries to clear the field, but that causes an error as well.

Screenshot 2024-07-25 at 12 44 08

This makes it very hard to fix the content issues. The only thing I can think of is to either manually fix the values in the database, or switch the field back to Plaintext, empty it out and then switch to a Money field again.

Steps to reproduce

  1. Create a plain text field, add it to an entry type, and create some entries with arbitrary values in the field.
  2. Switch the plain text field to a money field.
  3. Try to edit an entry, view the element index (with the field visible as a column) or resave the entries using the resave/entries command.

Expected behavior

Invalid values should be handled more gracefully and allow a normal author to fix the incorrect value.

Actual behavior

Invalid values throw an error with no way to fix it through normal means.

Craft CMS version

5.2.5

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@MoritzLost MoritzLost added the bug label Jul 25, 2024
brandonkelly added a commit that referenced this issue Jul 26, 2024
…m-field-to-money-field

Fixed #15413 converting custom field to money field
@brandonkelly
Copy link
Member

Craft 5.2.9 is out now with a fix for this. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants