diff --git a/Rakefile b/Rakefile
index 89b2d1882..a3f4ce34d 100755
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,17 @@
require 'rubygems'
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"
task :default => [:required] do
Rake::Task['build'].execute
@@ -67,9 +79,20 @@ task :build => [:required] do
mafeHash = getHash(Dir.pwd + "/vendor/colosa/MichelangeloFE")
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
system "npm run build --prefix #{Dir.pwd}/vendor/colosa/taskscheduler"
system "cp -Rf #{Dir.pwd}/vendor/colosa/taskscheduler/taskscheduler #{targetDir}/taskscheduler"
- system "cp #{Dir.pwd}/vendor/colosa/taskscheduler/taskscheduler/index.html #{targetDir}/taskscheduler"
+ system "cp #{Dir.pwd}/vendor/colosa/taskscheduler/public/index.html #{targetDir}/taskscheduler"
hashVendors = pmuiHash+"-"+mafeHash
## Building minified JS Files
@@ -469,3 +492,10 @@ def getLog
return output
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
\ No newline at end of file
diff --git a/app/Console/Commands/ScheduleRunCommand.php b/app/Console/Commands/ScheduleRunCommand.php
index 329a05e63..aed40ed22 100755
--- a/app/Console/Commands/ScheduleRunCommand.php
+++ b/app/Console/Commands/ScheduleRunCommand.php
@@ -1,4 +1,5 @@
description .= ' (ProcessMaker has extended this command)';
+ $this->description .= ' (ProcessMaker has extended this command)';
parent::__construct($schedule);
}
-
/**
* Execute the console command.
*
@@ -43,13 +45,37 @@ class ScheduleRunCommand extends BaseCommand
$webApplication->setRootDir($this->option('processmakerPath'));
$webApplication->loadEnvironment($workspace, false);
}
- TaskScheduler::all()->each(function($p) use ($that){
- if($p->isDue()){
- Log::info("Si se ejecuta" . $p->expression);
- }
- if($p->enable == '1'){
- $that->schedule->exec($p->body)->cron($p->expression)->between($p->startingTime, $p->endingTime);
- }
+ TaskScheduler::all()->each(function ($p) use ($that) {
+ $starting = isset($p->startingTime) ? $p->startingTime : "0:00";
+ $ending = isset($p->startingTime) ? $p->endingTime : "23:59";
+ $timezone = isset($p->timezone) && $p->timezone != ""? $p->timezone: date_default_timezone_get();
+ $that->schedule->exec($p->body)->cron($p->expression)->between($starting, $ending)->timezone($timezone)->when(function () use ($p) {
+ $now = Carbon::now();
+ $result = false;
+ $datework = Carbon::createFromFormat('Y-m-d H:i:s', $p->last_update);
+ if (isset($p->everyOn)) {
+ switch ($p->interval) {
+ case "day":
+ $interval = $now->diffInDays($datework);
+ $result = ($interval !== 0 && ($interval % intval($p->everyOn)) == 0);
+ break;
+ case "week":
+ $interval = $now->diffInDays($datework);
+ $result = ($interval !== 0 && $interval % (intval($p->everyOn) * 7) == 0);
+ break;
+ case "month":
+ $interval = $now->diffInMonths($datework);
+ $result = ($interval !== 0 && $interval % intval($p->everyOn) == 0);
+ break;
+ case "year":
+ $interval = $now->diffInYears($datework);
+ $result = ($interval !== 0 && $interval % intval($p->everyOn) == 0);
+ break;
+ }
+ return $result;
+ }
+ return true;
+ });
});
parent::handle();
}
diff --git a/composer.json b/composer.json
index 14f7f5d9e..5a433bb71 100644
--- a/composer.json
+++ b/composer.json
@@ -22,6 +22,10 @@
{
"type": "git",
"url": "git@bitbucket.org:colosa/pmui.git"
+ },
+ {
+ "type": "git",
+ "url": "git@bitbucket.org:colosa/taskscheduler.git"
}
],
"minimum-stability": "dev",
@@ -34,6 +38,7 @@
"colosa/pmui": "release/3.4.8-dev",
"colosa/michelangelofe": "release/3.4.8-dev",
"colosa/pmdynaform": "release/3.4.8-dev",
+ "colosa/taskscheduler": "0.1.0",
"google/apiclient": "1.1.6",
"dapphp/securimage": "^3.6",
"psr/log": "1.0.0",
diff --git a/composer.lock b/composer.lock
index dde7a6aed..f95471e72 100644
--- a/composer.lock
+++ b/composer.lock
@@ -146,6 +146,21 @@
],
"time": "2020-03-10T12:38:14+00:00"
},
+ {
+ "name": "colosa/taskscheduler",
+ "version": "0.1.0",
+ "source": {
+ "type": "git",
+ "url": "git@bitbucket.org:colosa/taskscheduler.git",
+ "reference": "master"
+ },
+ "type": "library",
+ "description": "JS Library to render ProcessMaker Task Scheduler",
+ "homepage": "http://processmaker.com",
+ "keywords": [
+ "Vue js lib ProcessMaker Task Scheduler"
+ ]
+ },
{
"name": "colosa/pmUI",
"version": "dev-release/3.4.8",
diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php
index 37ce496aa..cdbf10532 100644
--- a/gulliver/system/class.rbac.php
+++ b/gulliver/system/class.rbac.php
@@ -615,6 +615,11 @@ class RBAC
'PER_UID' => '00000000000000000000000000000068',
'PER_CODE' => 'PM_FOLDERS_OWNER',
'PER_NAME' => 'View Your Folders'
+ ],
+ [
+ 'PER_UID' => '00000000000000000000000000000069',
+ 'PER_CODE' => 'PM_TASK_SCHEDULER_ADMIN',
+ 'PER_NAME' => 'View Task Scheduler'
]
];
diff --git a/rbac/engine/data/mysql/insert.sql b/rbac/engine/data/mysql/insert.sql
old mode 100644
new mode 100755
index e01cb604b..e0a874e31
--- a/rbac/engine/data/mysql/insert.sql
+++ b/rbac/engine/data/mysql/insert.sql
@@ -68,6 +68,9 @@ INSERT INTO `RBAC_PERMISSIONS` VALUES
('00000000000000000000000000000067','PM_SETUP_LOG_FILES','2018-02-06 00:00:00','2018-02-06 00:00:00',1,'00000000000000000000000000000002'),
('00000000000000000000000000000068','PM_FOLDERS_OWNER','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
+INSERT INTO `RBAC_PERMISSIONS` VALUES
+('00000000000000000000000000000069','PM_TASK_SCHEDULER_ADMIN','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
+
INSERT INTO `RBAC_ROLES` VALUES
('00000000000000000000000000000001','','00000000000000000000000000000001','RBAC_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
('00000000000000000000000000000002','','00000000000000000000000000000002','PROCESSMAKER_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
@@ -144,6 +147,7 @@ INSERT INTO `RBAC_ROLES_PERMISSIONS` VALUES
('00000000000000000000000000000002','00000000000000000000000000000065'),
('00000000000000000000000000000002','00000000000000000000000000000067'),
('00000000000000000000000000000002','00000000000000000000000000000068'),
+('00000000000000000000000000000002','00000000000000000000000000000069'),
('00000000000000000000000000000003','00000000000000000000000000000001'),
('00000000000000000000000000000003','00000000000000000000000000000005'),
('00000000000000000000000000000003','00000000000000000000000000000040'),
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php
index ebc29c3ee..794dd14f2 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php
@@ -15,7 +15,7 @@ class VariableTest extends TestCase
/**
* Test it create variables related to the process
*
- * @covers \ProcessMaker\BusinessModel\Variables::create()
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
* @test
*/
public function it_create_variable_by_process()
@@ -62,7 +62,7 @@ class VariableTest extends TestCase
/**
* Tests the exception
*
- * @covers \ProcessMaker\BusinessModel\Variables::create()
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
* @test
*/
public function it_return_an_exception_when_var_name_is_empty()
@@ -94,7 +94,7 @@ class VariableTest extends TestCase
/**
* Tests the exception
*
- * @covers \ProcessMaker\BusinessModel\Variables::create()
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
* @test
*/
public function it_return_an_exception_when_var_field_type_is_empty()
@@ -126,7 +126,7 @@ class VariableTest extends TestCase
/**
* Tests the exception
*
- * @covers \ProcessMaker\BusinessModel\Variables::create()
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
* @test
*/
public function it_return_an_exception_when_var_label_is_empty()
@@ -158,7 +158,7 @@ class VariableTest extends TestCase
/**
* Test it return the variables related to the PRO_UID
*
- * @covers \ProcessMaker\BusinessModel\Variables::getVariables()
+ * @covers \ProcessMaker\BusinessModel\Variable::getVariables()
* @test
*/
public function it_list_variables_by_process()
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
index 1cf6ae13a..dda3d3677 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
@@ -233,7 +233,7 @@ class XmlImporterTest extends TestCase
* Test the import new option and the import new group option with repeated title.
* @test
* @covers \ProcessMaker\Importer\XmlImporter::import()
- * @covers \ProcessMaker\Importer\XmlImporter::updateTheProcessOwner()
+ * @covers \ProcessMaker\Importer\XmlImporter::updateProcessInformation()
*/
public function it_should_matter_with_import_option_create_new_and_group_import_option_create_new_try_rename_title()
{
diff --git a/workflow/engine/classes/model/map/SchedulerMapBuilder.php b/workflow/engine/classes/model/map/SchedulerMapBuilder.php
index fd1a1006c..b7d26b434 100755
--- a/workflow/engine/classes/model/map/SchedulerMapBuilder.php
+++ b/workflow/engine/classes/model/map/SchedulerMapBuilder.php
@@ -73,6 +73,10 @@ class SchedulerMapBuilder
$tMap->addColumn('ENDINGTIME', 'Endingtime', 'string', CreoleTypes::VARCHAR, false, 100);
+ $tMap->addColumn('EVERYON', 'Everyon', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('INTERVAL', 'Interval', 'string', CreoleTypes::VARCHAR, false, 10);
+
$tMap->addColumn('DESCRIPTION', 'Description', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('EXPRESSION', 'Expression', 'string', CreoleTypes::VARCHAR, false, 255);
@@ -89,6 +93,10 @@ class SchedulerMapBuilder
$tMap->addColumn('ENABLE', 'Enable', 'int', CreoleTypes::TINYINT, false, 3);
+ $tMap->addColumn('CREATION_DATE', 'CreationDate', 'int', CreoleTypes::TIMESTAMP, false, null);
+
+ $tMap->addColumn('LAST_UPDATE', 'LastUpdate', 'int', CreoleTypes::TIMESTAMP, false, null);
+
} // doBuild()
} // SchedulerMapBuilder
diff --git a/workflow/engine/classes/model/om/BaseScheduler.php b/workflow/engine/classes/model/om/BaseScheduler.php
new file mode 100644
index 000000000..13e9b2dec
--- /dev/null
+++ b/workflow/engine/classes/model/om/BaseScheduler.php
@@ -0,0 +1,1438 @@
+id;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+
+ return $this->title;
+ }
+
+ /**
+ * Get the [startingtime] column value.
+ *
+ * @return string
+ */
+ public function getStartingtime()
+ {
+
+ return $this->startingtime;
+ }
+
+ /**
+ * Get the [endingtime] column value.
+ *
+ * @return string
+ */
+ public function getEndingtime()
+ {
+
+ return $this->endingtime;
+ }
+
+ /**
+ * Get the [everyon] column value.
+ *
+ * @return string
+ */
+ public function getEveryon()
+ {
+
+ return $this->everyon;
+ }
+
+ /**
+ * Get the [interval] column value.
+ *
+ * @return string
+ */
+ public function getInterval()
+ {
+
+ return $this->interval;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [expression] column value.
+ *
+ * @return string
+ */
+ public function getExpression()
+ {
+
+ return $this->expression;
+ }
+
+ /**
+ * Get the [body] column value.
+ *
+ * @return string
+ */
+ public function getBody()
+ {
+
+ return $this->body;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Get the [category] column value.
+ *
+ * @return string
+ */
+ public function getCategory()
+ {
+
+ return $this->category;
+ }
+
+ /**
+ * Get the [system] column value.
+ *
+ * @return int
+ */
+ public function getSystem()
+ {
+
+ return $this->system;
+ }
+
+ /**
+ * Get the [timezone] column value.
+ *
+ * @return string
+ */
+ public function getTimezone()
+ {
+
+ return $this->timezone;
+ }
+
+ /**
+ * Get the [enable] column value.
+ *
+ * @return int
+ */
+ public function getEnable()
+ {
+
+ return $this->enable;
+ }
+
+ /**
+ * Get the [optionally formatted] [creation_date] column value.
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the integer unix timestamp will be returned.
+ * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
+ * @throws PropelException - if unable to convert the date/time to timestamp.
+ */
+ public function getCreationDate($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->creation_date === null || $this->creation_date === '') {
+ return null;
+ } elseif (!is_int($this->creation_date)) {
+ // a non-timestamp value was set externally, so we convert it
+ $ts = strtotime($this->creation_date);
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse value of [creation_date] as date/time value: " .
+ var_export($this->creation_date, true));
+ }
+ } else {
+ $ts = $this->creation_date;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] [last_update] column value.
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the integer unix timestamp will be returned.
+ * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
+ * @throws PropelException - if unable to convert the date/time to timestamp.
+ */
+ public function getLastUpdate($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->last_update === null || $this->last_update === '') {
+ return null;
+ } elseif (!is_int($this->last_update)) {
+ // a non-timestamp value was set externally, so we convert it
+ $ts = strtotime($this->last_update);
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse value of [last_update] as date/time value: " .
+ var_export($this->last_update, true));
+ }
+ } else {
+ $ts = $this->last_update;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setId($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = SchedulerPeer::ID;
+ }
+
+ } // setId()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setTitle($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = SchedulerPeer::TITLE;
+ }
+
+ } // setTitle()
+
+ /**
+ * Set the value of [startingtime] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setStartingtime($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->startingtime !== $v) {
+ $this->startingtime = $v;
+ $this->modifiedColumns[] = SchedulerPeer::STARTINGTIME;
+ }
+
+ } // setStartingtime()
+
+ /**
+ * Set the value of [endingtime] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setEndingtime($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->endingtime !== $v) {
+ $this->endingtime = $v;
+ $this->modifiedColumns[] = SchedulerPeer::ENDINGTIME;
+ }
+
+ } // setEndingtime()
+
+ /**
+ * Set the value of [everyon] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setEveryon($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->everyon !== $v) {
+ $this->everyon = $v;
+ $this->modifiedColumns[] = SchedulerPeer::EVERYON;
+ }
+
+ } // setEveryon()
+
+ /**
+ * Set the value of [interval] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setInterval($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->interval !== $v) {
+ $this->interval = $v;
+ $this->modifiedColumns[] = SchedulerPeer::INTERVAL;
+ }
+
+ } // setInterval()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setDescription($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = SchedulerPeer::DESCRIPTION;
+ }
+
+ } // setDescription()
+
+ /**
+ * Set the value of [expression] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setExpression($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->expression !== $v) {
+ $this->expression = $v;
+ $this->modifiedColumns[] = SchedulerPeer::EXPRESSION;
+ }
+
+ } // setExpression()
+
+ /**
+ * Set the value of [body] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setBody($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->body !== $v) {
+ $this->body = $v;
+ $this->modifiedColumns[] = SchedulerPeer::BODY;
+ }
+
+ } // setBody()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setType($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = SchedulerPeer::TYPE;
+ }
+
+ } // setType()
+
+ /**
+ * Set the value of [category] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setCategory($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->category !== $v) {
+ $this->category = $v;
+ $this->modifiedColumns[] = SchedulerPeer::CATEGORY;
+ }
+
+ } // setCategory()
+
+ /**
+ * Set the value of [system] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setSystem($v)
+ {
+
+ // Since the native PHP type for this column is integer,
+ // we will cast the input value to an int (if it is not).
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->system !== $v) {
+ $this->system = $v;
+ $this->modifiedColumns[] = SchedulerPeer::SYSTEM;
+ }
+
+ } // setSystem()
+
+ /**
+ * Set the value of [timezone] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setTimezone($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->timezone !== $v) {
+ $this->timezone = $v;
+ $this->modifiedColumns[] = SchedulerPeer::TIMEZONE;
+ }
+
+ } // setTimezone()
+
+ /**
+ * Set the value of [enable] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setEnable($v)
+ {
+
+ // Since the native PHP type for this column is integer,
+ // we will cast the input value to an int (if it is not).
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->enable !== $v) {
+ $this->enable = $v;
+ $this->modifiedColumns[] = SchedulerPeer::ENABLE;
+ }
+
+ } // setEnable()
+
+ /**
+ * Set the value of [creation_date] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setCreationDate($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ //Date/time accepts null values
+ if ($v == '') {
+ $ts = null;
+ }
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse date/time value for [creation_date] from input: " .
+ var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->creation_date !== $ts) {
+ $this->creation_date = $ts;
+ $this->modifiedColumns[] = SchedulerPeer::CREATION_DATE;
+ }
+
+ } // setCreationDate()
+
+ /**
+ * Set the value of [last_update] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setLastUpdate($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ //Date/time accepts null values
+ if ($v == '') {
+ $ts = null;
+ }
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse date/time value for [last_update] from input: " .
+ var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->last_update !== $ts) {
+ $this->last_update = $ts;
+ $this->modifiedColumns[] = SchedulerPeer::LAST_UPDATE;
+ }
+
+ } // setLastUpdate()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (1-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
+ * @param int $startcol 1-based offset column which indicates which restultset column to start with.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getString($startcol + 0);
+
+ $this->title = $rs->getString($startcol + 1);
+
+ $this->startingtime = $rs->getString($startcol + 2);
+
+ $this->endingtime = $rs->getString($startcol + 3);
+
+ $this->everyon = $rs->getString($startcol + 4);
+
+ $this->interval = $rs->getString($startcol + 5);
+
+ $this->description = $rs->getString($startcol + 6);
+
+ $this->expression = $rs->getString($startcol + 7);
+
+ $this->body = $rs->getString($startcol + 8);
+
+ $this->type = $rs->getString($startcol + 9);
+
+ $this->category = $rs->getString($startcol + 10);
+
+ $this->system = $rs->getInt($startcol + 11);
+
+ $this->timezone = $rs->getString($startcol + 12);
+
+ $this->enable = $rs->getInt($startcol + 13);
+
+ $this->creation_date = $rs->getTimestamp($startcol + 14, null);
+
+ $this->last_update = $rs->getTimestamp($startcol + 15, null);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ // FIXME - using NUM_COLUMNS may be clearer.
+ return $startcol + 16; // 16 = SchedulerPeer::NUM_COLUMNS - SchedulerPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Scheduler object", $e);
+ }
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param Connection $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(SchedulerPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ SchedulerPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database. If the object is new,
+ * it inserts it; otherwise an update is performed. This method
+ * wraps the doSave() worker method in a transaction.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(SchedulerPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update and any referring
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave($con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = SchedulerPeer::doInsert($this, $con);
+ $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
+ // should always be true here (even though technically
+ // BasePeer::doInsert() can insert multiple rows).
+
+ $this->setId($pk); //[IMV] update autoincrement primary key
+
+ $this->setNew(false);
+ } else {
+ $affectedRows += SchedulerPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass;
+ array of ValidationFailed objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = SchedulerPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = SchedulerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getTitle();
+ break;
+ case 2:
+ return $this->getStartingtime();
+ break;
+ case 3:
+ return $this->getEndingtime();
+ break;
+ case 4:
+ return $this->getEveryon();
+ break;
+ case 5:
+ return $this->getInterval();
+ break;
+ case 6:
+ return $this->getDescription();
+ break;
+ case 7:
+ return $this->getExpression();
+ break;
+ case 8:
+ return $this->getBody();
+ break;
+ case 9:
+ return $this->getType();
+ break;
+ case 10:
+ return $this->getCategory();
+ break;
+ case 11:
+ return $this->getSystem();
+ break;
+ case 12:
+ return $this->getTimezone();
+ break;
+ case 13:
+ return $this->getEnable();
+ break;
+ case 14:
+ return $this->getCreationDate();
+ break;
+ case 15:
+ return $this->getLastUpdate();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = SchedulerPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getTitle(),
+ $keys[2] => $this->getStartingtime(),
+ $keys[3] => $this->getEndingtime(),
+ $keys[4] => $this->getEveryon(),
+ $keys[5] => $this->getInterval(),
+ $keys[6] => $this->getDescription(),
+ $keys[7] => $this->getExpression(),
+ $keys[8] => $this->getBody(),
+ $keys[9] => $this->getType(),
+ $keys[10] => $this->getCategory(),
+ $keys[11] => $this->getSystem(),
+ $keys[12] => $this->getTimezone(),
+ $keys[13] => $this->getEnable(),
+ $keys[14] => $this->getCreationDate(),
+ $keys[15] => $this->getLastUpdate(),
+ );
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = SchedulerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setTitle($value);
+ break;
+ case 2:
+ $this->setStartingtime($value);
+ break;
+ case 3:
+ $this->setEndingtime($value);
+ break;
+ case 4:
+ $this->setEveryon($value);
+ break;
+ case 5:
+ $this->setInterval($value);
+ break;
+ case 6:
+ $this->setDescription($value);
+ break;
+ case 7:
+ $this->setExpression($value);
+ break;
+ case 8:
+ $this->setBody($value);
+ break;
+ case 9:
+ $this->setType($value);
+ break;
+ case 10:
+ $this->setCategory($value);
+ break;
+ case 11:
+ $this->setSystem($value);
+ break;
+ case 12:
+ $this->setTimezone($value);
+ break;
+ case 13:
+ $this->setEnable($value);
+ break;
+ case 14:
+ $this->setCreationDate($value);
+ break;
+ case 15:
+ $this->setLastUpdate($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
+ * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = SchedulerPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) {
+ $this->setId($arr[$keys[0]]);
+ }
+
+ if (array_key_exists($keys[1], $arr)) {
+ $this->setTitle($arr[$keys[1]]);
+ }
+
+ if (array_key_exists($keys[2], $arr)) {
+ $this->setStartingtime($arr[$keys[2]]);
+ }
+
+ if (array_key_exists($keys[3], $arr)) {
+ $this->setEndingtime($arr[$keys[3]]);
+ }
+
+ if (array_key_exists($keys[4], $arr)) {
+ $this->setEveryon($arr[$keys[4]]);
+ }
+
+ if (array_key_exists($keys[5], $arr)) {
+ $this->setInterval($arr[$keys[5]]);
+ }
+
+ if (array_key_exists($keys[6], $arr)) {
+ $this->setDescription($arr[$keys[6]]);
+ }
+
+ if (array_key_exists($keys[7], $arr)) {
+ $this->setExpression($arr[$keys[7]]);
+ }
+
+ if (array_key_exists($keys[8], $arr)) {
+ $this->setBody($arr[$keys[8]]);
+ }
+
+ if (array_key_exists($keys[9], $arr)) {
+ $this->setType($arr[$keys[9]]);
+ }
+
+ if (array_key_exists($keys[10], $arr)) {
+ $this->setCategory($arr[$keys[10]]);
+ }
+
+ if (array_key_exists($keys[11], $arr)) {
+ $this->setSystem($arr[$keys[11]]);
+ }
+
+ if (array_key_exists($keys[12], $arr)) {
+ $this->setTimezone($arr[$keys[12]]);
+ }
+
+ if (array_key_exists($keys[13], $arr)) {
+ $this->setEnable($arr[$keys[13]]);
+ }
+
+ if (array_key_exists($keys[14], $arr)) {
+ $this->setCreationDate($arr[$keys[14]]);
+ }
+
+ if (array_key_exists($keys[15], $arr)) {
+ $this->setLastUpdate($arr[$keys[15]]);
+ }
+
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(SchedulerPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(SchedulerPeer::ID)) {
+ $criteria->add(SchedulerPeer::ID, $this->id);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::TITLE)) {
+ $criteria->add(SchedulerPeer::TITLE, $this->title);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::STARTINGTIME)) {
+ $criteria->add(SchedulerPeer::STARTINGTIME, $this->startingtime);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::ENDINGTIME)) {
+ $criteria->add(SchedulerPeer::ENDINGTIME, $this->endingtime);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::EVERYON)) {
+ $criteria->add(SchedulerPeer::EVERYON, $this->everyon);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::INTERVAL)) {
+ $criteria->add(SchedulerPeer::INTERVAL, $this->interval);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::DESCRIPTION)) {
+ $criteria->add(SchedulerPeer::DESCRIPTION, $this->description);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::EXPRESSION)) {
+ $criteria->add(SchedulerPeer::EXPRESSION, $this->expression);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::BODY)) {
+ $criteria->add(SchedulerPeer::BODY, $this->body);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::TYPE)) {
+ $criteria->add(SchedulerPeer::TYPE, $this->type);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::CATEGORY)) {
+ $criteria->add(SchedulerPeer::CATEGORY, $this->category);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::SYSTEM)) {
+ $criteria->add(SchedulerPeer::SYSTEM, $this->system);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::TIMEZONE)) {
+ $criteria->add(SchedulerPeer::TIMEZONE, $this->timezone);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::ENABLE)) {
+ $criteria->add(SchedulerPeer::ENABLE, $this->enable);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::CREATION_DATE)) {
+ $criteria->add(SchedulerPeer::CREATION_DATE, $this->creation_date);
+ }
+
+ if ($this->isColumnModified(SchedulerPeer::LAST_UPDATE)) {
+ $criteria->add(SchedulerPeer::LAST_UPDATE, $this->last_update);
+ }
+
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(SchedulerPeer::DATABASE_NAME);
+
+ $criteria->add(SchedulerPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of Scheduler (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setTitle($this->title);
+
+ $copyObj->setStartingtime($this->startingtime);
+
+ $copyObj->setEndingtime($this->endingtime);
+
+ $copyObj->setEveryon($this->everyon);
+
+ $copyObj->setInterval($this->interval);
+
+ $copyObj->setDescription($this->description);
+
+ $copyObj->setExpression($this->expression);
+
+ $copyObj->setBody($this->body);
+
+ $copyObj->setType($this->type);
+
+ $copyObj->setCategory($this->category);
+
+ $copyObj->setSystem($this->system);
+
+ $copyObj->setTimezone($this->timezone);
+
+ $copyObj->setEnable($this->enable);
+
+ $copyObj->setCreationDate($this->creation_date);
+
+ $copyObj->setLastUpdate($this->last_update);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL); // this is a pkey column, so set to default value
+
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return Scheduler Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return SchedulerPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new SchedulerPeer();
+ }
+ return self::$peer;
+ }
+}
+
diff --git a/workflow/engine/classes/model/om/BaseSchedulerPeer.php b/workflow/engine/classes/model/om/BaseSchedulerPeer.php
new file mode 100644
index 000000000..e723f4ccc
--- /dev/null
+++ b/workflow/engine/classes/model/om/BaseSchedulerPeer.php
@@ -0,0 +1,644 @@
+ array ('Id', 'Title', 'Startingtime', 'Endingtime', 'Everyon', 'Interval', 'Description', 'Expression', 'Body', 'Type', 'Category', 'System', 'Timezone', 'Enable', 'CreationDate', 'LastUpdate', ),
+ BasePeer::TYPE_COLNAME => array (SchedulerPeer::ID, SchedulerPeer::TITLE, SchedulerPeer::STARTINGTIME, SchedulerPeer::ENDINGTIME, SchedulerPeer::EVERYON, SchedulerPeer::INTERVAL, SchedulerPeer::DESCRIPTION, SchedulerPeer::EXPRESSION, SchedulerPeer::BODY, SchedulerPeer::TYPE, SchedulerPeer::CATEGORY, SchedulerPeer::SYSTEM, SchedulerPeer::TIMEZONE, SchedulerPeer::ENABLE, SchedulerPeer::CREATION_DATE, SchedulerPeer::LAST_UPDATE, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'startingTime', 'endingTime', 'everyOn', 'interval', 'description', 'expression', 'body', 'type', 'category', 'system', 'timezone', 'enable', 'creation_date', 'last_update', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Title' => 1, 'Startingtime' => 2, 'Endingtime' => 3, 'Everyon' => 4, 'Interval' => 5, 'Description' => 6, 'Expression' => 7, 'Body' => 8, 'Type' => 9, 'Category' => 10, 'System' => 11, 'Timezone' => 12, 'Enable' => 13, 'CreationDate' => 14, 'LastUpdate' => 15, ),
+ BasePeer::TYPE_COLNAME => array (SchedulerPeer::ID => 0, SchedulerPeer::TITLE => 1, SchedulerPeer::STARTINGTIME => 2, SchedulerPeer::ENDINGTIME => 3, SchedulerPeer::EVERYON => 4, SchedulerPeer::INTERVAL => 5, SchedulerPeer::DESCRIPTION => 6, SchedulerPeer::EXPRESSION => 7, SchedulerPeer::BODY => 8, SchedulerPeer::TYPE => 9, SchedulerPeer::CATEGORY => 10, SchedulerPeer::SYSTEM => 11, SchedulerPeer::TIMEZONE => 12, SchedulerPeer::ENABLE => 13, SchedulerPeer::CREATION_DATE => 14, SchedulerPeer::LAST_UPDATE => 15, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'startingTime' => 2, 'endingTime' => 3, 'everyOn' => 4, 'interval' => 5, 'description' => 6, 'expression' => 7, 'body' => 8, 'type' => 9, 'category' => 10, 'system' => 11, 'timezone' => 12, 'enable' => 13, 'creation_date' => 14, 'last_update' => 15, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ );
+
+ /**
+ * @return MapBuilder the map builder for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getMapBuilder()
+ {
+ include_once 'classes/model/map/SchedulerMapBuilder.php';
+ return BasePeer::getMapBuilder('classes.model.map.SchedulerMapBuilder');
+ }
+ /**
+ * Gets a map (hash) of PHP names to DB column names.
+ *
+ * @return array The PHP to DB name map for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
+ */
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = SchedulerPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. SchedulerPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(SchedulerPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param criteria object containing the columns to add.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(SchedulerPeer::ID);
+
+ $criteria->addSelectColumn(SchedulerPeer::TITLE);
+
+ $criteria->addSelectColumn(SchedulerPeer::STARTINGTIME);
+
+ $criteria->addSelectColumn(SchedulerPeer::ENDINGTIME);
+
+ $criteria->addSelectColumn(SchedulerPeer::EVERYON);
+
+ $criteria->addSelectColumn(SchedulerPeer::INTERVAL);
+
+ $criteria->addSelectColumn(SchedulerPeer::DESCRIPTION);
+
+ $criteria->addSelectColumn(SchedulerPeer::EXPRESSION);
+
+ $criteria->addSelectColumn(SchedulerPeer::BODY);
+
+ $criteria->addSelectColumn(SchedulerPeer::TYPE);
+
+ $criteria->addSelectColumn(SchedulerPeer::CATEGORY);
+
+ $criteria->addSelectColumn(SchedulerPeer::SYSTEM);
+
+ $criteria->addSelectColumn(SchedulerPeer::TIMEZONE);
+
+ $criteria->addSelectColumn(SchedulerPeer::ENABLE);
+
+ $criteria->addSelectColumn(SchedulerPeer::CREATION_DATE);
+
+ $criteria->addSelectColumn(SchedulerPeer::LAST_UPDATE);
+
+ }
+
+ const COUNT = 'COUNT(SCHEDULER.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT SCHEDULER.ID)';
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
+ * @param Connection $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // clear out anything that might confuse the ORDER BY clause
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(SchedulerPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(SchedulerPeer::COUNT);
+ }
+
+ // just in case we're grouping: add those columns to the select statement
+ foreach ($criteria->getGroupByColumns() as $column) {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = SchedulerPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ // no rows returned; we infer that means 0 matches.
+ return 0;
+ }
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param Connection $con
+ * @return Scheduler
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = SchedulerPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return SchedulerPeer::populateObjects(SchedulerPeer::doSelectRS($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect()
+ * method to get a ResultSet.
+ *
+ * Use this method directly if you want to just get the resultset
+ * (instead of an array of objects).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return ResultSet The resultset object with numerically-indexed fields.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ SchedulerPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a Creole ResultSet, set to return
+ // rows indexed numerically.
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = SchedulerPeer::getOMClass();
+ $cls = Propel::import($cls);
+ // populate the object(s)
+ while ($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * This uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass()
+ {
+ return SchedulerPeer::CLASS_DEFAULT;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a Scheduler or Criteria object.
+ *
+ * @param mixed $values Criteria or Scheduler object containing data that is used to create the INSERT statement.
+ * @param Connection $con the connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from Scheduler object
+ }
+
+ //$criteria->remove(SchedulerPeer::ID); // remove pkey col since this table uses auto-increment
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a Scheduler or Criteria object.
+ *
+ * @param mixed $values Criteria or Scheduler object containing data create the UPDATE statement.
+ * @param Connection $con The connection to use (specify Connection exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(SchedulerPeer::ID);
+ $selectCriteria->add(SchedulerPeer::ID, $criteria->remove(SchedulerPeer::ID), $comparison);
+
+ } else {
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the SCHEDULER table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(SchedulerPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a Scheduler or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or Scheduler object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param Connection $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(SchedulerPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } elseif ($values instanceof Scheduler) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ // it must be the primary key
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(SchedulerPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given Scheduler object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param Scheduler $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(Scheduler $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(SchedulerPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(SchedulerPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(SchedulerPeer::DATABASE_NAME, SchedulerPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param mixed $pk the primary key.
+ * @param Connection $con the connection to use
+ * @return Scheduler
+ */
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(SchedulerPeer::DATABASE_NAME);
+
+ $criteria->add(SchedulerPeer::ID, $pk);
+
+
+ $v = SchedulerPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(SchedulerPeer::ID, $pks, Criteria::IN);
+ $objs = SchedulerPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+}
+
+
+// static code to register the map builder for this Peer with the main Propel class
+if (Propel::isInit()) {
+ // the MapBuilder classes register themselves with Propel during initialization
+ // so we need to load them here.
+ try {
+ BaseSchedulerPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ // even if Propel is not yet initialized, the map builder class can be registered
+ // now and then it will be loaded when Propel initializes.
+ require_once 'classes/model/map/SchedulerMapBuilder.php';
+ Propel::registerMapBuilder('classes.model.map.SchedulerMapBuilder');
+}
+
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index 9e13e3a09..8a8113d0c 100755
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -6033,7 +6033,9 @@
- }
+
+
+
@@ -6042,5 +6044,7 @@
+
+
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql
index 4946fb777..c26b2f725 100644
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -3325,5 +3325,32 @@ CREATE TABLE `JOBS_FAILED`
`failed_at` DATETIME NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
+#-----------------------------------------------------------------------------
+#-- SCHEDULER
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `SCHEDULER`;
+
+
+CREATE TABLE `SCHEDULER`
+(
+ `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
+ `title` VARCHAR(255),
+ `startingTime` VARCHAR(100),
+ `endingTime` VARCHAR(100),
+ `everyOn` VARCHAR(255),
+ `interval` VARCHAR(10),
+ `description` VARCHAR(255),
+ `expression` VARCHAR(255),
+ `body` VARCHAR(255),
+ `type` VARCHAR(255),
+ `category` VARCHAR(255),
+ `system` TINYINT(3),
+ `timezone` VARCHAR(255),
+ `enable` TINYINT(3),
+ `creation_date` DATETIME,
+ `last_update` DATETIME,
+ PRIMARY KEY (`id`)
+)ENGINE=InnoDB DEFAULT CHARSET='utf8';
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
diff --git a/workflow/engine/methods/scheduler/index.php b/workflow/engine/methods/scheduler/index.php
index d3717c64c..44f8125c4 100755
--- a/workflow/engine/methods/scheduler/index.php
+++ b/workflow/engine/methods/scheduler/index.php
@@ -14,12 +14,15 @@ try {
"var timezoneArray = " . G::json_encode($arrayTimeZoneId) . ";\n" .
"\n";
echo($js);
+
}
$js = "" .
+ "\n".
"\n";
echo($js);
diff --git a/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php b/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php
index 59203a654..3e96b848d 100755
--- a/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php
+++ b/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php
@@ -17,7 +17,9 @@ use Illuminate\Console\Scheduling\Schedule;
class TaskScheduler extends Model
{
protected $table = 'SCHEDULER';
- public $timestamps = false;
+ public $timestamps = true;
+ const CREATED_AT = 'creation_date';
+ const UPDATED_AT = 'last_update';
public function isDue(){
$date = Carbon::now();