In field_collection_field_update() the entity's default_revision is only set to match the host entity's if the host is the default also. For the case where the host entity is NOT the default (ie revisions), this can result in incorrect saving of the field collection item with default_revision set to TRUE if it was loaded with default_revision set to TRUE.

#7 field_collection_default_revision-2274953.patch477 bytesa.milkovsky
PASSED: [[SimpleTest]]: [MySQL] 164 pass(es). View
#1 field_collection-correctly-set-revision_default-2274953-1.patch931 bytesrecrit
FAILED: [[SimpleTest]]: [MySQL] 126 pass(es), 6 fail(s), and 0 exception(s). View
Members fund testing for the Drupal project. Drupal Association Learn more


recrit’s picture

Status: Active » Needs review
931 bytes
FAILED: [[SimpleTest]]: [MySQL] 126 pass(es), 6 fail(s), and 0 exception(s). View

The attached patch reworks the code that sets default_revision to always match the host entity's default.

Status: Needs review » Needs work
dealancer’s picture

recrit’s picture

Status: Needs work » Closed (duplicate)

Field collection saving summary:
#2274953: Default revision is incorrectly set when host entity is NOT default- This patch turned out not to be needed since the combination of patches below ensured proper revision saving with workbench moderation.

Field collection patches:
* #1822844: Notice: Undefined index: revision_id in field_collection_field_get_entity() (line 1586 of field_collection/field_collection.modu - fixed field_collection_field_get_entity() to load the correct revision.

Workbench moderation patches:
* #1084436: doesn't seem to handle file attachments at all - removes un-needed field_attach_update().
* #1963992: Don't use $reset flag with node_load() - fixes wb moderation from clearing the entity cache when saving the live revision.

a.milkovsky’s picture

Assigned: Unassigned » a.milkovsky
Status: Closed (duplicate) » Active

Related issues do not duplicate current issue: - about archive attribute - notice in field_collection_field_get_entity().
Other links are not relate as they are about the Workbench module.

There is no issue about default_revision attribute or field_collection_field_update() function.

a.milkovsky’s picture

Status: Active » Needs review
477 bytes
PASSED: [[SimpleTest]]: [MySQL] 164 pass(es). View

We should simply set $entity->default_revision = FALSE; if host entity is not default revision on update.
We don't need to change archived attribute, as it is designed for other purposes.

a.milkovsky’s picture

Assigned: a.milkovsky » Unassigned
fago’s picture

Status: Needs review » Fixed

Thanks, committed #7.

  • a.milkovsky authored c07b3ec on 7.x-1.x
    Issue #2274953 by a.milkovsky, recrit: Default revision is incorrectly...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.