BUG 5765 I add the triggers t process SOLVED

- Added triggers to cancel, pause, reassing and delete case
This commit is contained in:
Julio Cesar Laura
2012-10-16 00:29:52 -04:00
parent e33439ea19
commit e10ca93ad7
15 changed files with 512 additions and 98 deletions

View File

@@ -1025,6 +1025,8 @@ class Cases
public function removeCase($sAppUid)
{
try {
$this->getExecuteTriggerProcess($sAppUid, 'DELETED');
$oAppDelegation = new AppDelegation();
$oAppDocument = new AppDocument();
@@ -1106,6 +1108,7 @@ class Cases
if ($this->appSolr != null) {
$this->appSolr->deleteApplicationSearchIndex($sAppUid);
}
return $result;
} catch (exception $e) {
throw ($e);
@@ -3586,6 +3589,8 @@ class Cases
if ($this->appSolr != null) {
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
$this->getExecuteTriggerProcess($sApplicationUID, 'PAUSED');
}
/*
@@ -3678,6 +3683,8 @@ class Cases
*/
public function cancelCase($sApplicationUID, $iIndex, $user_logged)
{
$this->getExecuteTriggerProcess($sApplicationUID, 'CANCELED');
$oApplication = new Application();
$aFields = $oApplication->load($sApplicationUID);
$oCriteria = new Criteria('workflow');
@@ -3856,6 +3863,8 @@ class Cases
if ($this->appSolr != null) {
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
$this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED');
return true;
}
@@ -4785,7 +4794,7 @@ class Cases
array_push($RESULT_OBJECTS['INPUT_DOCUMENTS'], -1);
array_push($RESULT_OBJECTS['OUTPUT_DOCUMENTS'], -1);
array_push($RESULT_OBJECTS['CASES_NOTES'], -1);
return $RESULT_OBJECTS;
}
@@ -6146,4 +6155,31 @@ class Cases
}
return $response;
}
public function getExecuteTriggerProcess($appUid, $action)
{
if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) {
return false;
}
$aFields = $this->loadCase($appUid);
$proUid = $aFields['PRO_UID'];
require_once ( "classes/model/Process.php" );
$appProcess = new Process();
$webBotTrigger = $appProcess->getTriggerWebBotProcess($proUid, $action);
if ($webBotTrigger != false && $webBotTrigger != '') {
global $oPMScript;
$oPMScript = new PMScript();
$oPMScript->setFields($aFields['APP_DATA']);
$oPMScript->setScript($webBotTrigger);
$oPMScript->execute();
$aFields['APP_DATA'] = array_merge($aFields['APP_DATA'], $oPMScript->aFields);
$this->updateCase($aFields['APP_UID'], $aFields);
return true;
}
return false;
}
}