Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions ProcessMaker/Managers/TaskSchedulerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ private function processTaskWithAtomicClaim(ScheduledTask $task, DateTime $today
{
try {
$config = json_decode($task->configuration);
$lastExecution = new DateTime($task->last_execution, new DateTimeZone('UTC'));

if ($lastExecution === null) {
return;
// SCHEDULED_JOB rows use last_execution = null until first run; BPMN timers always set last_execution.
$lastExecution = null;
if ($task->last_execution !== null && $task->last_execution !== '') {
$lastExecution = new DateTime($task->last_execution, new DateTimeZone('UTC'));
}

$owner = $task->processRequestToken ?: $task->processRequest ?: $task->process;
Expand Down Expand Up @@ -721,11 +722,14 @@ public function scheduleDateJob($datetime, array $config): ScheduledTask
if (!isset($config['job'])) {
throw new InvalidArgumentException('$config["job"] is required');
}

// Must use "interval" so nextDate(TimeDate) picks up the target datetime (same shape as BPMN timer tasks).
$configuration = [
'type' => 'TimeDate',
'date' => $datetime,
...$config,
'interval' => $datetime,
];

$scheduledTask = new ScheduledTask();
$scheduledTask->configuration = json_encode($configuration);
$scheduledTask->type = 'SCHEDULED_JOB';
Expand Down
Loading