update translation
update labels default in task scheduler fix default values in initial data and fix problem with interval weeks update user in commands crons remove po_to_json Remove Gem to_po_json Fix scheduler with months and years fix command calculateApp
This commit is contained in:
29
Rakefile
29
Rakefile
@@ -1,16 +1,5 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'json'
|
require 'json'
|
||||||
require "po_to_json"
|
|
||||||
|
|
||||||
class PoToJson
|
|
||||||
def _generate_for_json(language, overwrite = {})
|
|
||||||
@options = parse_options(overwrite.merge(language: language))
|
|
||||||
#parse_document
|
|
||||||
#@parsed ||= inject_meta(parse_document)
|
|
||||||
generated = build_json_for(parse_document)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
desc "Default Task - Build Library"
|
desc "Default Task - Build Library"
|
||||||
task :default => [:required] do
|
task :default => [:required] do
|
||||||
@@ -79,16 +68,6 @@ task :build => [:required] do
|
|||||||
mafeHash = getHash(Dir.pwd + "/vendor/colosa/MichelangeloFE")
|
mafeHash = getHash(Dir.pwd + "/vendor/colosa/MichelangeloFE")
|
||||||
pmdynaformHash = getHash(Dir.pwd + "/vendor/colosa/pmDynaform")
|
pmdynaformHash = getHash(Dir.pwd + "/vendor/colosa/pmDynaform")
|
||||||
|
|
||||||
puts "Building PO to JSON".cyan
|
|
||||||
|
|
||||||
Dir["#{Dir.pwd}/workflow/engine/content/translations/*.po"].each do |file|
|
|
||||||
lang = file.split('.')
|
|
||||||
json_string = PoToJson.new(file)._generate_for_json(lang[1], :pretty => true)
|
|
||||||
File.open("#{Dir.pwd}/workflow/public_html/translations/#{lang[1]}.json",'w').write(json_string)
|
|
||||||
puts file
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
puts "Building file: Task Scheduler".cyan
|
puts "Building file: Task Scheduler".cyan
|
||||||
system "npm run build --prefix #{Dir.pwd}/vendor/colosa/taskscheduler"
|
system "npm run build --prefix #{Dir.pwd}/vendor/colosa/taskscheduler"
|
||||||
system "cp -Rf #{Dir.pwd}/vendor/colosa/taskscheduler/taskscheduler #{targetDir}/taskscheduler"
|
system "cp -Rf #{Dir.pwd}/vendor/colosa/taskscheduler/taskscheduler #{targetDir}/taskscheduler"
|
||||||
@@ -491,11 +470,3 @@ def getLog
|
|||||||
output = `git log -30 --pretty='[%cr] %h %d %s <%an>' --no-merges`
|
output = `git log -30 --pretty='[%cr] %h %d %s <%an>' --no-merges`
|
||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_for_json()
|
|
||||||
@overwrite = {pretty: false}
|
|
||||||
@options = parse_options(overwrite.merge(language: 'en'))
|
|
||||||
@parsed ||= inject_meta(parse_document)
|
|
||||||
|
|
||||||
generated = build_json_for(build_json_for(@parsed))
|
|
||||||
end
|
|
||||||
@@ -26,6 +26,7 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
$this->signature = "schedule:run";
|
$this->signature = "schedule:run";
|
||||||
$this->signature .= '
|
$this->signature .= '
|
||||||
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
|
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
|
||||||
|
{--user=apache : ProcessMaker Indicates the user to execute the crons.}
|
||||||
{--processmakerPath=./ : ProcessMaker path.}
|
{--processmakerPath=./ : ProcessMaker path.}
|
||||||
';
|
';
|
||||||
$this->description .= ' (ProcessMaker has extended this command)';
|
$this->description .= ' (ProcessMaker has extended this command)';
|
||||||
@@ -41,46 +42,60 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
{
|
{
|
||||||
$that = $this;
|
$that = $this;
|
||||||
$workspace = $this->option('workspace');
|
$workspace = $this->option('workspace');
|
||||||
|
$user = $this->option('user');
|
||||||
if (!empty($workspace)) {
|
if (!empty($workspace)) {
|
||||||
$webApplication = new WebApplication();
|
$webApplication = new WebApplication();
|
||||||
$webApplication->setRootDir($this->option('processmakerPath'));
|
$webApplication->setRootDir($this->option('processmakerPath'));
|
||||||
$webApplication->loadEnvironment($workspace, false);
|
$webApplication->loadEnvironment($workspace, false);
|
||||||
}
|
}
|
||||||
TaskScheduler::all()->each(function ($p) use ($that) {
|
TaskScheduler::all()->each(function ($p) use ($that, $user) {
|
||||||
$starting = isset($p->startingTime) ? $p->startingTime : "0:00";
|
if ($p->enable == 1) {
|
||||||
$ending = isset($p->startingTime) ? $p->endingTime : "23:59";
|
$starting = isset($p->startingTime) ? $p->startingTime : "0:00";
|
||||||
$timezone = isset($p->timezone) && $p->timezone != ""? $p->timezone: date_default_timezone_get();
|
$ending = isset($p->startingTime) ? $p->endingTime : "23:59";
|
||||||
$that->schedule->exec($p->body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) {
|
|
||||||
$now = Carbon::now();
|
$timezone = isset($p->timezone) && $p->timezone != "" ? $p->timezone : date_default_timezone_get();
|
||||||
$result = false;
|
$body = str_replace("-c", $user . " -c", $p->body);
|
||||||
$datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update);
|
$that->schedule->exec($body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) {
|
||||||
if (isset($p->everyOn)) {
|
$now = Carbon::now();
|
||||||
switch ($p->interval) {
|
$result = false;
|
||||||
case "day":
|
$datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update);
|
||||||
$interval = $now->diffInDays($datework);
|
if (isset($p->everyOn)) {
|
||||||
$result = ($interval !== 0 && ($interval % intval($p->everyOn)) == 0);
|
switch ($p->interval) {
|
||||||
break;
|
case "day":
|
||||||
case "week":
|
$interval = $now->diffInDays($datework);
|
||||||
$interval = $now->diffInDays($datework);
|
$result = ($interval !== 0 && ($interval % intval($p->everyOn)) == 0);
|
||||||
$result = ($interval !== 0 && $interval % (intval($p->everyOn) * 7) == 0);
|
break;
|
||||||
break;
|
case "week":
|
||||||
case "month":
|
$diff = $now->diffInDays($datework);
|
||||||
$interval = $now->diffInMonths($datework);
|
if ($diff % (intval($p->everyOn) * 7) < 7 && $diff % (intval($p->everyOn) * 7) >= 0) {
|
||||||
$result = ($interval !== 0 && $interval % intval($p->everyOn) == 0);
|
$result = true;
|
||||||
break;
|
} else {
|
||||||
case "year":
|
$result = false;
|
||||||
$interval = $now->diffInYears($datework);
|
}
|
||||||
$result = ($interval !== 0 && $interval % intval($p->everyOn) == 0);
|
break;
|
||||||
break;
|
case "month":
|
||||||
|
$interval = $now->diffInMonths($datework);
|
||||||
|
if ($interval % intval($p->everyOn) == 0) {
|
||||||
|
$result = true;
|
||||||
|
} else {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "year":
|
||||||
|
$interval = $now->diffInYears($datework);
|
||||||
|
if ($interval % intval($p->everyOn) == 0) {
|
||||||
|
$result = true;
|
||||||
|
} else {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
return $result;
|
return true;
|
||||||
}
|
});
|
||||||
return true;
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
parent::handle();
|
parent::handle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -158,7 +158,7 @@ class TaskSchedulerBM
|
|||||||
"description" => "ID_TASK_SCHEDULER_SEND_NOT_DESC"
|
"description" => "ID_TASK_SCHEDULER_SEND_NOT_DESC"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"title" => "ID_TASK_SCHEDULER_REPORT_BY_USER",
|
"title" => "ID_TASK_SCHEDULER_REPORT_USERS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "report_by_user",
|
"service" => "report_by_user",
|
||||||
"category" => "reporting",
|
"category" => "reporting",
|
||||||
@@ -168,10 +168,10 @@ 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_BY_USER_DESC"
|
"description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"title" => "ID_TASK_SCHEDULER_REPORT_BY_PROCESS",
|
"title" => "ID_TASK_SCHEDULER_REPORT_PROCESS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "report_by_process",
|
"service" => "report_by_process",
|
||||||
"category" => "reporting",
|
"category" => "reporting",
|
||||||
@@ -181,12 +181,12 @@ 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_BY_PROCESS_DESC"
|
"description" => "ID_TASK_SCHEDULER_REPORT_PROCESS_DESC"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"title" => "ID_TASK_SCHEDULER_CALCULATE_APP",
|
"title" => "ID_TASK_SCHEDULER_CALCULATE_APP",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "report_by_process",
|
"service" => "calculateapp",
|
||||||
"category" => "reporting",
|
"category" => "reporting",
|
||||||
"file" => "workflow/engine/bin/cron.php",
|
"file" => "workflow/engine/bin/cron.php",
|
||||||
"startingTime" => null,
|
"startingTime" => null,
|
||||||
@@ -210,17 +210,17 @@ class TaskSchedulerBM
|
|||||||
"description" => "ID_TASK_SCHEDULER_LDAP"
|
"description" => "ID_TASK_SCHEDULER_LDAP"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"title" => "ID_TASK_SCHEDULER_PLUGINS",
|
"title" => "ID_TASK_SCHEDULER_PM_PLUGINS",
|
||||||
"enable" => "0",
|
"enable" => "0",
|
||||||
"service" => "plugins",
|
"service" => "plugins",
|
||||||
"category" => "plugins",
|
"category" => "plugins",
|
||||||
"file" => "workflow/engine/bin/ldapcron.php",
|
"file" => "workflow/engine/bin/cron.php",
|
||||||
"startingTime" => "0:00",
|
"startingTime" => "0:00",
|
||||||
"endingTime" => "0:30",
|
"endingTime" => "0:30",
|
||||||
"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_PLUGINS_DESC"
|
"description" => "ID_TASK_SCHEDULER_PM_PLUGINS_DESC"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user