First of all thanks a lot for the greater module(s). It is filling a big gap in the Drupal universe when it comes to publishing workflows.
I was following the Revisioning with state-based content access control guide to setup a workflow with Revisioning and Workflow. I have Workflow triggers to “publish the most recent pending revision” when node is change to "live" state.
I noticed a problem when a moderator is saving a new revision and changing the Workflow state at the same time in edit mode. After saving the node this message is displayed:
"Revisioning test" has no pending revision to be published.
The previous revision remains published. May be the "Workflow" state change happens first and then the new revision is created. When the Workflow trigger is fired the new revision may be not yet available and the “publish the most recent pending revision” action fails to do its job. If the workflow state is changed from the Workflow tab all works fine.
Please let me know if you'd need a more exact description for this. Thanks a lot.
Richard
Comments
Comment #1
rdeboerThanks for the compliment Richard - good to hear you're getting value out of Revisioning.
Yes that is a little annoying operational fumble with the two things happening at once.
I'll have a look at it later this week.
In the mean time I guess it's a matter of educating your users to always change state via the Workflow tab.
Rik
Comment #2
rdeboerJust a note to myself that I need to look at this.
Comment #3
robbm commentedI suddenly seem to be hitting this same problem (I'm sure it was working before...)
Any news on a solution?
Comment #4
rdeboer@Onein, #3
Did this start to happen after you upgraded to 6.x.3.10/6.x.3.11 ?
Also, so that I can reproduce the problem accurately, what version of Workflow are you using?
Do you have Module Grants enabled?
Comment #5
robbm commentedI haven't upgraded: I've only been using 6.x-3.10. (Sorry, just realised this issue is actually for 2.x-dev...)
I'm using Workflow 6.x-1.4 and have Module Grants (6.x-3.5) enabled too.
I could probably send you a full installation if that would help...
For now, I seem to have been able to work around it by commenting out the function that modifies the node / comment forms, so users are forced to use the Workflow tab.
Comment #6
rdeboerAha... Great minds think alike!
Are you aware you can do that without changing the code at Administer >> Site configuration >> Revisioning?
You need Revisioning 6.x.3.10 or 6.x.3.11 (which I just released because 6.x.3.10 was incorrectly tagged resulting in the Content summary View being broken).
Comment #7
robbm commentedOh, that's much better!
Will upgrade to 6.x.3.11 and that'll overwrite my hack...
Comment #8
rdeboerComment #9
mcarbone commentedThis is happening because revisioning's weight has been changed to 1, so it's later than workflow now (ostensibly so it can alter forms made by workflow). Thus, workflow triggers are run before revisioning has a chance to create a pending revision, which is bad. You should put:
into an after_build so that the weight of revisioning can be changed back to 0.
Comment #10
rdeboerThanks Marco - I think you're spot-on with your analysis and solution.
As always you're a great help to the community!
Will apply your patch soon.
Rik
Comment #11
rdeboerComment #12
dleong commentedsubscribing...
Comment #13
dleong commentedHi Rik,
Thank you for all your work on this module; has there been any more done to port this particular resolution to the next version? I'm still having an issue with the publishing workflow I have set up - particularly around publishing the latest revision when a node changes from a workflow draft state -> publish state (I believe I have the actions and triggers properly assigned for the workflow).
At the risk of being too verbose, here's a non-technical description of what's happening. Any insight you can provide please would be most appreciated:
Editing process and results:
Actions done by user with editor role:
#1. Change current revision (published) of article from workflow state: publish -> draft (under workflow tab)
results:
-workflow state is changed to draft
-new 'in draft/pending publication' revision of published article is created.
#2. Edit latest revision and save changes to article
results:
-the following revision messages are displayed:
* Updating existing copy, not creating new revision as this one is still pending.
* Article Example title has been updated.
* Displaying pending revision of article Example title, last modified by editor on 2010-12-09 11:26
-changes are saved to pending revision created in #1, no new revisions are created.
#3. With all changes completed, change article workflow state: draft -> publish (under workflow tab)
results:
-the following revision messages are displayed:
"Example title" has no pending revision to be published.
Displaying current, published revision of article Example title, last modified by author on 2010-12-09 09:51 (this is the unmodified, original, published article in #1)
-the pending revision created in #1 and edited in #2 remains unchanged (i.e. still a pending revision)
-a new pending revision is created that is a duplicate of the current, unmodified published article resulting in a total of 2 pending revisions. It also supersedes the previous revision edited in #2.
Workarounds:
#1
-grant editor role permission to publish revisions under Revisioning module.
-select specific revision and use 'Publish this' to publish that revision
-other listed pending revisions remain unchanged
Variations:
#1. Grant editor role permission to publish revisions under Revisioning module and follow usual workflow steps
-this results in no resolution to the problem
#2. Add administrator role to user with editor role
-changes to workflow state from publish -> draft do not generate a new revision
-edit/save latest document with 'create new revision' and 'new revision in draft/pending moderation' generates new pending revision
-change workflow state from draft - > publish generate the following revision messages:
* Revision has been published.
* Displaying current, published revision of article Example title, last modified by editor on 2010-12-09 14:30.
Here's some additional information on permissions / settings:
Drupal core version 6.19
Module Grants version 6.x-3.6
Revisioning version 6.x-3.11
Workflow version 6.x-1.5
Publication Workflow settings
editor may do these transitions:
draft -> publish
publish -> draft
editor can view and edit posts in draft but cannot edit posts in publish state
Triggers for Publication Workflow
When article moves from draft -> publish - Publish most recent pending revision
When article moves from publish -> draft - no action
Triggers for Content
none assigned
Triggers for Revisioning
none assigned
Article Content type settings
Workflow settings:
Create new revision
New revision in draft, pending moderation
-create new revision only when saving content that is not already in draft/pending moderation
Revisioning module settings
Links to view content default to:
-displaying the current revision
Links to edit content default to:
-editing the latest revision
Allow workflow state transition via content edit form:
-unchecked
Module Grants module settings
-Interpret absence of access grants as a "don't care", rather than a "deny access".
Permissions for editor role:
Node module:
-access content
-create article content
-revert revisions
-view revisions
Revisioning module:
-edit revisions
-unpublish current revision
-view revision status messages
-view revisions of any article content
Workflow module:
-access workflow summary views
That's it - I apologize for the lengthy description and non-technical approach - I'm more of a user than a programmer.
Thanks again,
Dennis
Comment #14
laroccadahouse commentedany progress on this?
Comment #15
nclavaud commentedsubscribing
Comment #16
halrichman commentedDoes this problem have a solution. I tried the "after-build" suggestion but it did not have an effect. I cannot get workflow trigger or rules modules to publish pending revision when workflow moved to live.
I want to try and fixt this at least for the verision 6.12 that I am using.
I have tracked the action of the revisioning module when "in Review" is updated to "live" all the way to the function _revisioning_publish_revision(&$node, $vid = NULL). The vid value appears to be replaced with the new on. The status is set to 1, but still not showing published.
Suggestions anyone.
Comment #17
rdeboerOops this one has slipped under the radar and into the dungeons of my memory...
Hope to have a look at this, this weekend....
But for now....
@halrichman, #16:
When you tried the solution of #9, did you also reset the "weight" of the Revisioning module back to 0, as suggested by mcarbone in that issue?
E.g. use your database UI (phpMyAdmin or similar) to edit the {system} table of your Drupal database, or execute this code once, in say index.php (then remove the line):
Comment #18
halrichman commentedAloha,
Thanks for the reply!!! I did as you suggested and set revisioning weight to 0. I manually check the system table and it is 0. Perhaps I am not executing "after_build" correctly. I am running that piece of code every time I load the test_page content form that is being controlled by revisioning/workflow.
i created a custom module with the following:
function customhr_form_alter(&$form, $form_state, $form_id) {
if ($form_id == "test_page_form") $form['#after_build'] = array('check_workflow');
}
function check_workflow($form_element, &$form_state) {
if (!variable_get('revisioning_allow_workflow_transition_via_edit_form', TRUE)) {
unset($form['workflow']);
}
}
Is this what you had in mind for the solution?
I really, really appreciate all your help and if I learn enough I hope to able to contribute.
cheers,
Hal :)
Comment #19
rdeboerOk, so let's do one step at the time.
Your original problem in #16 was "to publish the pending revision when workflow is moved to live".
That **should** work regardless of the above code because you changed the weight of the Revisioning module so that it now comes before Workflow, so the pending revision is published first, then the worklfow state is changed. Is this not happening for you?
I'm not sure if the cache needs to be refreshed as well, but it won't hurt to go to Site configuration >> Performance and press that button at the bottom of the page....
The second issue is that of suppressing the workflow state transition buttons on the Edit form, thus forcing the user to change state via the Workflow tab only.
That's where your code of #18 comes in (or code similar to it). I might push code similar to this into a module I've created more recently called Workflow Extenions... it seems a more logical place for it.
Your code looks ok, except I don't think you're testing for the right form_id. Leave the condition out for now. Also the first parameter to check_workflow() should be $form, not $form_element. I don't have my development environment with me, but maybe something like this could work.
This is assuming that your module is called "customhr".
Good luck!
Comment #20
halrichman commentedAloha,
Thank you! I was confusing publishing with workflow transition via the edit form. To make it simple I changed to allow transitions from the edit form. So now my revisioning module weight is set to 0, but it still fails. I will continue to work on, but for my production side I have devised a work-around. I used rules to move from in review to live when published. This will allow me to bring it up on my live site.
Another question if I may and I apologize it this the wrong blog for the question, but I noticed that when the node revision is actually published, the "Publishing Options" on node revision in edit does not show published. It reads "Not published". It is indeed publish because is shows up on the menu and it is the correct node revision. Since I am in revision and under workflow do I need to maintain the publication state of the revision with additional addition code or is there just no way to control the publication status? I am afraid that when I bring this up in production my content managers will be confused.
cheers,
Hal Richman
Comment #21
rdeboerChecked in a change that sets revisioning weight back to its original value of 0 (see comment #9)
Will be available in In the 6.x-3.13 (7.x branch is not affected).
If you use Worklfow in combination with Revisioniong and you want the functionality implemented via the
revisioning_allow_workflow_transition_via_edit_formvariable then install the optional module Workflow Extensions. It comes with additional goodies too!