diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 4430aefca..265977ea2 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -5289,25 +5289,45 @@ class Cases $delIndex = array(); $oCriteria = new Criteria('workflow'); + if ($USER_RELATION == 1) { + //Users + $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); + $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); + if ($aCase['APP_STATUS'] != 'COMPLETED') { + if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { + $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + } + } + $oCriteria->add(AppDelegationPeer::USR_UID, $USER); - $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); - $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); - if ($aCase['APP_STATUS'] != 'COMPLETED') { - if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { - $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $delIndex[] = $aRow['DEL_INDEX']; + $oDataset->next(); + } + } else { + //Groups + $oCriteria->addJoin(GroupUserPeer::USR_UID, AppDelegationPeer::USR_UID, Criteria::LEFT_JOIN); + $oCriteria->add(GroupUserPeer::GRP_UID, $USER); + $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); + $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); + if ($aCase['APP_STATUS'] != 'COMPLETED') { + if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { + $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + } + } + + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $delIndex[] = $aRow['DEL_INDEX']; + $oDataset->next(); } } - $oCriteria->add(AppDelegationPeer::USR_UID, $USER); - - $oDataset = AppDelegationPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $delIndex[] = $aRow['DEL_INDEX']; - $oDataset->next(); - } $RESULT['MSGS_HISTORY'] = array_merge(array('DEL_INDEX' => $delIndex), $RESULT['MSGS_HISTORY']); - break; case 'DYNAFORM': $oCriteria = new Criteria('workflow'); @@ -5415,25 +5435,41 @@ class Cases $delIndex = array(); if ($TASK_SOURCE != "" && (int)$TASK_SOURCE != 0) { $oCriteria = new Criteria('workflow'); - - $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); - $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); - if ($aCase['APP_STATUS'] != 'COMPLETED') { - if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { - $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + if ($USER_RELATION == 1) { + $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); + $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); + if ($aCase['APP_STATUS'] != 'COMPLETED') { + if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { + $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + } + } + $oCriteria->add(AppDelegationPeer::USR_UID, $USER); + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $delIndex[] = $aRow['DEL_INDEX']; + $oDataset->next(); + } + } else { + //Groups + $oCriteria->addJoin(GroupUserPeer::USR_UID, AppDelegationPeer::USR_UID, Criteria::LEFT_JOIN); + $oCriteria->add(GroupUserPeer::GRP_UID, $USER); + $oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID); + $oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID); + if ($aCase['APP_STATUS'] != 'COMPLETED') { + if ($TASK_SOURCE != '' && $TASK_SOURCE != "0" && $TASK_SOURCE != 0) { + $oCriteria->add(AppDelegationPeer::TAS_UID, $TASK_SOURCE); + } + } + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $delIndex[] = $aRow['DEL_INDEX']; + $oDataset->next(); } } - $oCriteria->add(AppDelegationPeer::USR_UID, $USER); - - $oDataset = AppDelegationPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - - while ($aRow = $oDataset->getRow()) { - $delIndex[] = $aRow['DEL_INDEX']; - $oDataset->next(); - } - $RESULT['MSGS_HISTORY'] = array_merge(array('DEL_INDEX' => $delIndex), $RESULT['MSGS_HISTORY']); } break; diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index c5170fb42..ca860287a 100755 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -42,7 +42,6 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { $appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']); $appMessageCountArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true); - $result = new stdClass(); $aProcesses = Array (); @@ -61,7 +60,6 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { if (count($respBlock["MSGS_HISTORY"]) > 0) { $respMess = $respBlock["MSGS_HISTORY"]["PERMISSION"]; - if (isset($respBlock["MSGS_HISTORY"]["DEL_INDEX"])) { $delIndex = $respBlock["MSGS_HISTORY"]["DEL_INDEX"]; } @@ -69,7 +67,6 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { if (count($respView["MSGS_HISTORY"]) > 0) { $respMess = $respView["MSGS_HISTORY"]["PERMISSION"]; - if (isset($respView["MSGS_HISTORY"]["DEL_INDEX"])) { $delIndex = $respView["MSGS_HISTORY"]["DEL_INDEX"]; } @@ -77,9 +74,8 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { if (count($respResend["MSGS_HISTORY"]) > 0) { $respMess = $respResend["MSGS_HISTORY"]["PERMISSION"]; - - if (isset($respBlock["MSGS_HISTORY"]["DEL_INDEX"])) { - $delIndex = $respBlock["MSGS_HISTORY"]["DEL_INDEX"]; + if (isset($respResend["MSGS_HISTORY"]["DEL_INDEX"])) { + $delIndex = $respResend["MSGS_HISTORY"]["DEL_INDEX"]; } }