From 707dddb50425a7a736ed477ac5d16fd0700715b7 Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Fri, 12 Aug 2022 12:08:13 -0400 Subject: [PATCH] PMCORE-3906 Task Scheduler does not work for stacks N285 and 285 --- app/Console/Commands/ScheduleRunCommand.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/ScheduleRunCommand.php b/app/Console/Commands/ScheduleRunCommand.php index 344923024..bb5f88bb7 100755 --- a/app/Console/Commands/ScheduleRunCommand.php +++ b/app/Console/Commands/ScheduleRunCommand.php @@ -43,7 +43,6 @@ class ScheduleRunCommand extends BaseCommand */ public function handle(Schedule $schedule, Dispatcher $dispatcher, ExceptionHandler $handler) { - $that = $this; $workspace = $this->option('workspace'); $user = $this->option('user'); if (!empty($workspace)) { @@ -51,7 +50,7 @@ class ScheduleRunCommand extends BaseCommand $webApplication->setRootDir($this->option('processmakerPath')); $webApplication->loadEnvironment($workspace, false); } - TaskScheduler::all()->each(function ($p) use ($that, $user) { + TaskScheduler::all()->each(function ($p) use ($schedule, $user) { $win = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; if ($p->enable == 1) { $starting = isset($p->startingTime) ? $p->startingTime : "0:00"; @@ -78,7 +77,7 @@ class ScheduleRunCommand extends BaseCommand $body = str_replace("report_by_process", "report_by_process +init-date'{$oneMonthAgo}' +finish-date'{$currentDate}'", $body); } - $schedule = $that->schedule->exec($body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) { + $schedule->exec($body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) { $now = Carbon::now(); $result = false; $datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update);