PMCORE-2185

This commit is contained in:
Paula Quispe
2020-09-28 15:14:09 -04:00
committed by Julio Cesar Laura Avendaño
parent f44f3ae565
commit 041434aa42
3 changed files with 65 additions and 29 deletions

View File

@@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Log;
use ldapadvancedClassCron;
use NotificationQueue;
use ProcessMaker\BusinessModel\ActionsByEmail\ResponseReader;
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\Light\PushMessageAndroid;
use ProcessMaker\BusinessModel\Light\PushMessageIOS;
use ProcessMaker\Core\JobsManager;
@@ -233,6 +234,34 @@ class Task
$this->runTask($job);
}
/**
* Check if some task unassigned has enable the setting timeout and execute the trigger related
*
* @link https://wiki.processmaker.com/3.2/Tasks#Self-Service
*/
function executeCaseSelfService()
{
$job = function() {
try {
$this->setExecutionMessage("Unassigned case");
$this->saveLog("unassignedCase", "action", "Unassigned case", "c");
$casesExecuted = BmCases::executeSelfServiceTimeout();
foreach ($casesExecuted as $caseNumber) {
$this->saveLog("unassignedCase", "action", "OK Executed trigger to the case $caseNumber");
}
$this->setExecutionResultMessage(count($casesExecuted) . " Cases");
} catch (Exception $e) {
$this->setExecutionResultMessage("WITH ERRORS", "error");
$this->saveLog("unassignedCase", "action", "Unassigned case", "c");
if ($this->asynchronous === false) {
eprintln(" '-" . $e->getMessage(), "red");
}
$this->saveLog("unassignedCase", "error", "Error in unassigned case: " . $e->getMessage());
}
};
$this->runTask($job);
}
/**
* This calculate duration.
*/