Merged in bugfix/PMCORE-3196 (pull request #8111)

PMCORE-3196 'Unassigned cases' task in cron is not working correctly with 'system_utc_time_zone' enabled

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Roly Gutierrez
2021-09-08 21:12:58 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 12 additions and 3 deletions

View File

@@ -1,9 +1,13 @@
<?php <?php
namespace App\Console\Commands; namespace App\Console\Commands;
use Bootstrap;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand; use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
use Maveriks\WebApplication; use Maveriks\WebApplication;
use ProcessMaker\Model\TaskScheduler; use ProcessMaker\Model\TaskScheduler;
class ScheduleRunCommand extends BaseCommand class ScheduleRunCommand extends BaseCommand
{ {
use AddParametersTrait; use AddParametersTrait;
@@ -50,7 +54,7 @@ class ScheduleRunCommand extends BaseCommand
if (!$win) { if (!$win) {
$body = str_replace(" -c"," " . $user . " -c", $p->body); $body = str_replace(" -c"," " . $user . " -c", $p->body);
} }
$that->schedule->exec($body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) { $schedule = $that->schedule->exec($body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) {
$now = Carbon::now(); $now = Carbon::now();
$result = false; $result = false;
$datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update); $datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update);
@@ -88,7 +92,11 @@ class ScheduleRunCommand extends BaseCommand
return $result; return $result;
} }
return true; return true;
})->onOneServer(); });
$config = Bootstrap::getSystemConfiguration();
if (intval($config['on_one_server_enable']) === 1) {
$schedule->onOneServer();
}
} }
}); });
parent::handle(); parent::handle();

View File

@@ -83,7 +83,8 @@ class System
'report_table_floating_number' => 4, 'report_table_floating_number' => 4,
'report_table_double_number' => 4, 'report_table_double_number' => 4,
'ext_ajax_timeout' => 600000, 'ext_ajax_timeout' => 600000,
'disable_task_manager_routing_async' => '0' 'disable_task_manager_routing_async' => '0',
'on_one_server_enable' => 0
]; ];
/** /**