BUG-14598. NEW FEATURE SelfService One Execution.

A dropdown was added in the SelfService configuration, this dropdown let you set if the trigger seted in the self service is gonna be executed ONE time or every time that cron is executed.

Some validations where added in the cron_single.php file to save the data in the new table 'APP_TIMEOUT_ACTION_EXECUTED' when the Execution is set in ONCE. If the app_UID is find in this table the trigger will not be executed, if is not find the trigger will be executed.
This commit is contained in:
jennylee
2014-09-08 13:28:14 -04:00
parent 579919acde
commit e116e77379
13 changed files with 1507 additions and 11 deletions

View File

@@ -127,6 +127,11 @@ Bootstrap::registerClass('AppCacheView', PATH_HOME . "engine/classes/model
Bootstrap::registerClass('BaseAppCacheViewPeer',PATH_HOME . "engine/classes/model/om/BaseAppCacheViewPeer.php");
Bootstrap::registerClass('AppCacheViewPeer', PATH_HOME . "engine/classes/model/AppCacheViewPeer.php");
Bootstrap::registerClass('BaseAppTimeoutActionExecuted', PATH_HOME . "engine/classes/model/om/BaseAppTimeoutActionExecuted.php");
Bootstrap::registerClass('AppTimeoutActionExecuted', PATH_HOME . "engine/classes/model/AppTimeoutActionExecuted.php");
Bootstrap::registerClass('BaseAppTimeoutActionExecutedPeer',PATH_HOME . "engine/classes/model/om/BaseAppTimeoutActionExecutedPeer.php");
Bootstrap::registerClass('AppTimeoutActionExecutedPeer', PATH_HOME . "engine/classes/model/AppTimeoutActionExecutedPeer.php");
Bootstrap::registerClass('BaseInputDocument', PATH_HOME . "engine/classes/model/om/BaseInputDocument.php");
Bootstrap::registerClass('InputDocument', PATH_HOME . "engine/classes/model/InputDocument.php");
Bootstrap::registerClass('BaseAppDocument', PATH_HOME . "engine/classes/model/om/BaseAppDocument.php");
@@ -788,6 +793,7 @@ function executeCaseSelfService()
$criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME);
$criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME_UNIT);
$criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TRIGGER_UID);
$criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_EXECUTION);
//FROM
$condition = array();
@@ -809,7 +815,9 @@ function executeCaseSelfService()
$calendar = new calendar();
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$flag = false;
$appcacheAppUid = $row["APP_UID"];
$appcacheDelIndex = $row["DEL_INDEX"];
@@ -820,6 +828,22 @@ function executeCaseSelfService()
$taskSelfServiceTime = intval($row["TAS_SELFSERVICE_TIME"]);
$taskSelfServiceTimeUnit = $row["TAS_SELFSERVICE_TIME_UNIT"];
$taskSelfServiceTriggerUid = $row["TAS_SELFSERVICE_TRIGGER_UID"];
$taskSelfServiceJustOneExecution = $row["TAS_SELFSERVICE_EXECUTION"];
if($taskSelfServiceJustOneExecution == 'ONCE'){
$criteriaSelfService = new Criteria("workflow");
$criteriaSelfService->add(AppTimeoutActionExecutedPeer::APP_UID, $appcacheAppUid);
$criteriaSelfService->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $appcacheDelIndex);
$querySelfService = AppTimeoutActionExecutedPeer::doSelectRS($criteriaSelfService);
$querySelfService->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($querySelfService->next()) {
$row = $querySelfService->getRow();
$flag = true; //already executed
}
}
if ($calendar->pmCalendarUid == '') {
$calendar->getCalendar(null, $appcacheProUid, $taskUid);
@@ -833,7 +857,7 @@ function executeCaseSelfService()
//1
);
if (time() > $dueDate["DUE_DATE_SECONDS"]) {
if (time() > $dueDate["DUE_DATE_SECONDS"] && $flag == false) {
$sessProcess = null;
$sessProcessSw = 0;
@@ -861,6 +885,7 @@ function executeCaseSelfService()
$row = $rsCriteriaTgr->getRow();
if (is_array($row) && $row["TRI_TYPE"] == "SCRIPT") {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$arrayCron["processcTimeProcess"] = 60; //Minutes
$arrayCron["processcTimeStart"] = time();
@@ -874,6 +899,15 @@ function executeCaseSelfService()
$oPMScript->setScript($row["TRI_WEBBOT"]);
$oPMScript->execute();
//saving the case`s data if the 'Execution' is set in ONCE.
if($taskSelfServiceJustOneExecution == "ONCE"){
$oAppTimeoutActionExecuted = new AppTimeoutActionExecuted();
$data_self["APP_UID"] = $appcacheAppUid;
$data_self["DEL_INDEX"] = $appcacheDelIndex;
$data_self["EXECUTION_DATE"] = time();
$oAppTimeoutActionExecuted->create($data_self);
}
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], $oPMScript->aFields);
unset($appFields['APP_STATUS']);