When edit privileges are granted in the review or approval route, it's possible for a user to complete a task with a checked out form. If this happens on the final task, the form will not be correctly promoted/demoted. Steps to recreate:
1) Route a form to one user for approval. At least one other wizard contributor should have edit privileges while the form is in the Pending Approval State
2) Login as the approver and navigate to the task. The approve and reject links should be available. Click the approve link, but do not sign off on the form.
3) Open a new browser and login to the wizard as a user with edit access on the form Search for the form, load it into the review tab, and click the edit link. Let the form load, but don't do anything with it
4) Return to the first user's inbox task and complete the task. Watch the JMS log - the workflow completes with no error messages to the user, but the form is left in the pending approval state.
The wizard correctly prevents the approve/reject/complete/etc links when the form is checked out, but another check is needed immediately before the task is completed. To do this, we should create an "isFormValid" method and call that before finishing any workflow task. For now, the method can simply check to make sure the form is not checked out. If the form is checked out, the user should receive a message saying that the action (approve/reject, etc) cannot be completed because the form is checked out by X (name of the user).
We should ensure that this validity check is called at every point the workflow task can be completed - approve, reject, complete review task, selective approval.
Also see similar problem this way-
1) A user creates a new form, attaches a workflow document (currently checked in), and clicks the Save and Exit.
2) Checkout the attached workflow document.
3) Edit the form, the attached workflow document will still show up as valid (with the green checkmark). Finish the form.
The user can still start an approval route on this form even though the wf document is checked out.
Fixed bug