conflicts

This commit is contained in:
Paula Quispe
2017-03-10 16:55:43 -04:00
96 changed files with 6076 additions and 2147 deletions

View File

@@ -513,9 +513,11 @@ class Cases
$aFields['DEL_TASK_DUE_DATE'] = $aAppDel['DEL_TASK_DUE_DATE'];
$aFields['DEL_FINISH_DATE'] = $aAppDel['DEL_FINISH_DATE'];
$aFields['CURRENT_USER_UID'] = $aAppDel['USR_UID'];
//Update the global variables
$aFields['TASK'] = $aAppDel['TAS_UID'];
$aFields['INDEX'] = $aAppDel['DEL_INDEX'];
$aFields['PRO_ID'] = $aAppDel['PRO_ID'];
try {
$oCurUser = new Users();
if ($jump != '') {
@@ -1147,6 +1149,17 @@ class Cases
$oCriteria->add(ListUnassignedPeer::APP_UID, $sAppUid);
ListUnassignedPeer::doDelete($oCriteria);
/*----------------------------------********---------------------------------*/
//Logger deleteCase
$nameFiles = '';
foreach (debug_backtrace() as $node) {
$nameFiles .= $node['file'] . ":" . $node['function'] . "(" . $node['line'] . ")\n";
}
$dataLog = \Bootstrap::getDefaultContextLog();
$dataLog['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER');
$dataLog['appUid'] = $sAppUid;
$dataLog['request'] = $nameFiles;
$dataLog['action'] = 'DeleteCases';
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $dataLog, $dataLog['workspace'], 'processmaker.log');
return $result;
} catch (exception $e) {
throw ($e);
@@ -1194,9 +1207,12 @@ class Cases
public function setCatchUser($sAppUid, $iDelIndex, $usrId)
{
try {
$user = UsersPeer::retrieveByPk($usrId);
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
$oAppDel->setDelInitDate("now");
$oAppDel->setUsrUid($usrId);
$oAppDel->setUsrId($user->getUsrId());
$oAppDel->save();
//update searchindex
@@ -1223,6 +1239,40 @@ class Cases
}
}
/*
* Determines if the all threads of a multiinstance task are closed
*
* @$appUid string appUid of the instance to be tested
* @$tasUid string task uid of the multiinstance task
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
*/
public function multiInstanceIsCompleted($appUid, $tasUid, $previousDelIndex)
{
$result = false;
try {
$c = new Criteria();
$c->clearSelectColumns();
$c->add(AppDelegationPeer::APP_UID, $appUid);
$c->add(AppDelegationPeer::TAS_UID, $tasUid);
$c->add(AppDelegationPeer::DEL_PREVIOUS, $previousDelIndex);
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
$rs = AppDelegationPeer::doSelectRs($c);
if ($rs->next()) {
$result = false;
} else {
$result = true;
}
} catch (exception $e) {
throw ($e);
} finally {
return $result;
}
}
/*
* GetOpenThreads
*
@@ -1656,16 +1706,38 @@ class Cases
* @param string $iPriority
* @param string $sDelType
* @param string $iAppThreadIndex
* @param string $nextDel
* @param boolean $flagControl
* @param boolean $flagControlMulInstance
* @param int $delPrevious
* @param int $appNumber
* @param int $proId
* @param int $tasId
* @return void
*/
public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0)
public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $proId = 0, $tasId = 0)
{
try {
$user = UsersPeer::retrieveByPK($sUsrUid);
$appDel = new AppDelegation();
$result = $appDel->createAppDelegation(
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel, $flagControl,
$flagControlMulInstance, $delPrevious
$sProUid,
$sAppUid,
$sTasUid,
$sUsrUid,
$iAppThreadIndex,
$iPriority,
false,
$sPrevious,
$nextDel,
$flagControl,
$flagControlMulInstance,
$delPrevious,
$appNumber,
$tasId,
(empty($user)) ? 0 : $user->getUsrId(),
$proId
);
//update searchindex
if ($this->appSolr != null) {
@@ -1868,6 +1940,7 @@ class Cases
* @param string $sAppUid,
* @param string $iNewDelIndex
* @param string $iAppParent
* @param string $appNumber
* @return $iAppThreadIndex $iNewDelIndex, $iAppThreadIndex );
*/
@@ -2019,6 +2092,7 @@ class Cases
if ($sTasUid != '') {
try {
$task = TaskPeer::retrieveByPK($sTasUid);
$user = UsersPeer::retrieveByPK($sUsrUid);
if (is_null($task)) {
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", array("TAS_UID", $sTasUid)));
@@ -2045,7 +2119,23 @@ class Cases
$iAppThreadIndex = 1; // Start Thread
$iAppDelPrio = 3; // Priority
$iDelIndex = $AppDelegation->createAppDelegation(
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess
$sProUid,
$sAppUid,
$sTasUid,
$sUsrUid,
$iAppThreadIndex,
$iAppDelPrio,
$isSubprocess,
-1,
null,
false,
false,
0,
$Application->getAppNumber(),
$task->getTasId(),
(empty($user)) ? 0 : $user->getUsrId(),
$this->Process->getProId()
);
//appThread
@@ -2072,12 +2162,28 @@ class Cases
$count = 0;
foreach($userFields as $rowUser){
if($rowUser["USR_UID"] != $sUsrUid){
//appDelegation
$AppDelegation = new AppDelegation;
$iAppThreadIndex ++; // Start Thread
$iAppDelPrio = 3; // Priority
$iDelIndex1 = $AppDelegation->createAppDelegation(
$sProUid, $sAppUid, $sTasUid, $rowUser["USR_UID"], $iAppThreadIndex, $iAppDelPrio, $isSubprocess
//appDelegation
$AppDelegation = new AppDelegation;
$iAppThreadIndex ++; // Start Thread
$iAppDelPrio = 3; // Priority
$user = UsersPeer::retrieveByPK($rowUser["USR_UID"]);
$iDelIndex1 = $AppDelegation->createAppDelegation(
$sProUid,
$sAppUid,
$sTasUid,
$rowUser["USR_UID"],
$iAppThreadIndex,
$iAppDelPrio,
$isSubprocess,
-1,
null,
false,
false,
0,
$Application->getAppNumber(),
$task->getTasId(),
(empty($user)) ? 0 : $user->getUsrId(),
$this->Process->getProId()
);
//appThread
$AppThread = new AppThread;
@@ -3962,6 +4068,7 @@ class Cases
$aData['APP_ENABLE_ACTION_USER'] = $sUserUID;
$aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
$aData['APP_DISABLE_ACTION_DATE'] = $sUnpauseDate;
$aData['APP_NUMBER'] = $oApplication->getAppNumber();
$oAppDelay = new AppDelay();
$oAppDelay->create($aData);
@@ -4010,6 +4117,7 @@ class Cases
//get information about current $iDelegation row
$oAppDelegation = new AppDelegation();
$user = UsersPeer::retrieveByPK($sUserUID);
$aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation);
//and creates a new AppDelegation row with the same user, task, process, etc.
$proUid = $aFieldsDel['PRO_UID'];
@@ -4017,7 +4125,24 @@ class Cases
$tasUid = $aFieldsDel['TAS_UID'];
$usrUid = $aFieldsDel['USR_UID'];
$delThread = $aFieldsDel['DEL_THREAD'];
$iIndex = $oAppDelegation->createAppDelegation($proUid, $appUid, $tasUid, $usrUid, $delThread);
$iIndex = $oAppDelegation->createAppDelegation(
$proUid,
$appUid,
$tasUid,
$usrUid,
$delThread,
3,
false,
-1,
null,
false,
false,
0,
$aFieldsDel['APP_NUMBER'],
$aFieldsDel['TAS_ID'],
(empty($user)) ? 0 : $user->getUsrId(),
$aFieldsDel['PRO_ID']
);
//update other fields in the recent new appDelegation
$aData = array();
@@ -4153,6 +4278,7 @@ class Cases
$array['APP_DELEGATION_USER'] = $user_logged;
$array['APP_ENABLE_ACTION_USER'] = $user_logged;
$array['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
$array['APP_NUMBER'] = $oApplication->getAppNumber();
$delay->create($array);
//Before cancel a case verify if is a child case
@@ -4366,10 +4492,26 @@ class Cases
public function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN')
{
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
$user = UsersPeer::retrieveByPK($newUserUID);
$oAppDelegation = new AppDelegation();
$aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation);
$iIndex = $oAppDelegation->createAppDelegation(
$aFieldsDel['PRO_UID'], $aFieldsDel['APP_UID'], $aFieldsDel['TAS_UID'], $aFieldsDel['USR_UID'], $aFieldsDel['DEL_THREAD']
$aFieldsDel['PRO_UID'],
$aFieldsDel['APP_UID'],
$aFieldsDel['TAS_UID'],
(empty($user)) ? 0 : $user->getUsrId(),
$aFieldsDel['DEL_THREAD'],
3,
false,
-1,
null,
false,
false,
0,
$aFieldsDel['APP_NUMBER'],
$aFieldsDel['TAS_ID'],
(empty($user)) ? 0 : $user->getUsrId(),
$aFieldsDel['PRO_ID']
);
$newDelIndex = $iIndex;
$aData = array();
@@ -4382,6 +4524,7 @@ class Cases
$aData['USR_UID'] = $newUserUID;
$aData['DEL_INIT_DATE'] = null;
$aData['DEL_FINISH_DATE'] = null;
$aData['USR_ID'] = (empty($user)) ? 0 : $user->getUsrId();
$oAppDelegation->update($aData);
$oAppThread = new AppThread();
$oAppThread->update(
@@ -4403,6 +4546,7 @@ class Cases
$aData['APP_DELEGATION_USER'] = $sUserUID;
$aData['APP_ENABLE_ACTION_USER'] = $sUserUID;
$aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
$aData['APP_NUMBER'] = $aFieldsDel['APP_NUMBER'];
$oAppDelay = new AppDelay();
$oAppDelay->create($aData);
@@ -5215,11 +5359,12 @@ class Cases
}
$aConfiguration = ($aTaskInfo['TAS_EMAIL_SERVER_UID'] != '') ?
$eServer->getEmailServer($aTaskInfo['TAS_EMAIL_SERVER_UID'], true) : $eServer->getEmailServerDefault();
$aConfiguration['SMTPSecure'] = $aConfiguration['SMTPSECURE'];
$msgError = '';
if (empty($aConfiguration)) {
$msgError = G::LoadTranslation('ID_THE_DEFAULT_CONFIGURATION');
$aConfiguration['MESS_ENGINE'] = '';
} else {
$aConfiguration['SMTPSecure'] = $aConfiguration['SMTPSECURE'];
}
if ($aTaskInfo['TAS_NOT_EMAIL_FROM_FORMAT']) {
$fromName = $aConfiguration['MESS_FROM_NAME'];