BUG-8905 Unpause a Case from a supervisor session.

I modified the function getPaused, in file 'workflow/engine/classes/model/AppCacheView.php', showing the cases that are paused by the current user and the ones that he supervises.
This commit is contained in:
jennylee
2012-10-30 09:03:50 -04:00
parent 093558e1d0
commit c0a9d2b75c

View File

@@ -419,6 +419,42 @@ class AppCacheView extends BaseAppCacheView
return $this->getUnassigned($userUid, false);
}
public function getProUidSupervisor($userUid)
{
//finding cases PRO_UID where $userUid is supervising
require_once ('classes/model/ProcessUser.php');
require_once ('classes/model/GroupUser.php');
$oCriteria = new Criteria('workflow');
$oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcesses = array();
while ($aRow = $oDataset->getRow()) {
$aProcesses[] = $aRow['PRO_UID'];
$oDataset->next();
}
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
$oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->add(GroupUserPeer::USR_UID, $userUid);
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aProcesses[] = $aRow['PRO_UID'];
$oDataset->next();
}
return $aProcesses;
}
/**
* gets the PAUSED cases list criteria
* param $userUid the current userUid
@@ -427,23 +463,6 @@ class AppCacheView extends BaseAppCacheView
*/
public function getPaused($userUid, $doCount)
{
//finding cases PRO_UID where $userUid is supervising
require_once ('classes/model/ProcessUser.php');
require_once ('classes/model/GroupUser.php');
$oCriteria = new Criteria('workflow');
$oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcesses = array();
while ($aRow = $oDataset->getRow()) {
$aProcesses[] = $aRow['PRO_UID'];
$oDataset->next();
}
//adding configuration fields from the configuration options
//and forming the criteria object
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
@@ -452,6 +471,8 @@ class AppCacheView extends BaseAppCacheView
$criteria = $this->addPMFieldsToCriteria('paused');
}
$aProcesses = $this->getProUidSupervisor($userUid);
//add a validation to show the processes of which $userUid is supervisor
//$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
$criteria->add(
@@ -503,37 +524,7 @@ class AppCacheView extends BaseAppCacheView
*/
public function getToRevise($userUid, $doCount)
{
require_once ('classes/model/ProcessUser.php');
require_once ('classes/model/GroupUser.php');
//adding configuration fields from the configuration options
//and forming the criteria object
$oCriteria = new Criteria('workflow');
$oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcesses = array();
while ($aRow = $oDataset->getRow()) {
$aProcesses[] = $aRow['PRO_UID'];
$oDataset->next();
}
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
$oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->add(GroupUserPeer::USR_UID, $userUid);
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aProcesses[] = $aRow['PRO_UID'];
$oDataset->next();
}
$aProcesses = $this->getProUidSupervisor($userUid, $doCount);
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
$c = new Criteria('workflow');