This commit is contained in:
Paula V. Quispe
2016-11-07 13:04:02 -05:00
parent b7f6e01efc
commit c7e9889032
2 changed files with 208 additions and 147 deletions

View File

@@ -267,6 +267,7 @@ class MessageApplication
$criteria->addSelectColumn(\BpmnEventPeer::EVN_UID);
$criteria->addSelectColumn(\BpmnEventPeer::EVN_TYPE);
$criteria->addSelectColumn(\BpmnEventPeer::EVN_MARKER);
$criteria->addSelectColumn(\BpmnEventPeer::EVN_NAME);
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_USR_UID);
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_VARIABLES);
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_CORRELATION);
@@ -370,6 +371,7 @@ class MessageApplication
$ws = new \wsBase();
$case = new \Cases();
$common = new \ProcessMaker\Util\Common();
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$common->setFrontEnd($frontEnd);
@@ -428,44 +430,65 @@ class MessageApplication
$applicationUid = $arrayResult["caseId"];
$appUid = $arrayResult["caseId"];
$appNumber = $arrayResult["caseNumber"];
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'CREATED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $messageEventDefinitionUserUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'appUid' => $appUid
,'appNumber'=> $appNumber
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
200
,"Case #$appNumber created"
,'CREATED-NEW-CASE'
,''//timeZone
,$messageEventDefinitionUserUid
,$processUid
,$taskUid
,$appUid
,$appNumber
,$aInfo
);
$result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1);
$arrayResult = \G::json_decode(\G::json_encode($result), true);
if ($arrayResult["status_code"] == 0) {
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $messageEventDefinitionUserUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'appUid' => $appUid
,'appNumber'=> $appNumber
,'delIndex' => '1'
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
200
,"Case #$appNumber routed"
,'ROUTED-NEW-CASE'
,''//timeZone
,$messageEventDefinitionUserUid
,$processUid
,$taskUid
,$appUid
,$appNumber
,'1'//Del Index
,$aInfo
);
} else {
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $messageEventDefinitionUserUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'appUid' => $appUid
,'appNumber'=> $appNumber
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$appNumber. " . $arrayResult["message"]
,'ROUTED-NEW-CASE'
,''//timeZone
,$messageEventDefinitionUserUid
,$processUid
,$taskUid
,$appUid
,$appNumber
,$aInfo
);
}
@@ -474,14 +497,21 @@ class MessageApplication
//Counter
$counterStartMessageEvent++;
} else {
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'CREATED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $messageEventDefinitionUserUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$appNumber. " . $arrayResult["message"]
,'CREATED-NEW-CASE'
,''//timeZone
,$messageEventDefinitionUserUid
,$processUid
,$taskUid
,$aInfo
);
}
}
@@ -520,30 +550,44 @@ class MessageApplication
$result = $ws->derivateCase($userUid, $applicationUid, $delIndex);
$arrayResult = \G::json_decode(\G::json_encode($result), true);
if ($arrayResult["status_code"] == 0) {
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $userUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $appNumber
,'delIndex' => $delIndex
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
200
,"Case #$appNumber routed "
,'ROUTED-NEW-CASE'
,''//timeZone
,$userUid
,$processUid
,$taskUid
,$applicationUid
,$appNumber
,$delIndex
,$aInfo
);
} else {
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'workspace'=> $sysSys
,'usrUid' => $userUid
,'proUid' => $processUid
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $appNumber
,'delIndex' => $delIndex
,'evnUid' => $value['EVN_UID']
,'evnName' => $value['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$appNumber. " . $arrayResult["message"]
,'ROUTED-NEW-CASE'
,''//timeZone
,$userUid
,$processUid
,$taskUid
,$applicationUid
,$appNumber
,$delIndex
,$aInfo
);
}
@@ -629,38 +673,10 @@ class MessageApplication
$level,
$message,
$action='',
$timeZone='',
$usrUid='',
$proUid='',
$tasUid='',
$appUid='',
$appNumber='',
$delIndex='',
$stepUid='',
$triUid='',
$outDocUid='',
$inpDocUid='',
$url=''
$aContext = array()
)
{
try {
$aContext = array(
'ip' => \G::getIpAddress()
,'action' => $action
,'TimeZone' => $timeZone
,'workspace'=> (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"
,'usrUid' => $usrUid
,'proUid' => $proUid
,'tasUid' => $tasUid
,'appUid' => $appUid
,'appNumber'=> $appNumber
,'delIndex' => $delIndex
,'stepUid' => $stepUid
,'triUid' => $triUid
,'outDocUid'=> $outDocUid
,'inpDocUid'=> $inpDocUid
,'url' => $url
);
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
} catch (\Exception $e) {
throw $e;

View File

@@ -1178,38 +1178,10 @@ class TimerEvent
$level,
$message,
$action='',
$timeZone='',
$usrUid='',
$proUid='',
$tasUid='',
$appUid='',
$appNumber='',
$delIndex='',
$stepUid='',
$triUid='',
$outDocUid='',
$inpDocUid='',
$url=''
$aContext = array()
)
{
try {
$aContext = array(
'ip' => \G::getIpAddress()
,'action' => $action
,'TimeZone' => $timeZone
,'workspace'=> (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"
,'usrUid' => $usrUid
,'proUid' => $proUid
,'tasUid' => $tasUid
,'appUid' => $appUid
,'appNumber'=> $appNumber
,'delIndex' => $delIndex
,'stepUid' => $stepUid
,'triUid' => $triUid
,'outDocUid'=> $outDocUid
,'inpDocUid'=> $inpDocUid
,'url' => $url
);
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
} catch (\Exception $e) {
throw $e;
@@ -1233,6 +1205,7 @@ class TimerEvent
$ws = new \wsBase();
$case = new \Cases();
$common = new \ProcessMaker\Util\Common();
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$common->setFrontEnd($frontEnd);
@@ -1246,11 +1219,17 @@ class TimerEvent
$common->frontEndShow("START");
$this->log("START-NEW-CASES", "Date \"$datetime (UTC +00:00)\": Start new cases");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'START-NEW-CASES'
,'timeZone' => $datetime
,'workspace'=> $sysSys
);
$this->syslog(
200
,'Start new cases'
,'START-NEW-CASES'
,$datetime
,$aInfo
);
//Query
@@ -1396,16 +1375,23 @@ class TimerEvent
$common->frontEndShow("TEXT", "> Routing the case #$applicationNumber...");
$this->log("CREATED-NEW-CASE", "Case #$applicationNumber created, APP_UID: $applicationUid");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'CREATED-NEW-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
200
,"Case #$applicationNumber created"
,'CREATED-NEW-CASE'
,$datetime
,''//UsrUid
,$arrayTimerEventData["PRJ_UID"]
,$taskUid
,$applicationUid
,$applicationNumber
,$aInfo
);
//Derivate new case
@@ -1417,47 +1403,68 @@ class TimerEvent
$common->frontEndShow("TEXT", " - OK");
$this->log("ROUTED-NEW-CASE", "Case #$applicationNumber routed, APP_UID: $applicationUid");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'delIndex' => '1'
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
200
,"Case #$applicationNumber routed"
,'ROUTED-NEW-CASE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$taskUid
,$applicationUid
,$applicationNumber
,'1'//Del Index
,$aInfo
);
} else {
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
$this->log("ROUTED-NEW-CASE", $arrayResult["message"] . ", Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"], "Failed");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'delIndex' => '1'
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$applicationNumber. " . $arrayResult["message"]
,'ROUTED-NEW-CASE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$taskUid
,$applicationUid
,$applicationNumber
,'1'//Del Index
,$aInfo
);
}
} else {
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
$this->log("CREATED-NEW-CASE", $arrayResult["message"] . ", PRO_UID: " . $arrayTimerEventData["PRJ_UID"], "Failed");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'ROUTED-NEW-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$applicationNumber. " . $arrayResult["message"]
,'CREATED-NEW-CASE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$taskUid
,$aInfo
);
}
@@ -1469,24 +1476,36 @@ class TimerEvent
$common->frontEndShow("TEXT", "Not exists any record to start a new case, on date \"$datetime (UTC +00:00)\"");
$this->log("NO-RECORDS", "Not exists any record to start a new case");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => $action
,'TimeZone' => $datetime
,'workspace'=> $sysSys
);
$this->syslog(
200
,'Not exists any record to start a new case'
,'NO-RECORDS'
,$datetime
);
,$aInfo
);
}
$common->frontEndShow("END");
//Intermediate Catch Timer-Event (continue the case) ///////////////////////////////////////////////////////
$this->log("START-CONTINUE-CASES", "Date \"$datetime (UTC +00:00)\": Start continue the cases");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => $action
,'TimeZone' => $datetime
,'workspace'=> $sysSys
);
$this->syslog(
200
,'Start continue the cases'
,'START-CONTINUE-CASES'
,$datetime
);
200
,'Start continue the cases'
,'START-CONTINUE-CASES'
,$aInfo
);
//Query
$criteriaMain = $this->getTimerEventCriteria();
@@ -1662,32 +1681,45 @@ class TimerEvent
$common->frontEndShow("TEXT", " - OK");
$this->log("CONTINUED-CASE", "Case #$applicationNumber continued, APP_UID: $applicationUid");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'CONTINUED-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
200
,"Case #$applicationNumber continued"
,'CONTINUED-CASE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$tasUid
,$applicationUid
,$applicationNumber
,$delIndex
,$aInfo
);
} else {
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
$this->log("CONTINUED-CASE", $arrayResult["message"] . ", Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"], "Failed");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'CONTINUED-CASE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
500
,"Failed case #$applicationUid. " . $arrayResult["message"]
,'CONTINUED-CASE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$tasUid
,$applicationUid
,$applicationNumber
,$aInfo
);
}
@@ -1695,16 +1727,23 @@ class TimerEvent
}
} else {
$this->log("INVALID-CONTINUE-DATE", "Continue date: $continueCaseDate, Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]);
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => 'INVALID-CONTINUE-DATE'
,'timeZone' => $datetime
,'workspace'=> $sysSys
,'proUid' => $arrayTimerEventData["PRJ_UID"]
,'tasUid' => $taskUid
,'appUid' => $applicationUid
,'appNumber'=> $applicationNumber
,'evnUid' => $row['EVN_UID']
,'evnName' => $row['EVN_NAME']
);
$this->syslog(
200
,'Continue date '. $continueCaseDate
,'INVALID-CONTINUE-DATE'
,$datetime
,''//usrUid
,$arrayTimerEventData["PRJ_UID"]
,$tasUid
,$applicationUid
,$applicationNumber
,$aInfo
);
}
@@ -1720,11 +1759,17 @@ class TimerEvent
$common->frontEndShow("TEXT", "Not exists any record to continue a case, on date \"$datetime (UTC +00:00)\"");
$this->log("NO-RECORDS", "Not exists any record to continue a case");
$aInfo = array(
'ip' => \G::getIpAddress()
,'action' => $action
,'TimeZone' => $datetime
,'workspace'=> $sysSys
);
$this->syslog(
200
,'Not exists any record to continue a case'
,'NO-RECORDS'
,$datetime
,$aInfo
);
}