PMCORE-1817

This commit is contained in:
Henry Jordan
2020-07-14 20:20:31 +00:00
parent bd7aa4f1f8
commit c8cf6fb4de
6 changed files with 134 additions and 53 deletions

View File

@@ -81,6 +81,8 @@ class SchedulerMapBuilder
$tMap->addColumn('EXPRESSION', 'Expression', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('EXPRESSION', 'Expression', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('DEFAULT_VALUE', 'DefaultValue', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('TYPE', 'Type', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('TYPE', 'Type', 'string', CreoleTypes::VARCHAR, false, 255);

View File

@@ -75,6 +75,12 @@ abstract class BaseScheduler extends BaseObject implements Persistent
*/ */
protected $expression; protected $expression;
/**
* The value for the default_value field.
* @var string
*/
protected $default_value;
/** /**
* The value for the body field. * The value for the body field.
* @var string * @var string
@@ -225,6 +231,17 @@ abstract class BaseScheduler extends BaseObject implements Persistent
return $this->expression; return $this->expression;
} }
/**
* Get the [default_value] column value.
*
* @return string
*/
public function getDefaultValue()
{
return $this->default_value;
}
/** /**
* Get the [body] column value. * Get the [body] column value.
* *
@@ -531,6 +548,28 @@ abstract class BaseScheduler extends BaseObject implements Persistent
} // setExpression() } // setExpression()
/**
* Set the value of [default_value] column.
*
* @param string $v new value
* @return void
*/
public function setDefaultValue($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->default_value !== $v) {
$this->default_value = $v;
$this->modifiedColumns[] = SchedulerPeer::DEFAULT_VALUE;
}
} // setDefaultValue()
/** /**
* Set the value of [body] column. * Set the value of [body] column.
* *
@@ -754,28 +793,30 @@ abstract class BaseScheduler extends BaseObject implements Persistent
$this->expression = $rs->getString($startcol + 7); $this->expression = $rs->getString($startcol + 7);
$this->body = $rs->getString($startcol + 8); $this->default_value = $rs->getString($startcol + 8);
$this->type = $rs->getString($startcol + 9); $this->body = $rs->getString($startcol + 9);
$this->category = $rs->getString($startcol + 10); $this->type = $rs->getString($startcol + 10);
$this->system = $rs->getInt($startcol + 11); $this->category = $rs->getString($startcol + 11);
$this->timezone = $rs->getString($startcol + 12); $this->system = $rs->getInt($startcol + 12);
$this->enable = $rs->getInt($startcol + 13); $this->timezone = $rs->getString($startcol + 13);
$this->creation_date = $rs->getTimestamp($startcol + 14, null); $this->enable = $rs->getInt($startcol + 14);
$this->last_update = $rs->getTimestamp($startcol + 15, null); $this->creation_date = $rs->getTimestamp($startcol + 15, null);
$this->last_update = $rs->getTimestamp($startcol + 16, null);
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer. // FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 16; // 16 = SchedulerPeer::NUM_COLUMNS - SchedulerPeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 17; // 17 = SchedulerPeer::NUM_COLUMNS - SchedulerPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating Scheduler object", $e); throw new PropelException("Error populating Scheduler object", $e);
@@ -1006,27 +1047,30 @@ abstract class BaseScheduler extends BaseObject implements Persistent
return $this->getExpression(); return $this->getExpression();
break; break;
case 8: case 8:
return $this->getBody(); return $this->getDefaultValue();
break; break;
case 9: case 9:
return $this->getType(); return $this->getBody();
break; break;
case 10: case 10:
return $this->getCategory(); return $this->getType();
break; break;
case 11: case 11:
return $this->getSystem(); return $this->getCategory();
break; break;
case 12: case 12:
return $this->getTimezone(); return $this->getSystem();
break; break;
case 13: case 13:
return $this->getEnable(); return $this->getTimezone();
break; break;
case 14: case 14:
return $this->getCreationDate(); return $this->getEnable();
break; break;
case 15: case 15:
return $this->getCreationDate();
break;
case 16:
return $this->getLastUpdate(); return $this->getLastUpdate();
break; break;
default: default:
@@ -1057,14 +1101,15 @@ abstract class BaseScheduler extends BaseObject implements Persistent
$keys[5] => $this->getInterval(), $keys[5] => $this->getInterval(),
$keys[6] => $this->getDescription(), $keys[6] => $this->getDescription(),
$keys[7] => $this->getExpression(), $keys[7] => $this->getExpression(),
$keys[8] => $this->getBody(), $keys[8] => $this->getDefaultValue(),
$keys[9] => $this->getType(), $keys[9] => $this->getBody(),
$keys[10] => $this->getCategory(), $keys[10] => $this->getType(),
$keys[11] => $this->getSystem(), $keys[11] => $this->getCategory(),
$keys[12] => $this->getTimezone(), $keys[12] => $this->getSystem(),
$keys[13] => $this->getEnable(), $keys[13] => $this->getTimezone(),
$keys[14] => $this->getCreationDate(), $keys[14] => $this->getEnable(),
$keys[15] => $this->getLastUpdate(), $keys[15] => $this->getCreationDate(),
$keys[16] => $this->getLastUpdate(),
); );
return $result; return $result;
} }
@@ -1121,27 +1166,30 @@ abstract class BaseScheduler extends BaseObject implements Persistent
$this->setExpression($value); $this->setExpression($value);
break; break;
case 8: case 8:
$this->setBody($value); $this->setDefaultValue($value);
break; break;
case 9: case 9:
$this->setType($value); $this->setBody($value);
break; break;
case 10: case 10:
$this->setCategory($value); $this->setType($value);
break; break;
case 11: case 11:
$this->setSystem($value); $this->setCategory($value);
break; break;
case 12: case 12:
$this->setTimezone($value); $this->setSystem($value);
break; break;
case 13: case 13:
$this->setEnable($value); $this->setTimezone($value);
break; break;
case 14: case 14:
$this->setCreationDate($value); $this->setEnable($value);
break; break;
case 15: case 15:
$this->setCreationDate($value);
break;
case 16:
$this->setLastUpdate($value); $this->setLastUpdate($value);
break; break;
} // switch() } // switch()
@@ -1200,35 +1248,39 @@ abstract class BaseScheduler extends BaseObject implements Persistent
} }
if (array_key_exists($keys[8], $arr)) { if (array_key_exists($keys[8], $arr)) {
$this->setBody($arr[$keys[8]]); $this->setDefaultValue($arr[$keys[8]]);
} }
if (array_key_exists($keys[9], $arr)) { if (array_key_exists($keys[9], $arr)) {
$this->setType($arr[$keys[9]]); $this->setBody($arr[$keys[9]]);
} }
if (array_key_exists($keys[10], $arr)) { if (array_key_exists($keys[10], $arr)) {
$this->setCategory($arr[$keys[10]]); $this->setType($arr[$keys[10]]);
} }
if (array_key_exists($keys[11], $arr)) { if (array_key_exists($keys[11], $arr)) {
$this->setSystem($arr[$keys[11]]); $this->setCategory($arr[$keys[11]]);
} }
if (array_key_exists($keys[12], $arr)) { if (array_key_exists($keys[12], $arr)) {
$this->setTimezone($arr[$keys[12]]); $this->setSystem($arr[$keys[12]]);
} }
if (array_key_exists($keys[13], $arr)) { if (array_key_exists($keys[13], $arr)) {
$this->setEnable($arr[$keys[13]]); $this->setTimezone($arr[$keys[13]]);
} }
if (array_key_exists($keys[14], $arr)) { if (array_key_exists($keys[14], $arr)) {
$this->setCreationDate($arr[$keys[14]]); $this->setEnable($arr[$keys[14]]);
} }
if (array_key_exists($keys[15], $arr)) { if (array_key_exists($keys[15], $arr)) {
$this->setLastUpdate($arr[$keys[15]]); $this->setCreationDate($arr[$keys[15]]);
}
if (array_key_exists($keys[16], $arr)) {
$this->setLastUpdate($arr[$keys[16]]);
} }
} }
@@ -1274,6 +1326,10 @@ abstract class BaseScheduler extends BaseObject implements Persistent
$criteria->add(SchedulerPeer::EXPRESSION, $this->expression); $criteria->add(SchedulerPeer::EXPRESSION, $this->expression);
} }
if ($this->isColumnModified(SchedulerPeer::DEFAULT_VALUE)) {
$criteria->add(SchedulerPeer::DEFAULT_VALUE, $this->default_value);
}
if ($this->isColumnModified(SchedulerPeer::BODY)) { if ($this->isColumnModified(SchedulerPeer::BODY)) {
$criteria->add(SchedulerPeer::BODY, $this->body); $criteria->add(SchedulerPeer::BODY, $this->body);
} }
@@ -1374,6 +1430,8 @@ abstract class BaseScheduler extends BaseObject implements Persistent
$copyObj->setExpression($this->expression); $copyObj->setExpression($this->expression);
$copyObj->setDefaultValue($this->default_value);
$copyObj->setBody($this->body); $copyObj->setBody($this->body);
$copyObj->setType($this->type); $copyObj->setType($this->type);

View File

@@ -25,7 +25,7 @@ abstract class BaseSchedulerPeer
const CLASS_DEFAULT = 'classes.model.Scheduler'; const CLASS_DEFAULT = 'classes.model.Scheduler';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 16; const NUM_COLUMNS = 17;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -55,6 +55,9 @@ abstract class BaseSchedulerPeer
/** the column name for the EXPRESSION field */ /** the column name for the EXPRESSION field */
const EXPRESSION = 'SCHEDULER.EXPRESSION'; const EXPRESSION = 'SCHEDULER.EXPRESSION';
/** the column name for the DEFAULT_VALUE field */
const DEFAULT_VALUE = 'SCHEDULER.DEFAULT_VALUE';
/** the column name for the BODY field */ /** the column name for the BODY field */
const BODY = 'SCHEDULER.BODY'; const BODY = 'SCHEDULER.BODY';
@@ -90,10 +93,10 @@ abstract class BaseSchedulerPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Title', 'Startingtime', 'Endingtime', 'Everyon', 'Interval', 'Description', 'Expression', 'Body', 'Type', 'Category', 'System', 'Timezone', 'Enable', 'CreationDate', 'LastUpdate', ), BasePeer::TYPE_PHPNAME => array ('Id', 'Title', 'Startingtime', 'Endingtime', 'Everyon', 'Interval', 'Description', 'Expression', 'DefaultValue', '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_COLNAME => array (SchedulerPeer::ID, SchedulerPeer::TITLE, SchedulerPeer::STARTINGTIME, SchedulerPeer::ENDINGTIME, SchedulerPeer::EVERYON, SchedulerPeer::INTERVAL, SchedulerPeer::DESCRIPTION, SchedulerPeer::EXPRESSION, SchedulerPeer::DEFAULT_VALUE, 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_FIELDNAME => array ('id', 'title', 'startingTime', 'endingTime', 'everyOn', 'interval', 'description', 'expression', 'default_value', '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, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
); );
/** /**
@@ -103,10 +106,10 @@ abstract class BaseSchedulerPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( 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_PHPNAME => array ('Id' => 0, 'Title' => 1, 'Startingtime' => 2, 'Endingtime' => 3, 'Everyon' => 4, 'Interval' => 5, 'Description' => 6, 'Expression' => 7, 'DefaultValue' => 8, 'Body' => 9, 'Type' => 10, 'Category' => 11, 'System' => 12, 'Timezone' => 13, 'Enable' => 14, 'CreationDate' => 15, 'LastUpdate' => 16, ),
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_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::DEFAULT_VALUE => 8, SchedulerPeer::BODY => 9, SchedulerPeer::TYPE => 10, SchedulerPeer::CATEGORY => 11, SchedulerPeer::SYSTEM => 12, SchedulerPeer::TIMEZONE => 13, SchedulerPeer::ENABLE => 14, SchedulerPeer::CREATION_DATE => 15, SchedulerPeer::LAST_UPDATE => 16, ),
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_FIELDNAME => array ('id' => 0, 'title' => 1, 'startingTime' => 2, 'endingTime' => 3, 'everyOn' => 4, 'interval' => 5, 'description' => 6, 'expression' => 7, 'default_value' => 8, 'body' => 9, 'type' => 10, 'category' => 11, 'system' => 12, 'timezone' => 13, 'enable' => 14, 'creation_date' => 15, 'last_update' => 16, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
); );
/** /**
@@ -223,6 +226,8 @@ abstract class BaseSchedulerPeer
$criteria->addSelectColumn(SchedulerPeer::EXPRESSION); $criteria->addSelectColumn(SchedulerPeer::EXPRESSION);
$criteria->addSelectColumn(SchedulerPeer::DEFAULT_VALUE);
$criteria->addSelectColumn(SchedulerPeer::BODY); $criteria->addSelectColumn(SchedulerPeer::BODY);
$criteria->addSelectColumn(SchedulerPeer::TYPE); $criteria->addSelectColumn(SchedulerPeer::TYPE);

View File

@@ -6043,6 +6043,7 @@
<column name="interval" type="VARCHAR" size="10" required="false"/> <column name="interval" type="VARCHAR" size="10" required="false"/>
<column name="description" type="VARCHAR" size="255" required="false"/> <column name="description" type="VARCHAR" size="255" required="false"/>
<column name="expression" type="VARCHAR" size="255" required="false"/> <column name="expression" type="VARCHAR" size="255" required="false"/>
<column name="default_value" type="LONGVARCHAR" required="false"/>
<column name="body" type="VARCHAR" size="255" required="false"/> <column name="body" type="VARCHAR" size="255" required="false"/>
<column name="type" type="VARCHAR" size="255" required="false"/> <column name="type" type="VARCHAR" size="255" required="false"/>
<column name="category" type="VARCHAR" size="255" required="false"/> <column name="category" type="VARCHAR" size="255" required="false"/>

View File

@@ -3345,6 +3345,7 @@ CREATE TABLE `SCHEDULER`
`interval` VARCHAR(10), `interval` VARCHAR(10),
`description` VARCHAR(255), `description` VARCHAR(255),
`expression` VARCHAR(255), `expression` VARCHAR(255),
`default_value` MEDIUMTEXT,
`body` VARCHAR(255), `body` VARCHAR(255),
`type` VARCHAR(255), `type` VARCHAR(255),
`category` VARCHAR(255), `category` VARCHAR(255),

View File

@@ -1,7 +1,10 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Model\TaskScheduler; use ProcessMaker\Model\TaskScheduler;
class TaskSchedulerBM class TaskSchedulerBM
{ {
public static $services = [ public static $services = [
@@ -103,8 +106,7 @@ class TaskSchedulerBM
"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"
] ]
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/, [
,[
"title" => "ID_TASK_SCHEDULER_ACTION_EMAIL", "title" => "ID_TASK_SCHEDULER_ACTION_EMAIL",
"enable" => "1", "enable" => "1",
"service" => "", "service" => "",
@@ -190,7 +192,7 @@ class TaskSchedulerBM
"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"
] ]
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
]; ];
/** /**
* Return the records in Schedule Table by category * Return the records in Schedule Table by category
@@ -206,7 +208,11 @@ class TaskSchedulerBM
if (is_null($category)) { if (is_null($category)) {
return $tasks; return $tasks;
} else { } else {
return TaskScheduler::where('category', $category)->get(); $tasks = TaskScheduler::where('category', $category)->get();
foreach ($tasks as $task) {
$task->default_value = json_decode($task->default_value);
}
return $tasks;
} }
} }
/** /**
@@ -255,6 +261,14 @@ class TaskSchedulerBM
$task->enable = $service["enable"]; $task->enable = $service["enable"];
$task->everyOn = $service["everyOn"]; $task->everyOn = $service["everyOn"];
$task->interval = $service["interval"]; $task->interval = $service["interval"];
$task->default_value = json_encode([
"startingTime" => $service["startingTime"],
"endingTime" => $service["endingTime"],
"everyOn" => $service["everyOn"],
"interval" => $service["interval"],
"expression" => $service["expression"],
"timezone" => null
]);
$task->save(); $task->save();
} }
} }