Merged in release/3.5.0 (pull request #7389)
Release/3.5.0 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -1178,9 +1178,7 @@ class DynaForm
|
||||
}
|
||||
foreach ($oldColumns as $oldColumn) {
|
||||
if (strtolower(AdditionalTables::getPHPName($column->id)) === strtolower(AdditionalTables::getPHPName($oldColumn->id))) {
|
||||
if (strtolower(AdditionalTables::getPHPName($column->var_name)) === strtolower(AdditionalTables::getPHPName($oldColumn->var_name))) {
|
||||
$identicals[] = "'" . $column->id . "' - '" . $oldColumn->id . "'";
|
||||
}
|
||||
$identicals[] = "'" . $column->id . "' - '" . $oldColumn->id . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ class Lists
|
||||
];
|
||||
|
||||
// If the feature for highlight the home folders is disabled, add self-service list to the map
|
||||
if (!HIGHLIGHT_HOME_FOLDER_ENABLE) {
|
||||
$flag = defined('HIGHLIGHT_HOME_FOLDER_ENABLE') ? HIGHLIGHT_HOME_FOLDER_ENABLE : 0;
|
||||
if (!$flag) {
|
||||
$this->mapList['ListSelfService'] = 'CASES_SELFSERVICE';
|
||||
}
|
||||
|
||||
|
||||
248
workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php
Executable file
248
workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php
Executable file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\TaskScheduler;
|
||||
|
||||
class TaskSchedulerBM
|
||||
{
|
||||
public static $services = [
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_UNPAUSE",
|
||||
"enable" => "0",
|
||||
"service" => "unpause",
|
||||
"category" => "case_actions",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_UNPAUSE_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_CALCULATE_ELAPSED",
|
||||
"enable" => "0",
|
||||
"service" => "calculate",
|
||||
"category" => "case_actions",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => "0:00",
|
||||
"endingTime" => "0:30",
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => 'ID_TASK_SCHEDULER_CALCULATE_ELAPSED_DESC'
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_UNASSIGNED",
|
||||
"enable" => "0",
|
||||
"service" => "unassigned-case",
|
||||
"category" => "case_actions",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => 'ID_TASK_SCHEDULER_UNASSIGNED_DESC'
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_CLEAN_SELF",
|
||||
"enable" => "0",
|
||||
"service" => "clean-self-service-tables",
|
||||
"category" => "case_actions",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => "0:00",
|
||||
"endingTime" => "0:30",
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => 'ID_TASK_SCHEDULER_CLEAN_SELF_DESC'
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_CASE_EMAILS",
|
||||
"enable" => "1",
|
||||
"service" => "emails",
|
||||
"category" => "emails_notifications",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_CASE_EMAILS_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_ACTION_EMAIL",
|
||||
"enable" => "1",
|
||||
"service" => "",
|
||||
"category" => "emails_notifications",
|
||||
"file" => "workflow/engine/bin/actionsByEmailEmailResponse.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_ACTION_EMAIL_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS",
|
||||
"enable" => "1",
|
||||
"service" => "",
|
||||
"category" => "emails_notifications",
|
||||
"file" => "workflow/engine/bin/messageeventcron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_SEND_NOT",
|
||||
"enable" => "1",
|
||||
"service" => "",
|
||||
"category" => "emails_notifications",
|
||||
"file" => "workflow/engine/bin/sendnotificationscron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_SEND_NOT_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_REPORT_USERS",
|
||||
"enable" => "0",
|
||||
"service" => "report_by_user",
|
||||
"category" => "reporting",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_REPORT_PROCESS",
|
||||
"enable" => "0",
|
||||
"service" => "report_by_process",
|
||||
"category" => "reporting",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"category" => "reporting",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_LDAP",
|
||||
"enable" => "0",
|
||||
"service" => "",
|
||||
"category" => "processmaker_sync",
|
||||
"file" => "workflow/engine/bin/ldapcron.php",
|
||||
"startingTime" => "0:00",
|
||||
"endingTime" => "0:30",
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_LDAP"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TASK_SCHEDULER_PM_PLUGINS",
|
||||
"enable" => "0",
|
||||
"service" => "plugins",
|
||||
"category" => "plugins",
|
||||
"file" => "workflow/engine/bin/cron.php",
|
||||
"startingTime" => "0:00",
|
||||
"endingTime" => "0:30",
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TASK_SCHEDULER_PM_PLUGINS_DESC"
|
||||
],
|
||||
[
|
||||
"title" => "ID_TIMER_EVENT",
|
||||
"enable" => "1",
|
||||
"service" => "",
|
||||
"category" => "case_actions",
|
||||
"file" => "workflow/engine/bin/timereventcron.php",
|
||||
"startingTime" => null,
|
||||
"endingTime" => null,
|
||||
"everyOn" => "1",
|
||||
"interval" => "week",
|
||||
"expression" => "*/1 * * * 0,1,2,3,4,5,6",
|
||||
"description" => "ID_TIMER_EVENT_DESC"
|
||||
]
|
||||
];
|
||||
/**
|
||||
* Return the records in Schedule Table by category
|
||||
*/
|
||||
public static function getSchedule($category)
|
||||
{
|
||||
$tasks = TaskScheduler::all();
|
||||
$count = $tasks->count();
|
||||
if ($count == 0) {
|
||||
TaskSchedulerBM::generateInitialData();
|
||||
$tasks = TaskScheduler::all();
|
||||
}
|
||||
if (is_null($category)) {
|
||||
return $tasks;
|
||||
} else {
|
||||
return TaskScheduler::where('category', $category)->get();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Save the record Schedule in Schedule Table
|
||||
*/
|
||||
public static function saveSchedule(array $request)
|
||||
{
|
||||
$task = TaskScheduler::find($request['id']);
|
||||
if (isset($request['enable'])) {
|
||||
$task->enable = $request['enable'];
|
||||
}
|
||||
|
||||
if (isset($request['expression'])) {
|
||||
$task->expression = $request['expression'];
|
||||
$task->startingTime = $request['startingTime'];
|
||||
$task->endingTime = $request['endingTime'];
|
||||
$task->timezone = $request['timezone'];
|
||||
$task->everyOn = $request['everyOn'];
|
||||
$task->interval = $request['interval'];
|
||||
}
|
||||
$task->save();
|
||||
return $task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial data for Schedule Table, with default values
|
||||
*/
|
||||
public static function generateInitialData()
|
||||
{
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||
$toSave = [];
|
||||
|
||||
foreach (TaskSchedulerBM::$services as $service) {
|
||||
$task = new TaskScheduler;
|
||||
$task->title = $service["title"];
|
||||
$task->category = $service["category"];
|
||||
$task->description = $service["description"];
|
||||
$task->startingTime = $service["startingTime"];
|
||||
$task->endingTime = $service["endingTime"];
|
||||
$task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force"';
|
||||
$task->expression = $service["expression"];
|
||||
$task->type = "shell";
|
||||
$task->system = 1;
|
||||
$task->enable = $service["enable"];
|
||||
$task->everyOn = $service["everyOn"];
|
||||
$task->interval = $service["interval"];
|
||||
$task->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,8 @@ class Variable
|
||||
if (isset($arrayData["VAR_FIELD_TYPE"])) {
|
||||
$arrayData["VAR_FIELD_TYPE"] = $this->validateVarFieldType($arrayData["VAR_FIELD_TYPE"]);
|
||||
$variable->setVarFieldType($arrayData["VAR_FIELD_TYPE"]);
|
||||
$fielTypeId = self::$varTypesValues[$arrayData["VAR_FIELD_TYPE"]];
|
||||
$variable->setVarFieldTypeId($fielTypeId);
|
||||
}
|
||||
if (isset($arrayData["VAR_FIELD_SIZE"])) {
|
||||
$variable->setVarFieldSize($arrayData["VAR_FIELD_SIZE"]);
|
||||
@@ -763,7 +765,9 @@ class Variable
|
||||
$start = isset($params["start"]) ? $params["start"] : 0;
|
||||
$limit = isset($params["limit"]) ? $params["limit"] : 10;
|
||||
$appUid = empty($params["app_uid"]) ? null : $params["app_uid"];
|
||||
$delIndex = (int)isset($params["del_index"]) ? $params["del_index"] : 0;
|
||||
$delIndex = (int) isset($params["del_index"]) ? $params["del_index"] : 0;
|
||||
$gridName = isset($params['grid_name']) ? $params['grid_name'] : null;
|
||||
|
||||
unset($params["dyn_uid"]);
|
||||
unset($params["field_id"]);
|
||||
unset($params["app_uid"]);
|
||||
@@ -772,6 +776,7 @@ class Variable
|
||||
unset($params["query"]);
|
||||
unset($params["start"]);
|
||||
unset($params["limit"]);
|
||||
unset($params["grid_name"]);
|
||||
|
||||
//Get appData and system variables
|
||||
$paramsAndGlobal = $params;
|
||||
@@ -796,7 +801,11 @@ class Variable
|
||||
//Get control from dynaform.
|
||||
//The parameters: queryFilter, queryStart, queryLimit, are only necessary
|
||||
//for the suggest control, the rest of the controls are ignored.
|
||||
$field = $pmDynaform->searchField($dynUid, $fieldId, $proUid);
|
||||
$parameters = [$dynUid, $fieldId, $proUid];
|
||||
if (!empty($gridName)) {
|
||||
$parameters[] = ['gridName' => $gridName];
|
||||
}
|
||||
$field = $pmDynaform->searchField(...$parameters);
|
||||
$field->queryField = true;
|
||||
$field->queryInputData = $params;
|
||||
$field->queryFilter = $filter;
|
||||
|
||||
@@ -185,9 +185,13 @@ class JobsManager
|
||||
public function dispatch($name, $callback)
|
||||
{
|
||||
$environment = $this->getDataSnapshot();
|
||||
|
||||
$instance = $name::dispatch(function() use ($callback, $environment) {
|
||||
global $RBAC;
|
||||
$referrerRBAC = $RBAC;
|
||||
$instance = $name::dispatch(function() use ($callback, $environment, $referrerRBAC) {
|
||||
try {
|
||||
global $RBAC;
|
||||
$RBAC = $referrerRBAC;
|
||||
|
||||
$this->recoverDataSnapshot($environment);
|
||||
$callback($environment);
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -98,9 +98,22 @@ class AppNotes extends Model
|
||||
$notes['notes'][] = $row;
|
||||
});
|
||||
|
||||
// Add the total of rows to return
|
||||
$notes['totalCount'] = $limit;
|
||||
|
||||
return $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total notes by case
|
||||
*
|
||||
* @param string $appUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getTotal(string $appUid)
|
||||
{
|
||||
$query = AppNotes::query()->select(['NOTE_ID']);
|
||||
$query->appUid($appUid);
|
||||
$total = $query->get()->count();
|
||||
|
||||
return $total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ class SubApplication extends Model
|
||||
'SA_INIT_DATE' => '',
|
||||
'SA_FINISH_DATE' => ''
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
@@ -49,4 +50,5 @@ class SubApplication extends Model
|
||||
'SA_INIT_DATE',
|
||||
'SA_FINISH_DATE'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
19
workflow/engine/src/ProcessMaker/Model/TaskScheduler.php
Executable file
19
workflow/engine/src/ProcessMaker/Model/TaskScheduler.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use \Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TaskScheduler
|
||||
* @package ProcessMaker\Model
|
||||
*
|
||||
* Represents a dynaform object in the system.
|
||||
*/
|
||||
class TaskScheduler extends Model
|
||||
{
|
||||
protected $table = 'SCHEDULER';
|
||||
public $timestamps = true;
|
||||
const CREATED_AT = 'creation_date';
|
||||
const UPDATED_AT = 'last_update';
|
||||
}
|
||||
51
workflow/engine/src/ProcessMaker/Services/Api/Scheduler.php
Executable file
51
workflow/engine/src/ProcessMaker/Services/Api/Scheduler.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\TaskSchedulerBM;
|
||||
use ProcessMaker\Services\Api;
|
||||
|
||||
/**
|
||||
* TaskScheduler Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Scheduler extends Api
|
||||
{
|
||||
/**
|
||||
* Returns the records of SchedulerTask by category
|
||||
* @url GET
|
||||
*
|
||||
* @param string $category
|
||||
*
|
||||
* @return mixed
|
||||
* @throws RestException
|
||||
*/
|
||||
public function doGet($category = null) {
|
||||
try {
|
||||
return TaskSchedulerBM::getSchedule($category);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive the options sent from Scheduler UI
|
||||
* @url POST
|
||||
* @status 200
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
*/
|
||||
public function doPost(array $request) {
|
||||
try {
|
||||
return TaskSchedulerBM::saveSchedule($request);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user