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

Field set as skipUpdateFieldHandle does not prevent data being overwritten #1368

Open
jamesmacwhite opened this issue Sep 13, 2023 · 1 comment
Labels

Comments

@jamesmacwhite
Copy link
Contributor

Description

Entries with the field that is defined in skipUpdateFieldHandle are not skipped over in FeedMe import and overwritten regardless of setting.

We have a lightswitch field set which controls this, it appears to be ignored and updates any item with it set anyway.

Steps to reproduce

  1. Create a lightswitch field and set the field to enabled on an entry
  2. Change a value that is normally populated by the feed
  3. The entry has been overwritten with data from the feed, rather than being skipped

We do not have versioning enabled on the entry channel the data is for.

This appears to have stopped working in a FeedMe update at some point as it has previously worked before I believe.

Additional info

  • Craft version: 3.9.1
  • PHP version: 8.0
  • Database driver & version: MySQL 8
  • Plugins & versions: FeedMe 4.70
@jamesmacwhite
Copy link
Contributor Author

jamesmacwhite commented Sep 14, 2023

Testing locally, I think the problem is here:

https://github.com/craftcms/feed-me/blob/develop/src/services/Process.php#L289-L299

The condition to skip implies that $updateField should match a string value of '1'.

Dumping the updateField value when matching the field handle to skip, this is not the case and returns a boolean of true, so the condition to skip does not match the returned value.

I assume this might be related to lightswitch fields being inconsistent in the past with being true/false or '1'/'0', should this check be updated to check for boolean values?

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

1 participant