Merged in victorsl/processmaker/PM-2917 (pull request #2320)
PM-2917 "Case Scheduler issues" SOLVED
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -103,7 +103,7 @@ class CaseSchedulerMapBuilder
|
||||
|
||||
$tMap->addColumn('SCH_START_DAY', 'SchStartDay', 'string', CreoleTypes::CHAR, true, 6);
|
||||
|
||||
$tMap->addColumn('SCH_MONTHS', 'SchMonths', 'string', CreoleTypes::CHAR, true, 24);
|
||||
$tMap->addColumn('SCH_MONTHS', 'SchMonths', 'string', CreoleTypes::CHAR, true, 27);
|
||||
|
||||
$tMap->addColumn('SCH_END_DATE', 'SchEndDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
@@ -113,6 +113,8 @@ class CaseSchedulerMapBuilder
|
||||
|
||||
$tMap->addColumn('SCH_REPEAT_STOP_IF_RUNNING', 'SchRepeatStopIfRunning', 'int', CreoleTypes::TINYINT, false, null);
|
||||
|
||||
$tMap->addColumn('SCH_EXECUTION_DATE', 'SchExecutionDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
$tMap->addColumn('CASE_SH_PLUGIN_UID', 'CaseShPluginUid', 'string', CreoleTypes::VARCHAR, false, 100);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
@@ -171,6 +171,12 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $sch_repeat_stop_if_running = 0;
|
||||
|
||||
/**
|
||||
* The value for the sch_execution_date field.
|
||||
* @var int
|
||||
*/
|
||||
protected $sch_execution_date;
|
||||
|
||||
/**
|
||||
* The value for the case_sh_plugin_uid field.
|
||||
* @var string
|
||||
@@ -560,6 +566,38 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
return $this->sch_repeat_stop_if_running;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] [sch_execution_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 getSchExecutionDate($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
|
||||
if ($this->sch_execution_date === null || $this->sch_execution_date === '') {
|
||||
return null;
|
||||
} elseif (!is_int($this->sch_execution_date)) {
|
||||
// a non-timestamp value was set externally, so we convert it
|
||||
$ts = strtotime($this->sch_execution_date);
|
||||
if ($ts === -1 || $ts === false) {
|
||||
throw new PropelException("Unable to parse value of [sch_execution_date] as date/time value: " .
|
||||
var_export($this->sch_execution_date, true));
|
||||
}
|
||||
} else {
|
||||
$ts = $this->sch_execution_date;
|
||||
}
|
||||
if ($format === null) {
|
||||
return $ts;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $ts);
|
||||
} else {
|
||||
return date($format, $ts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [case_sh_plugin_uid] column value.
|
||||
*
|
||||
@@ -1134,6 +1172,35 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
|
||||
} // setSchRepeatStopIfRunning()
|
||||
|
||||
/**
|
||||
* Set the value of [sch_execution_date] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setSchExecutionDate($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 [sch_execution_date] from input: " .
|
||||
var_export($v, true));
|
||||
}
|
||||
} else {
|
||||
$ts = $v;
|
||||
}
|
||||
if ($this->sch_execution_date !== $ts) {
|
||||
$this->sch_execution_date = $ts;
|
||||
$this->modifiedColumns[] = CaseSchedulerPeer::SCH_EXECUTION_DATE;
|
||||
}
|
||||
|
||||
} // setSchExecutionDate()
|
||||
|
||||
/**
|
||||
* Set the value of [case_sh_plugin_uid] column.
|
||||
*
|
||||
@@ -1221,14 +1288,16 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
|
||||
$this->sch_repeat_stop_if_running = $rs->getInt($startcol + 23);
|
||||
|
||||
$this->case_sh_plugin_uid = $rs->getString($startcol + 24);
|
||||
$this->sch_execution_date = $rs->getTimestamp($startcol + 24, null);
|
||||
|
||||
$this->case_sh_plugin_uid = $rs->getString($startcol + 25);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 25; // 25 = CaseSchedulerPeer::NUM_COLUMNS - CaseSchedulerPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 26; // 26 = CaseSchedulerPeer::NUM_COLUMNS - CaseSchedulerPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CaseScheduler object", $e);
|
||||
@@ -1505,6 +1574,9 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
return $this->getSchRepeatStopIfRunning();
|
||||
break;
|
||||
case 24:
|
||||
return $this->getSchExecutionDate();
|
||||
break;
|
||||
case 25:
|
||||
return $this->getCaseShPluginUid();
|
||||
break;
|
||||
default:
|
||||
@@ -1551,7 +1623,8 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
$keys[21] => $this->getSchRepeatEvery(),
|
||||
$keys[22] => $this->getSchRepeatUntil(),
|
||||
$keys[23] => $this->getSchRepeatStopIfRunning(),
|
||||
$keys[24] => $this->getCaseShPluginUid(),
|
||||
$keys[24] => $this->getSchExecutionDate(),
|
||||
$keys[25] => $this->getCaseShPluginUid(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -1656,6 +1729,9 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
$this->setSchRepeatStopIfRunning($value);
|
||||
break;
|
||||
case 24:
|
||||
$this->setSchExecutionDate($value);
|
||||
break;
|
||||
case 25:
|
||||
$this->setCaseShPluginUid($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1778,7 +1854,11 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[24], $arr)) {
|
||||
$this->setCaseShPluginUid($arr[$keys[24]]);
|
||||
$this->setSchExecutionDate($arr[$keys[24]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[25], $arr)) {
|
||||
$this->setCaseShPluginUid($arr[$keys[25]]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1888,6 +1968,10 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
$criteria->add(CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING, $this->sch_repeat_stop_if_running);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(CaseSchedulerPeer::SCH_EXECUTION_DATE)) {
|
||||
$criteria->add(CaseSchedulerPeer::SCH_EXECUTION_DATE, $this->sch_execution_date);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(CaseSchedulerPeer::CASE_SH_PLUGIN_UID)) {
|
||||
$criteria->add(CaseSchedulerPeer::CASE_SH_PLUGIN_UID, $this->case_sh_plugin_uid);
|
||||
}
|
||||
@@ -1992,6 +2076,8 @@ abstract class BaseCaseScheduler extends BaseObject implements Persistent
|
||||
|
||||
$copyObj->setSchRepeatStopIfRunning($this->sch_repeat_stop_if_running);
|
||||
|
||||
$copyObj->setSchExecutionDate($this->sch_execution_date);
|
||||
|
||||
$copyObj->setCaseShPluginUid($this->case_sh_plugin_uid);
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseCaseSchedulerPeer
|
||||
const CLASS_DEFAULT = 'classes.model.CaseScheduler';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 25;
|
||||
const NUM_COLUMNS = 26;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -103,6 +103,9 @@ abstract class BaseCaseSchedulerPeer
|
||||
/** the column name for the SCH_REPEAT_STOP_IF_RUNNING field */
|
||||
const SCH_REPEAT_STOP_IF_RUNNING = 'CASE_SCHEDULER.SCH_REPEAT_STOP_IF_RUNNING';
|
||||
|
||||
/** the column name for the SCH_EXECUTION_DATE field */
|
||||
const SCH_EXECUTION_DATE = 'CASE_SCHEDULER.SCH_EXECUTION_DATE';
|
||||
|
||||
/** the column name for the CASE_SH_PLUGIN_UID field */
|
||||
const CASE_SH_PLUGIN_UID = 'CASE_SCHEDULER.CASE_SH_PLUGIN_UID';
|
||||
|
||||
@@ -117,10 +120,10 @@ abstract class BaseCaseSchedulerPeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('SchUid', 'SchDelUserName', 'SchDelUserPass', 'SchDelUserUid', 'SchName', 'ProUid', 'TasUid', 'SchTimeNextRun', 'SchLastRunTime', 'SchState', 'SchLastState', 'UsrUid', 'SchOption', 'SchStartTime', 'SchStartDate', 'SchDaysPerformTask', 'SchEveryDays', 'SchWeekDays', 'SchStartDay', 'SchMonths', 'SchEndDate', 'SchRepeatEvery', 'SchRepeatUntil', 'SchRepeatStopIfRunning', 'CaseShPluginUid', ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseSchedulerPeer::SCH_UID, CaseSchedulerPeer::SCH_DEL_USER_NAME, CaseSchedulerPeer::SCH_DEL_USER_PASS, CaseSchedulerPeer::SCH_DEL_USER_UID, CaseSchedulerPeer::SCH_NAME, CaseSchedulerPeer::PRO_UID, CaseSchedulerPeer::TAS_UID, CaseSchedulerPeer::SCH_TIME_NEXT_RUN, CaseSchedulerPeer::SCH_LAST_RUN_TIME, CaseSchedulerPeer::SCH_STATE, CaseSchedulerPeer::SCH_LAST_STATE, CaseSchedulerPeer::USR_UID, CaseSchedulerPeer::SCH_OPTION, CaseSchedulerPeer::SCH_START_TIME, CaseSchedulerPeer::SCH_START_DATE, CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK, CaseSchedulerPeer::SCH_EVERY_DAYS, CaseSchedulerPeer::SCH_WEEK_DAYS, CaseSchedulerPeer::SCH_START_DAY, CaseSchedulerPeer::SCH_MONTHS, CaseSchedulerPeer::SCH_END_DATE, CaseSchedulerPeer::SCH_REPEAT_EVERY, CaseSchedulerPeer::SCH_REPEAT_UNTIL, CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING, CaseSchedulerPeer::CASE_SH_PLUGIN_UID, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('SCH_UID', 'SCH_DEL_USER_NAME', 'SCH_DEL_USER_PASS', 'SCH_DEL_USER_UID', 'SCH_NAME', 'PRO_UID', 'TAS_UID', 'SCH_TIME_NEXT_RUN', 'SCH_LAST_RUN_TIME', 'SCH_STATE', 'SCH_LAST_STATE', 'USR_UID', 'SCH_OPTION', 'SCH_START_TIME', 'SCH_START_DATE', 'SCH_DAYS_PERFORM_TASK', 'SCH_EVERY_DAYS', 'SCH_WEEK_DAYS', 'SCH_START_DAY', 'SCH_MONTHS', 'SCH_END_DATE', 'SCH_REPEAT_EVERY', 'SCH_REPEAT_UNTIL', 'SCH_REPEAT_STOP_IF_RUNNING', 'CASE_SH_PLUGIN_UID', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, )
|
||||
BasePeer::TYPE_PHPNAME => array ('SchUid', 'SchDelUserName', 'SchDelUserPass', 'SchDelUserUid', 'SchName', 'ProUid', 'TasUid', 'SchTimeNextRun', 'SchLastRunTime', 'SchState', 'SchLastState', 'UsrUid', 'SchOption', 'SchStartTime', 'SchStartDate', 'SchDaysPerformTask', 'SchEveryDays', 'SchWeekDays', 'SchStartDay', 'SchMonths', 'SchEndDate', 'SchRepeatEvery', 'SchRepeatUntil', 'SchRepeatStopIfRunning', 'SchExecutionDate', 'CaseShPluginUid', ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseSchedulerPeer::SCH_UID, CaseSchedulerPeer::SCH_DEL_USER_NAME, CaseSchedulerPeer::SCH_DEL_USER_PASS, CaseSchedulerPeer::SCH_DEL_USER_UID, CaseSchedulerPeer::SCH_NAME, CaseSchedulerPeer::PRO_UID, CaseSchedulerPeer::TAS_UID, CaseSchedulerPeer::SCH_TIME_NEXT_RUN, CaseSchedulerPeer::SCH_LAST_RUN_TIME, CaseSchedulerPeer::SCH_STATE, CaseSchedulerPeer::SCH_LAST_STATE, CaseSchedulerPeer::USR_UID, CaseSchedulerPeer::SCH_OPTION, CaseSchedulerPeer::SCH_START_TIME, CaseSchedulerPeer::SCH_START_DATE, CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK, CaseSchedulerPeer::SCH_EVERY_DAYS, CaseSchedulerPeer::SCH_WEEK_DAYS, CaseSchedulerPeer::SCH_START_DAY, CaseSchedulerPeer::SCH_MONTHS, CaseSchedulerPeer::SCH_END_DATE, CaseSchedulerPeer::SCH_REPEAT_EVERY, CaseSchedulerPeer::SCH_REPEAT_UNTIL, CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING, CaseSchedulerPeer::SCH_EXECUTION_DATE, CaseSchedulerPeer::CASE_SH_PLUGIN_UID, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('SCH_UID', 'SCH_DEL_USER_NAME', 'SCH_DEL_USER_PASS', 'SCH_DEL_USER_UID', 'SCH_NAME', 'PRO_UID', 'TAS_UID', 'SCH_TIME_NEXT_RUN', 'SCH_LAST_RUN_TIME', 'SCH_STATE', 'SCH_LAST_STATE', 'USR_UID', 'SCH_OPTION', 'SCH_START_TIME', 'SCH_START_DATE', 'SCH_DAYS_PERFORM_TASK', 'SCH_EVERY_DAYS', 'SCH_WEEK_DAYS', 'SCH_START_DAY', 'SCH_MONTHS', 'SCH_END_DATE', 'SCH_REPEAT_EVERY', 'SCH_REPEAT_UNTIL', 'SCH_REPEAT_STOP_IF_RUNNING', 'SCH_EXECUTION_DATE', 'CASE_SH_PLUGIN_UID', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -130,10 +133,10 @@ abstract class BaseCaseSchedulerPeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('SchUid' => 0, 'SchDelUserName' => 1, 'SchDelUserPass' => 2, 'SchDelUserUid' => 3, 'SchName' => 4, 'ProUid' => 5, 'TasUid' => 6, 'SchTimeNextRun' => 7, 'SchLastRunTime' => 8, 'SchState' => 9, 'SchLastState' => 10, 'UsrUid' => 11, 'SchOption' => 12, 'SchStartTime' => 13, 'SchStartDate' => 14, 'SchDaysPerformTask' => 15, 'SchEveryDays' => 16, 'SchWeekDays' => 17, 'SchStartDay' => 18, 'SchMonths' => 19, 'SchEndDate' => 20, 'SchRepeatEvery' => 21, 'SchRepeatUntil' => 22, 'SchRepeatStopIfRunning' => 23, 'CaseShPluginUid' => 24, ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseSchedulerPeer::SCH_UID => 0, CaseSchedulerPeer::SCH_DEL_USER_NAME => 1, CaseSchedulerPeer::SCH_DEL_USER_PASS => 2, CaseSchedulerPeer::SCH_DEL_USER_UID => 3, CaseSchedulerPeer::SCH_NAME => 4, CaseSchedulerPeer::PRO_UID => 5, CaseSchedulerPeer::TAS_UID => 6, CaseSchedulerPeer::SCH_TIME_NEXT_RUN => 7, CaseSchedulerPeer::SCH_LAST_RUN_TIME => 8, CaseSchedulerPeer::SCH_STATE => 9, CaseSchedulerPeer::SCH_LAST_STATE => 10, CaseSchedulerPeer::USR_UID => 11, CaseSchedulerPeer::SCH_OPTION => 12, CaseSchedulerPeer::SCH_START_TIME => 13, CaseSchedulerPeer::SCH_START_DATE => 14, CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK => 15, CaseSchedulerPeer::SCH_EVERY_DAYS => 16, CaseSchedulerPeer::SCH_WEEK_DAYS => 17, CaseSchedulerPeer::SCH_START_DAY => 18, CaseSchedulerPeer::SCH_MONTHS => 19, CaseSchedulerPeer::SCH_END_DATE => 20, CaseSchedulerPeer::SCH_REPEAT_EVERY => 21, CaseSchedulerPeer::SCH_REPEAT_UNTIL => 22, CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING => 23, CaseSchedulerPeer::CASE_SH_PLUGIN_UID => 24, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('SCH_UID' => 0, 'SCH_DEL_USER_NAME' => 1, 'SCH_DEL_USER_PASS' => 2, 'SCH_DEL_USER_UID' => 3, 'SCH_NAME' => 4, 'PRO_UID' => 5, 'TAS_UID' => 6, 'SCH_TIME_NEXT_RUN' => 7, 'SCH_LAST_RUN_TIME' => 8, 'SCH_STATE' => 9, 'SCH_LAST_STATE' => 10, 'USR_UID' => 11, 'SCH_OPTION' => 12, 'SCH_START_TIME' => 13, 'SCH_START_DATE' => 14, 'SCH_DAYS_PERFORM_TASK' => 15, 'SCH_EVERY_DAYS' => 16, 'SCH_WEEK_DAYS' => 17, 'SCH_START_DAY' => 18, 'SCH_MONTHS' => 19, 'SCH_END_DATE' => 20, 'SCH_REPEAT_EVERY' => 21, 'SCH_REPEAT_UNTIL' => 22, 'SCH_REPEAT_STOP_IF_RUNNING' => 23, 'CASE_SH_PLUGIN_UID' => 24, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, )
|
||||
BasePeer::TYPE_PHPNAME => array ('SchUid' => 0, 'SchDelUserName' => 1, 'SchDelUserPass' => 2, 'SchDelUserUid' => 3, 'SchName' => 4, 'ProUid' => 5, 'TasUid' => 6, 'SchTimeNextRun' => 7, 'SchLastRunTime' => 8, 'SchState' => 9, 'SchLastState' => 10, 'UsrUid' => 11, 'SchOption' => 12, 'SchStartTime' => 13, 'SchStartDate' => 14, 'SchDaysPerformTask' => 15, 'SchEveryDays' => 16, 'SchWeekDays' => 17, 'SchStartDay' => 18, 'SchMonths' => 19, 'SchEndDate' => 20, 'SchRepeatEvery' => 21, 'SchRepeatUntil' => 22, 'SchRepeatStopIfRunning' => 23, 'SchExecutionDate' => 24, 'CaseShPluginUid' => 25, ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseSchedulerPeer::SCH_UID => 0, CaseSchedulerPeer::SCH_DEL_USER_NAME => 1, CaseSchedulerPeer::SCH_DEL_USER_PASS => 2, CaseSchedulerPeer::SCH_DEL_USER_UID => 3, CaseSchedulerPeer::SCH_NAME => 4, CaseSchedulerPeer::PRO_UID => 5, CaseSchedulerPeer::TAS_UID => 6, CaseSchedulerPeer::SCH_TIME_NEXT_RUN => 7, CaseSchedulerPeer::SCH_LAST_RUN_TIME => 8, CaseSchedulerPeer::SCH_STATE => 9, CaseSchedulerPeer::SCH_LAST_STATE => 10, CaseSchedulerPeer::USR_UID => 11, CaseSchedulerPeer::SCH_OPTION => 12, CaseSchedulerPeer::SCH_START_TIME => 13, CaseSchedulerPeer::SCH_START_DATE => 14, CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK => 15, CaseSchedulerPeer::SCH_EVERY_DAYS => 16, CaseSchedulerPeer::SCH_WEEK_DAYS => 17, CaseSchedulerPeer::SCH_START_DAY => 18, CaseSchedulerPeer::SCH_MONTHS => 19, CaseSchedulerPeer::SCH_END_DATE => 20, CaseSchedulerPeer::SCH_REPEAT_EVERY => 21, CaseSchedulerPeer::SCH_REPEAT_UNTIL => 22, CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING => 23, CaseSchedulerPeer::SCH_EXECUTION_DATE => 24, CaseSchedulerPeer::CASE_SH_PLUGIN_UID => 25, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('SCH_UID' => 0, 'SCH_DEL_USER_NAME' => 1, 'SCH_DEL_USER_PASS' => 2, 'SCH_DEL_USER_UID' => 3, 'SCH_NAME' => 4, 'PRO_UID' => 5, 'TAS_UID' => 6, 'SCH_TIME_NEXT_RUN' => 7, 'SCH_LAST_RUN_TIME' => 8, 'SCH_STATE' => 9, 'SCH_LAST_STATE' => 10, 'USR_UID' => 11, 'SCH_OPTION' => 12, 'SCH_START_TIME' => 13, 'SCH_START_DATE' => 14, 'SCH_DAYS_PERFORM_TASK' => 15, 'SCH_EVERY_DAYS' => 16, 'SCH_WEEK_DAYS' => 17, 'SCH_START_DAY' => 18, 'SCH_MONTHS' => 19, 'SCH_END_DATE' => 20, 'SCH_REPEAT_EVERY' => 21, 'SCH_REPEAT_UNTIL' => 22, 'SCH_REPEAT_STOP_IF_RUNNING' => 23, 'SCH_EXECUTION_DATE' => 24, 'CASE_SH_PLUGIN_UID' => 25, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -282,6 +285,8 @@ abstract class BaseCaseSchedulerPeer
|
||||
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING);
|
||||
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_EXECUTION_DATE);
|
||||
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::CASE_SH_PLUGIN_UID);
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2805,11 +2805,12 @@ CREATE TABLE [CASE_SCHEDULER]
|
||||
[SCH_EVERY_DAYS] TINYINT default 0 NULL,
|
||||
[SCH_WEEK_DAYS] CHAR(14) default '0|0|0|0|0|0|0' NOT NULL,
|
||||
[SCH_START_DAY] CHAR(6) default '' NOT NULL,
|
||||
[SCH_MONTHS] CHAR(24) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
[SCH_MONTHS] CHAR(27) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
[SCH_END_DATE] CHAR(19) NULL,
|
||||
[SCH_REPEAT_EVERY] VARCHAR(15) default '' NOT NULL,
|
||||
[SCH_REPEAT_UNTIL] VARCHAR(15) default '' NOT NULL,
|
||||
[SCH_REPEAT_STOP_IF_RUNNING] TINYINT default 0 NULL,
|
||||
[SCH_EXECUTION_DATE] CHAR(19) NULL,
|
||||
[CASE_SH_PLUGIN_UID] VARCHAR(100) NULL,
|
||||
CONSTRAINT CASE_SCHEDULER_PK PRIMARY KEY ([SCH_UID])
|
||||
);
|
||||
|
||||
@@ -1329,11 +1329,12 @@ CREATE TABLE `CASE_SCHEDULER`
|
||||
`SCH_EVERY_DAYS` TINYINT default 0,
|
||||
`SCH_WEEK_DAYS` CHAR(14) default '0|0|0|0|0|0|0' NOT NULL,
|
||||
`SCH_START_DAY` CHAR(6) default '' NOT NULL,
|
||||
`SCH_MONTHS` CHAR(24) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
`SCH_MONTHS` CHAR(27) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
`SCH_END_DATE` DATETIME,
|
||||
`SCH_REPEAT_EVERY` VARCHAR(15) default '' NOT NULL,
|
||||
`SCH_REPEAT_UNTIL` VARCHAR(15) default '' NOT NULL,
|
||||
`SCH_REPEAT_STOP_IF_RUNNING` TINYINT default 0,
|
||||
`SCH_EXECUTION_DATE` DATETIME,
|
||||
`CASE_SH_PLUGIN_UID` VARCHAR(100),
|
||||
PRIMARY KEY (`SCH_UID`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Conditions store to show or hide dynaform fields..';
|
||||
@@ -2823,3 +2824,4 @@ CREATE TABLE `CATALOG`
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Definitions catalog.';
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
@@ -1601,11 +1601,12 @@ CREATE TABLE "CASE_SCHEDULER"
|
||||
"SCH_EVERY_DAYS" NUMBER(3,0) default 0,
|
||||
"SCH_WEEK_DAYS" CHAR(14) default '0|0|0|0|0|0|0' NOT NULL,
|
||||
"SCH_START_DAY" CHAR(6) default '' NOT NULL,
|
||||
"SCH_MONTHS" CHAR(24) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
"SCH_MONTHS" CHAR(27) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL,
|
||||
"SCH_END_DATE" DATE,
|
||||
"SCH_REPEAT_EVERY" VARCHAR2(15) default '' NOT NULL,
|
||||
"SCH_REPEAT_UNTIL" VARCHAR2(15) default '' NOT NULL,
|
||||
"SCH_REPEAT_STOP_IF_RUNNING" NUMBER(3,0) default 0,
|
||||
"SCH_EXECUTION_DATE" DATE,
|
||||
"CASE_SH_PLUGIN_UID" VARCHAR2(100)
|
||||
);
|
||||
|
||||
|
||||
@@ -897,7 +897,6 @@ class CaseScheduler
|
||||
$sDaysPerformTask = "";
|
||||
$sWeeks = "";
|
||||
$sMonths = "";
|
||||
$sStartDay = "";
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
@@ -992,7 +991,6 @@ class CaseScheduler
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData["SCH_MONTHS"] = $sMonths;
|
||||
$sStartDay = $arrayCaseSchedulerData["SCH_START_DAY"];
|
||||
$sValue = $nStartDay;
|
||||
break;
|
||||
}
|
||||
@@ -1013,123 +1011,33 @@ class CaseScheduler
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = ($arrayData["SCH_END_DATE"] != "")? $arrayData["SCH_END_DATE"] : null;
|
||||
|
||||
//If the start date has changed then recalculate the next run time
|
||||
$recalculateDate = ($arrayData["SCH_START_DATE"] == $arrayData["PREV_SCH_START_DATE"])? false : true;
|
||||
$recalculateTime = (date("H:i:s", strtotime($arrayData["SCH_START_TIME"])) == date("H:i:s", strtotime($arrayData["PREV_SCH_START_TIME"])))? false : true;
|
||||
$recalculateDate = ($arrayData["SCH_START_DATE"] != $arrayData["PREV_SCH_START_DATE"])? true : false;
|
||||
$recalculateTime = (date("H:i:s", strtotime($arrayData["SCH_START_TIME"])) != date("H:i:s", strtotime($arrayData["PREV_SCH_START_TIME"])))? true : false;
|
||||
break;
|
||||
}
|
||||
|
||||
$nActualTime = $arrayData["SCH_START_TIME"];
|
||||
|
||||
if ($caseSchedulerOption != 1 && $caseSchedulerOption != 4 && $caseSchedulerOption != 5) {
|
||||
if ($sStartDay == "") {
|
||||
$sStartDay = date("Y-m-d");
|
||||
}
|
||||
|
||||
$dCurrentDay = (int)(date("d"));
|
||||
$dCurrentMonth = (int)(date("m"));
|
||||
|
||||
$aStartDay = ($caseSchedulerOption == 3)? explode("|", $arrayCaseSchedulerData["SCH_START_DAY"]) : array();
|
||||
|
||||
if ($caseSchedulerOption == 3 && $aStartDay[0] == "1") {
|
||||
$monthsArray = explode("|", $sMonths);
|
||||
|
||||
foreach ($monthsArray as $row) {
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
if ((int)($row) == $dCurrentMonth && $dCurrentDay <= (int)($aStartDay[1])) {
|
||||
$startTime = $arrayData["SCH_START_TIME"] . ":00";
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y") . "-" . $row . "-" . $aStartDay[1] . " " . $startTime;
|
||||
break;
|
||||
} else {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
}
|
||||
break;
|
||||
case "UPD":
|
||||
if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) {
|
||||
$startTime = $arrayData["SCH_START_TIME"] . ":00";
|
||||
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y") . "-" . $row . "-" . $aStartDay[1] . " " . $startTime;
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
break;
|
||||
case "UPD":
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($caseSchedulerOption == 4) {
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
}
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
break;
|
||||
case "UPD":
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($caseSchedulerOption == 5) {
|
||||
switch ($caseSchedulerOption) {
|
||||
case 4:
|
||||
//$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
break;
|
||||
case 5:
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_START_TIME"] = time();
|
||||
$arrayCaseSchedulerData["SCH_START_DATE"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
|
||||
$date = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
break;
|
||||
case "UPD":
|
||||
$date = $caseScheduler->getSchLastRunTime();
|
||||
|
||||
if (is_null($date)) {
|
||||
$date = $caseScheduler->getSchStartTime();
|
||||
}
|
||||
|
||||
$date = strtotime($date);
|
||||
break;
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = $arrayData["SCH_REPEAT_EVERY"];
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y-m-d H:i:s", $date + (((int)($arrayData["SCH_REPEAT_EVERY"])) * 60 * 60));
|
||||
}
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = $arrayData["SCH_REPEAT_EVERY"];
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y-m-d") . " " . (($caseSchedulerOption != 5)? $arrayData["SCH_START_TIME"] . ":00" : date("H:i:s"));
|
||||
|
||||
if ($arrayData["SCH_END_DATE"] != "") {
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayData["SCH_END_DATE"];
|
||||
}
|
||||
@@ -1138,13 +1046,13 @@ class CaseScheduler
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($arrayData["SCH_REPEAT_TASK_CHK"])) {
|
||||
if ($arrayData["SCH_REPEAT_EVERY_OPT"] . "" == "2") {
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = ((int)($arrayData["SCH_REPEAT_EVERY"])) * 60;
|
||||
} else {
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = (int)($arrayData["SCH_REPEAT_EVERY"]);
|
||||
}
|
||||
}
|
||||
//if (!empty($arrayData["SCH_REPEAT_TASK_CHK"])) {
|
||||
// if ($arrayData["SCH_REPEAT_EVERY_OPT"] . "" == "2") {
|
||||
// $arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = ((int)($arrayData["SCH_REPEAT_EVERY"])) * 60;
|
||||
// } else {
|
||||
// $arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = (int)($arrayData["SCH_REPEAT_EVERY"]);
|
||||
// }
|
||||
//}
|
||||
|
||||
//Create/Update
|
||||
$caseSchedulerAux = new \CaseScheduler();
|
||||
@@ -1193,11 +1101,11 @@ class CaseScheduler
|
||||
break;
|
||||
case 4:
|
||||
//One time only
|
||||
$flagUpdateTimeNextRun = $arrayCaseSchedulerData["SCH_START_TIME"] != $arrayCaseSchedulerDataOld["SCH_START_TIME"];
|
||||
$flagUpdateTimeNextRun = $recalculateTime || $arrayCaseSchedulerData["SCH_START_TIME"] != $arrayCaseSchedulerDataOld["SCH_START_TIME"];
|
||||
break;
|
||||
case 5:
|
||||
//Every
|
||||
$flagUpdateTimeNextRun = $arrayCaseSchedulerData["SCH_REPEAT_EVERY"] != $arrayCaseSchedulerDataOld["SCH_REPEAT_EVERY"];
|
||||
$flagUpdateTimeNextRun = $option == "INS" || $arrayCaseSchedulerData["SCH_REPEAT_EVERY"] != $arrayCaseSchedulerDataOld["SCH_REPEAT_EVERY"];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
<td class="FormFieldContent">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<td style="width: 20%">{$form.SCH_START_DAY}</td>
|
||||
<td style="width: 35%">{$form.SCH_START_DAY}</td>
|
||||
<td> {$SCH_START_DAY_OPT_1} {$form.SCH_START_DAY_OPT_1} <br/>
|
||||
{$SCH_START_DAY_OPT_2_WEEKS} {$SCH_START_DAY_OPT_2_DAYS_WEEK}
|
||||
{$form.SCH_START_DAY_OPT_2_WEEKS} {$form.SCH_START_DAY_OPT_2_DAYS_WEEK} <br/>
|
||||
|
||||
@@ -109,7 +109,7 @@ WHERE A.PRO_UID='@#PRO_UID' AND A.TAS_START = 'TRUE' ]]><en><![CDATA[Task]]></en
|
||||
<en><![CDATA[Monthly]]></en>
|
||||
</SELECT_3>
|
||||
<SCH_START_DAY type="radiogroup" required="0" mode="edit" options="Array">
|
||||
<en><![CDATA[]]><option name="1"><![CDATA[Day]]></option><option name="2"><![CDATA[The]]></option></en>
|
||||
<en><![CDATA[]]><option name="1"><![CDATA[Day of month]]></option><option name="2"><![CDATA[The day]]></option></en>
|
||||
</SCH_START_DAY>
|
||||
<SCH_START_DAY_OPT_1 type="text" maxlength="2" validate="Int" mask="##" required="0" readonly="0" defaultvalue="1" size="2" mode="edit">
|
||||
<en><![CDATA[]]></en>
|
||||
@@ -696,7 +696,7 @@ function validateSchedulerFields(oForm) {
|
||||
msgBox("@G::LoadTranslation(ID_REQUIRED_NAME_CASE_SCHEDULER)", 'alert');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var listNames = document.getElementById('form[SCH_LIST]').value;
|
||||
listNames = listNames.split("^");
|
||||
for (var i= 1; i<listNames.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user