fix observations
fix the timezone import
This commit is contained in:
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Maveriks\WebApplication;
|
use Illuminate\Support\Carbon;
|
||||||
use \Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
|
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Maveriks\WebApplication;
|
||||||
use ProcessMaker\BusinessModel\TaskSchedulerBM;
|
|
||||||
use ProcessMaker\Model\TaskScheduler;
|
use ProcessMaker\Model\TaskScheduler;
|
||||||
|
|
||||||
class ScheduleRunCommand extends BaseCommand
|
class ScheduleRunCommand extends BaseCommand
|
||||||
@@ -24,11 +22,11 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
{
|
{
|
||||||
$this->startedAt = Carbon::now();
|
$this->startedAt = Carbon::now();
|
||||||
$this->signature = "schedule:run";
|
$this->signature = "schedule:run";
|
||||||
$this->signature .= '
|
$this->signature .= "
|
||||||
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
|
{--workspace=workflow : Workspace to use.}
|
||||||
{--user=apache : ProcessMaker Indicates the user to execute the crons.}
|
{--user=apache : Operating system's user who executes the crons.}
|
||||||
{--processmakerPath=./ : ProcessMaker path.}
|
{--processmakerPath=./ : ProcessMaker path.}
|
||||||
';
|
";
|
||||||
$this->description .= ' (ProcessMaker has extended this command)';
|
$this->description .= ' (ProcessMaker has extended this command)';
|
||||||
parent::__construct($schedule);
|
parent::__construct($schedule);
|
||||||
}
|
}
|
||||||
@@ -54,7 +52,7 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
$ending = isset($p->startingTime) ? $p->endingTime : "23:59";
|
$ending = isset($p->startingTime) ? $p->endingTime : "23:59";
|
||||||
|
|
||||||
$timezone = isset($p->timezone) && $p->timezone != "" ? $p->timezone : date_default_timezone_get();
|
$timezone = isset($p->timezone) && $p->timezone != "" ? $p->timezone : date_default_timezone_get();
|
||||||
$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) {
|
$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;
|
||||||
|
|||||||
@@ -1,37 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
try {
|
try {
|
||||||
$category = (isset($_GET["category"]))? $_GET["category"] : null;
|
global $G_PUBLISH;
|
||||||
/* Render page */
|
$G_PUBLISH = new Publisher();
|
||||||
$oHeadPublisher = headPublisher::getSingleton();
|
$headPublisher = headPublisher::getSingleton();
|
||||||
$pmDynaform = new PmDynaform(array());
|
$category = (isset($_GET["category"]))? $_GET["category"] : null;
|
||||||
$G_MAIN_MENU = "processmaker";
|
/* Render page */
|
||||||
$G_ID_MENU_SELECTED = "ID_SCHEDULER_MNU_01";
|
|
||||||
$dateTime = new \ProcessMaker\Util\DateTime();
|
|
||||||
if (!empty($_SESSION['USER_LOGGED'])) {
|
|
||||||
$arrayTimeZoneId = \DateTimeZone::listIdentifiers();
|
|
||||||
$js = "" .
|
|
||||||
"<script type='text/javascript'>\n" .
|
|
||||||
"var timezoneArray = " . G::json_encode($arrayTimeZoneId) . ";\n" .
|
|
||||||
"</script>\n";
|
|
||||||
echo($js);
|
|
||||||
|
|
||||||
}
|
$pmDynaform = new PmDynaform([]);
|
||||||
|
if (!empty($_SESSION['USER_LOGGED'])) {
|
||||||
|
$arrayTimeZoneId = DateTimeZone::listIdentifiers();
|
||||||
|
$fields["timezoneArray"] = G::json_encode($arrayTimeZoneId);
|
||||||
|
}
|
||||||
|
|
||||||
$js = "" .
|
$fields["server"] = System::getHttpServerHostnameRequestsFrontEnd();
|
||||||
"<script type=\"text/javascript\" src=/js/ext/translation.".SYS_LANG.".".G::browserCacheFilesGetUid() .".js></script>\n".
|
$fields["credentials"] = G::json_encode($pmDynaform->getCredentials());
|
||||||
"<script type='text/javascript'>\n" .
|
$fields["category"] = $category;
|
||||||
"var server = '" . System::getHttpServerHostnameRequestsFrontEnd() . "';\n" .
|
$fields["lang"] = SYS_LANG;
|
||||||
"var credentials = " . G::json_encode($pmDynaform->getCredentials()) . ";\n" .
|
$fields["workspace"] = config("system.workspace");
|
||||||
"var category = '" . $category . "';\n" .
|
$fields["translation"] = "/js/ext/translation.".SYS_LANG.".".G::browserCacheFilesGetUid().".js";
|
||||||
"var lang = '" . SYS_LANG . "';\n" .
|
|
||||||
"var workspace = '" .config("system.workspace") . "';\n" .
|
|
||||||
"</script>\n";
|
|
||||||
echo($js);
|
|
||||||
|
|
||||||
$file = file_get_contents(PATH_HOME . 'public_html/lib/taskscheduler/index.html');
|
$G_PUBLISH->addContent('smarty','scheduler/index.html','', '', $fields); //Adding a HTML file .html
|
||||||
echo $file;
|
$G_PUBLISH->addContent('smarty',PATH_HOME . 'public_html/lib/taskscheduler/index.html'); //Adding a HTML file .html
|
||||||
|
G::RenderPage("publish", "raw");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
echo($e);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
use ProcessMaker\Model\TaskScheduler;
|
use ProcessMaker\Model\TaskScheduler;
|
||||||
use \G;
|
|
||||||
use ProcessMaker\Plugins\Interfaces\StepDetail;
|
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
|
||||||
use \ProcessMaker\Util;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
|
||||||
class TaskSchedulerBM
|
class TaskSchedulerBM
|
||||||
@@ -14,46 +10,51 @@ class TaskSchedulerBM
|
|||||||
/**
|
/**
|
||||||
* Return the records in Schedule Table by category
|
* Return the records in Schedule Table by category
|
||||||
*/
|
*/
|
||||||
public static function getSchedule($category){
|
public static function getSchedule($category)
|
||||||
|
{
|
||||||
$tasks = TaskScheduler::all();
|
$tasks = TaskScheduler::all();
|
||||||
$count = $tasks->count();
|
$count = $tasks->count();
|
||||||
if($count == 0){
|
if ($count == 0) {
|
||||||
TaskSchedulerBM::generateInitialData();
|
TaskSchedulerBM::generateInitialData();
|
||||||
$tasks = TaskScheduler::all();
|
$tasks = TaskScheduler::all();
|
||||||
}
|
}
|
||||||
if(is_null($category)){
|
if (is_null($category)) {
|
||||||
return $tasks;
|
return $tasks;
|
||||||
}else{
|
} else {
|
||||||
return TaskScheduler::where('category', $category)->get();
|
return TaskScheduler::where('category', $category)->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Save the record Schedule in Schedule Table
|
* Save the record Schedule in Schedule Table
|
||||||
*/
|
*/
|
||||||
public static function saveSchedule(array $request_data){
|
public static function saveSchedule(array $request)
|
||||||
$task = TaskScheduler::find($request_data['id']);
|
{
|
||||||
if(isset($request_data['enable'])){
|
$task = TaskScheduler::find($request['id']);
|
||||||
$task->enable = $request_data['enable'];
|
if (isset($request['enable'])) {
|
||||||
|
$task->enable = $request['enable'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($request_data['expression'])){
|
if (isset($request['expression'])) {
|
||||||
$task->expression = $request_data['expression'];
|
$task->expression = $request['expression'];
|
||||||
$task->startingTime = $request_data['startingTime'];
|
$task->startingTime = $request['startingTime'];
|
||||||
$task->endingTime = $request_data['endingTime'];
|
$task->endingTime = $request['endingTime'];
|
||||||
$task->timezone = $request_data['timezone'];
|
$task->timezone = $request['timezone'];
|
||||||
$task->everyOn = $request_data['everyOn'];
|
$task->everyOn = $request['everyOn'];
|
||||||
$task->interval = $request_data['interval'];
|
$task->interval = $request['interval'];
|
||||||
|
}
|
||||||
}
|
|
||||||
$task->save();
|
$task->save();
|
||||||
return array();
|
return $task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateInitialData(){
|
/**
|
||||||
|
* Initial data for Schedule Table, with default values
|
||||||
|
*/
|
||||||
|
public static function generateInitialData()
|
||||||
|
{
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
|
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||||
$toSave = array();
|
$toSave = [];
|
||||||
$services = array(
|
$services = [
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_UNPAUSE",
|
"title" => "ID_TASK_SCHEDULER_UNPAUSE",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "unpause",
|
"service" => "unpause",
|
||||||
@@ -64,9 +65,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_UNPAUSE_DESC"
|
"description" => "ID_TASK_SCHEDULER_UNPAUSE_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_CALCULATE_ELAPSED",
|
"title" => "ID_TASK_SCHEDULER_CALCULATE_ELAPSED",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "calculate",
|
"service" => "calculate",
|
||||||
@@ -77,9 +78,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => 'ID_TASK_SCHEDULER_CALCULATE_ELAPSED_DESC'
|
"description" => 'ID_TASK_SCHEDULER_CALCULATE_ELAPSED_DESC'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_UNASSIGNED",
|
"title" => "ID_TASK_SCHEDULER_UNASSIGNED",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "unassigned-case",
|
"service" => "unassigned-case",
|
||||||
@@ -90,9 +91,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => 'ID_TASK_SCHEDULER_UNASSIGNED_DESC'
|
"description" => 'ID_TASK_SCHEDULER_UNASSIGNED_DESC'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_CLEAN_SELF",
|
"title" => "ID_TASK_SCHEDULER_CLEAN_SELF",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "clean-self-service-tables",
|
"service" => "clean-self-service-tables",
|
||||||
@@ -103,9 +104,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => 'ID_TASK_SCHEDULER_CLEAN_SELF_DESC'
|
"description" => 'ID_TASK_SCHEDULER_CLEAN_SELF_DESC'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_CASE_EMAILS",
|
"title" => "ID_TASK_SCHEDULER_CASE_EMAILS",
|
||||||
"enable" => "1",
|
"enable" => "1",
|
||||||
"service" => "emails",
|
"service" => "emails",
|
||||||
@@ -116,9 +117,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_CASE_EMAILS_DESC"
|
"description" => "ID_TASK_SCHEDULER_CASE_EMAILS_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_ACTION_EMAIL",
|
"title" => "ID_TASK_SCHEDULER_ACTION_EMAIL",
|
||||||
"enable" => "1",
|
"enable" => "1",
|
||||||
"service" => "",
|
"service" => "",
|
||||||
@@ -129,9 +130,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_ACTION_EMAIL_DESC"
|
"description" => "ID_TASK_SCHEDULER_ACTION_EMAIL_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS",
|
"title" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS",
|
||||||
"enable" => "1",
|
"enable" => "1",
|
||||||
"service" => "",
|
"service" => "",
|
||||||
@@ -142,9 +143,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS_DESC"
|
"description" => "ID_TASK_SCHEDULER_MESSAGE_EVENTS_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_SEND_NOT",
|
"title" => "ID_TASK_SCHEDULER_SEND_NOT",
|
||||||
"enable" => "1",
|
"enable" => "1",
|
||||||
"service" => "",
|
"service" => "",
|
||||||
@@ -155,9 +156,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/5 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_SEND_NOT_DESC"
|
"description" => "ID_TASK_SCHEDULER_SEND_NOT_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_REPORT_USERS",
|
"title" => "ID_TASK_SCHEDULER_REPORT_USERS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "report_by_user",
|
"service" => "report_by_user",
|
||||||
@@ -168,25 +169,15 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC"
|
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_REPORT_PROCESS",
|
"title" => "ID_TASK_SCHEDULER_REPORT_PROCESS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "report_by_process",
|
"service" => "report_by_process",
|
||||||
"category" => "reporting",
|
"category" => "reporting",
|
||||||
"file" => "workflow/engine/bin/cron.php",
|
"file" => "workflow/engine/bin/cron.php",
|
||||||
"startingTime" => null,
|
"startingTime" => null,
|
||||||
"endingTime" => null,
|
|
||||||
"everyOn" => "1",
|
|
||||||
"interval" => "week",
|
|
||||||
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
|
||||||
"description" => "ID_TASK_SCHEDULER_REPORT_PROCESS_DESC"
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
"title" => "ID_TASK_SCHEDULER_CALCULATE_APP",
|
|
||||||
"enable" => "0",
|
|
||||||
"service" => "calculateapp",
|
|
||||||
"category" => "reporting",
|
"category" => "reporting",
|
||||||
"file" => "workflow/engine/bin/cron.php",
|
"file" => "workflow/engine/bin/cron.php",
|
||||||
"startingTime" => null,
|
"startingTime" => null,
|
||||||
@@ -194,9 +185,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
"expression" => "*/10 * * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC"
|
"description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_LDAP",
|
"title" => "ID_TASK_SCHEDULER_LDAP",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "",
|
"service" => "",
|
||||||
@@ -207,9 +198,9 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_LDAP"
|
"description" => "ID_TASK_SCHEDULER_LDAP"
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
"title" => "ID_TASK_SCHEDULER_PM_PLUGINS",
|
"title" => "ID_TASK_SCHEDULER_PM_PLUGINS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "plugins",
|
"service" => "plugins",
|
||||||
@@ -220,26 +211,25 @@ class TaskSchedulerBM
|
|||||||
"everyOn" => "1",
|
"everyOn" => "1",
|
||||||
"interval" => "week",
|
"interval" => "week",
|
||||||
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
"expression" => "0 */1 * * 0,1,2,3,4,5,6",
|
||||||
"description" => "ID_TASK_SCHEDULER_PM_PLUGINS_DESC"
|
"description" => "ID_TASK_SCHEDULER_PM_PLUGINS_DESC"
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
for($i = 0; $i < count($services); ++$i) {
|
foreach ($services as $service) {
|
||||||
$task = new TaskScheduler;
|
$task = new TaskScheduler;
|
||||||
$task->title = $services[$i]["title"];
|
$task->title = $service["title"];
|
||||||
$task->category = $services[$i]["category"];
|
$task->category = $service["category"];
|
||||||
$task->description = $services[$i]["description"];
|
$task->description = $service["description"];
|
||||||
$task->startingTime = $services[$i]["startingTime"];
|
$task->startingTime = $service["startingTime"];
|
||||||
$task->endingTime = $services[$i]["endingTime"];
|
$task->endingTime = $service["endingTime"];
|
||||||
$task->body = 'su -s /bin/sh -c "php '. PATH_TRUNK . $services[$i]["file"] . " " . $services[$i]["service"] . ' +w' . config("system.workspace") . ' +force"';
|
$task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force"';
|
||||||
$task->expression = $services[$i]["expression"];
|
$task->expression = $service["expression"];
|
||||||
$task->type = "shell";
|
$task->type = "shell";
|
||||||
$task->system = 1;
|
$task->system = 1;
|
||||||
//$task->timezone = $arraySystemConfiguration['time_zone'];
|
$task->enable = $service["enable"];
|
||||||
$task->enable = $services[$i]["enable"];
|
$task->everyOn = $service["everyOn"];
|
||||||
$task->everyOn = $services[$i]["everyOn"];
|
$task->interval = $service["interval"];
|
||||||
$task->interval = $services[$i]["interval"];
|
$task->save();
|
||||||
$task->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,7 @@
|
|||||||
namespace ProcessMaker\Model;
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
use \Illuminate\Database\Eloquent\Model;
|
use \Illuminate\Database\Eloquent\Model;
|
||||||
use \Illuminate\Support\Facades\DB;
|
|
||||||
use \Cron\CronExpression;
|
|
||||||
use \Illuminate\Support\Carbon;
|
|
||||||
use \Illuminate\Console\Scheduling\ManagesFrequencies;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
/**
|
/**
|
||||||
* Class TaskScheduler
|
* Class TaskScheduler
|
||||||
* @package ProcessMaker\Model
|
* @package ProcessMaker\Model
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\Services\Api;
|
namespace ProcessMaker\Services\Api;
|
||||||
|
|
||||||
use \ProcessMaker\Services\Api;
|
use Exception;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Luracast\Restler\RestException;
|
||||||
use \Luracast\Restler\RestException;
|
|
||||||
use \ProcessMaker\Model\TaskScheduler;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use ProcessMaker\BusinessModel\TaskSchedulerBM;
|
use ProcessMaker\BusinessModel\TaskSchedulerBM;
|
||||||
|
use ProcessMaker\Services\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TaskScheduler Controller
|
* TaskScheduler Controller
|
||||||
*
|
*
|
||||||
@@ -15,19 +14,24 @@ use ProcessMaker\BusinessModel\TaskSchedulerBM;
|
|||||||
class Scheduler extends Api
|
class Scheduler extends Api
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Returns the records of SchedulerTask by category
|
||||||
* @url GET
|
* @url GET
|
||||||
*
|
*
|
||||||
* @param string $category
|
* @param string $category
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function doGet($category = null) {
|
public function doGet($category = null) {
|
||||||
try {
|
try {
|
||||||
return TaskSchedulerBM::getSchedule($category);
|
return TaskSchedulerBM::getSchedule($category);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Receive the options sent from Scheduler UI
|
||||||
* @url POST
|
* @url POST
|
||||||
* @status 200
|
* @status 200
|
||||||
*
|
*
|
||||||
@@ -37,10 +41,10 @@ class Scheduler extends Api
|
|||||||
* @throws RestException
|
* @throws RestException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function doPost(array $request_data) {
|
public function doPost(array $request) {
|
||||||
try {
|
try {
|
||||||
return TaskSchedulerBM::saveSchedule($request_data);
|
return TaskSchedulerBM::saveSchedule($request);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
workflow/engine/templates/scheduler/index.html
Normal file
12
workflow/engine/templates/scheduler/index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
<script type="text/javascript" src="{$translation}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var server = "{$server}";
|
||||||
|
var credentials = {$credentials};
|
||||||
|
var category = "{$category}";
|
||||||
|
var lang = "{$lang}";
|
||||||
|
var workspace = "{$workspace}";
|
||||||
|
var timezoneArray = {$timezoneArray};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user