Revision id is NULL on node edit if revision enabled

Created on 26 August 2020, about 4 years ago
Updated 26 February 2024, 9 months ago

Problem/Motivation

On table:workflow_transition_history the Revision id is saved as NULL if any revision enabled node is updated. Attached screenshot.

Steps to reproduce

Step 1: Create workflow states 'Draft', 'submitted', 'reject', 'approved' and add transitions.
Step 2: Enable Revisioning for the new content type or use the 'Basic' or 'Article' content type.
Step 3: Go to manage fields and add workflow field.
Step 4: Create a new view to show list of workflow_transition_history value or you can login to mysql and check the table data.
Step 4: Add new node and check table: workflow_transition_history values. All the values are populated and revision id is set.
Step 5: Edit same node and change the workflow state value to other value.
Step 6: Check the table: workflow_transition_history again the revision id value populated as NULL.

Proposed resolution

I found the above issue is due to the Function: workflow_entity_presave($entity) on workflow.module.
$entity value array shows vid but fields array show empty vid.
So changing the function to workflow_entity_update($entity) will fix the above issue.

Remaining tasks

Attached the patch by changing the function from workflow_entity_presave to workflow_entity_update. Please review the patch.

🐛 Bug report
Status

Fixed

Version

1.7

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024