PMCORE-2369 Kpi Report by process and Report by user does not work and the error is displayed on the taskscheduler log

This commit is contained in:
Roly Rudy Gutierrez Pinto
2021-07-01 14:24:09 -04:00
parent 4d77676d0c
commit f647b1ffa2
4 changed files with 38 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Core\System;
// Auto loader
require_once __DIR__ . '/../../../bootstrap/autoload.php';

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Core\System;
try {
global $G_PUBLISH;
$G_PUBLISH = new Publisher();

View File

@@ -172,7 +172,9 @@ class TaskSchedulerBM
"everyOn" => "1",
"interval" => "week",
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC"
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC",
"initDate" => "+init-date",
"finishDate" => "+finish-date"
],
[
"title" => "ID_TASK_SCHEDULER_REPORT_PROCESS",
@@ -189,7 +191,9 @@ class TaskSchedulerBM
"everyOn" => "1",
"interval" => "week",
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
"description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC"
"description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC",
"initDate" => "+init-date",
"finishDate" => "+finish-date"
],
[
"title" => "ID_TASK_SCHEDULER_LDAP",
@@ -279,10 +283,25 @@ class TaskSchedulerBM
$task->description = $service["description"];
$task->startingTime = $service["startingTime"];
$task->endingTime = $service["endingTime"];
$activity = $service["service"];
//for init date and finish date parameters
$currentDate = date("Y-m-d H:i:s");
$setOfActivities = ["report_by_user", "report_by_process"];
if (!empty($service["initDate"]) && in_array($activity, $setOfActivities)) {
$oneMonthAgo = $currentDate . " -1 month";
$timestamp = strtotime($oneMonthAgo);
$oneMonthAgo = date("Y-m-d H:i:s", $timestamp);
$activity = $activity . ' ' . $service["initDate"] . '"' . $oneMonthAgo . '"';
}
if (!empty($service["finishDate"]) && in_array($activity, $setOfActivities)) {
$activity = $activity . ' ' . $service["initDate"] . '"' . $currentDate . '"';
}
if ($win) {
$task->body = 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $service["service"] . ' +w' . config("system.workspace") . ' +force +async';
$task->body = 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $activity . ' +w' . config("system.workspace") . ' +force +async';
} else {
$task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force +async"';
$task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $activity . ' +w' . config("system.workspace") . ' +force +async"';
}
$task->expression = $service["expression"];
$task->type = "shell";