After completing a schedule (completed column set as 1 by workbench_scheduler_node_set_complete()), if the user update the node, a new revision is created and a new schedule is added for the node with the same dates (start and/or end) from the first revision. So when cron runs, the node is published/unpublished again. It's an inconvenient loop.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tregismoreira’s picture

As my first approach, I was thinking in execute the function workbench_scheduler_delete_node_schedule() inside the workbench_scheduler_node_set_complete() (after update query). But it would erase the entire scheduling history of the node. So I decided to just add a new condition on workbench_scheduler_load_node_schedule():

->condition('wsn.completed', 0)

The patch is attached and is working sweetly (for me). Let's discuss about that solution, if it doesn't make sense.

mikemiles86’s picture

Status: Active » Needs work

tregismoreira,

Thanks for pointing out this issue and providing a patch.

Can you update it so the paths are relative to only the module, and not your install directory? Patch does not apply otherwise.

should be:

--- a/workbench_scheduler.module
+++ b/workbench_scheduler.module
tregismoreira’s picture

mikemiles86’s picture

Assigned: Unassigned » mikemiles86
Status: Needs work » Needs review

  • Commit f2d066c on 7.x-1.x-dev authored by tregismoreira, committed by mikemiles86:
    Issue #2241065 by tregismoreira: Fixed bug with completed schedules...
mikemiles86’s picture

Status: Needs review » Fixed

Patch worked as expected and solves the problem described.

Patch has been applied to the 7.x-1.x-dev branch and will be included in the next release.

Thanks for the support!

mikemiles86’s picture

Assigned: mikemiles86 » Unassigned

  • Commit f2d066c on 7.x-1.x, 7.x-1.x-dev authored by tregismoreira, committed by mikemiles86:
    Issue #2241065 by tregismoreira: Fixed bug with completed schedules...

Status: Fixed » Closed (fixed)

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