feed-me icon indicating copy to clipboard operation
feed-me copied to clipboard

Field set as skipUpdateFieldHandle does not prevent data being overwritten

Open jamesmacwhite opened this issue 2 years ago • 1 comments
trafficstars

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 avatar Sep 13 '23 13:09 jamesmacwhite

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?

jamesmacwhite avatar Sep 14 '23 07:09 jamesmacwhite