The Workbench Moderation module (part of the Workbench module suite) allows for a publishing workflow for node revisions such as Draft -> Needs Review -> Published. For some reason using Workbench Moderation on a content type that also has a GetLocations field causes the map to appear twice on the page. I'm guessing it has something to do with the way Workbench Moderation alters Drupal's revision handling and the fact that GetLocations adds a row to the getlocations_field_entities table for every node revision, but that's as far as I investigated the issue before simply disabling moderation on the content type being affected. That's a "fix" but it means content goes live immediately.

Also, and I'm not sure if this is related, but I noticed that if I create a new node with a GetLocations map, edit/save it a few times to create a few revisions, and then delete the node, a bunch of orphaned rows remain in the getlocations_field_entities table for that now-nonexistent nid.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hutch’s picture

I have struggled for too many hours with node_revisions. Getlocations_fields supplies the hook "hook_field_delete_revision()" as per the Field module docs but it is never called when a node is deleted, only the current revision is deleted (via "hook_field_delete()"), any others become orphaned as you have noticed. As it is the Field module that does the deleting and Getlocations_fields has no control over the deletion process other than providing the correct hooks I have to assume that it is a bug in Field module.

I am not familiar with the workbench moderation module but judging from its description it's likely that its behaviour will reflect difficulties with node revisions. Fortunately most of the developers I have worked with have not used it at all, too unreliable.

Dim’s picture

"I am not familiar with the workbench moderation module but judging from its description it's likely that its behaviour will reflect difficulties with node revisions. Fortunately most of the developers I have worked with have not used it at all, too unreliable."

But sometimes, we don't have the choice...
And indeed, workbench + get location = two maps (or two coordinates if we show all markers on one map). And that's not related to the orphaned rows.

bencontra’s picture

I have this same issue. I can't find a better module for moderation than workbench moderation, but if creating duplicate rows in the getlocations_fields and entities tables is causing me no end of trouble. Any help would be much appreciated.

robgi’s picture

Even without the module workbench there are many orphaned records how many times the node is reviewed. It may include a patch to remove these orphaned records? Thanks (I translated with google sorry)

Dylan Donkersgoed’s picture

We encountered the same issue. I've attached a patch. It's a bit of a hack - doesn't address the core problem. But it should filter out duplicates when inserting or updating nodes with getlocations fields when workbench is enabled.

Dylan Donkersgoed’s picture

Attached an improved version of the patch - the last one would cause issues with other entities. The patch now only applies to nodes and should be easier to expand to other entities if necessary (though I don't think it should be).

Dylan Donkersgoed’s picture

Seems langcode is also a factor for this, here's a new patch to make the hack take that into account.

Without this if you're using entity translation and you try to save a node in the non-default language this patch causes a crash.