Merge pull request #242 from ferOnti/master

formating class.case.php
This commit is contained in:
ferOnti
2012-07-13 06:08:54 -07:00

View File

@@ -131,7 +131,8 @@ public function canStartCase($sUIDUser = '')
* @return $rows * @return $rows
*/ */
function getStartCases($sUIDUser = '') { public function getStartCases($sUIDUser = '')
{
$rows[] = array('uid' => 'char', 'value' => 'char'); $rows[] = array('uid' => 'char', 'value' => 'char');
$tasks = array(); $tasks = array();
@@ -220,7 +221,8 @@ public function canStartCase($sUIDUser = '')
* @return $rows * @return $rows
*/ */
function getStartCasesPerType($sUIDUser = '', $typeView) { public function getStartCasesPerType($sUIDUser = '', $typeView)
{
$rows[] = array('uid' => 'char', 'value' => 'char'); $rows[] = array('uid' => 'char', 'value' => 'char');
$tasks = array(); $tasks = array();
@@ -337,7 +339,8 @@ public function canStartCase($sUIDUser = '')
* @return $rows * @return $rows
*/ */
function getSelfServiceTasks($sUIDUser = '') { public function getSelfServiceTasks($sUIDUser = '')
{
$rows[] = array('uid' => '', 'value' => ''); $rows[] = array('uid' => '', 'value' => '');
$tasks = array(); $tasks = array();
@@ -420,7 +423,8 @@ public function canStartCase($sUIDUser = '')
return $rows; return $rows;
} }
function isSelfService($USR_UID, $TAS_UID){ public function isSelfService($USR_UID, $TAS_UID)
{
$tasks = $this->getSelfServiceTasks($USR_UID); $tasks = $this->getSelfServiceTasks($USR_UID);
foreach( $tasks as $key => $val ) { foreach( $tasks as $key => $val ) {
@@ -438,7 +442,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function loadCase($sAppUid, $iDelIndex = 0) { public function loadCase($sAppUid, $iDelIndex = 0)
{
try { try {
$oApp = new Application; $oApp = new Application;
$aFields = $oApp->Load($sAppUid); $aFields = $oApp->Load($sAppUid);
@@ -523,7 +528,8 @@ public function canStartCase($sUIDUser = '')
* @return $aCases * @return $aCases
*/ */
function loadCaseByNumber($sCaseNumber) { public function loadCaseByNumber($sCaseNumber)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_PROC_CODE="'.$sCaseNumber.'" '); //('SELECT * FROM APP_DELEGATION WHERE APP_PROC_CODE="'.$sCaseNumber.'" ');
try { try {
$aCases = array(); $aCases = array();
@@ -563,7 +569,8 @@ public function canStartCase($sUIDUser = '')
* @return $appLabel * @return $appLabel
*/ */
function refreshCaseLabel($sAppUid, $aAppData, $sLabel) { public function refreshCaseLabel($sAppUid, $aAppData, $sLabel)
{
$getAppLabel = "getApp$sLabel"; $getAppLabel = "getApp$sLabel";
$getTasDef = "getTasDef$sLabel"; $getTasDef = "getTasDef$sLabel";
$oApplication = new Application; $oApplication = new Application;
@@ -600,7 +607,8 @@ public function canStartCase($sUIDUser = '')
* @return $res * @return $res
*/ */
function refreshCaseTitleAndDescription($sAppUid, $aAppData) { public function refreshCaseTitleAndDescription($sAppUid, $aAppData)
{
$res['APP_TITLE'] = null; $res['APP_TITLE'] = null;
$res['APP_DESCRIPTION'] = null; $res['APP_DESCRIPTION'] = null;
//$res['APP_PROC_CODE'] = null; //$res['APP_PROC_CODE'] = null;
@@ -675,7 +683,8 @@ public function canStartCase($sUIDUser = '')
* @return $res * @return $res
*/ */
function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData) { public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData)
{
$res = array(); $res = array();
$lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
@@ -772,7 +781,8 @@ public function canStartCase($sUIDUser = '')
* @access public * @access public
* @return $appLabel * @return $appLabel
*/ */
function refreshCaseTitle($sAppUid, $aAppData) { public function refreshCaseTitle($sAppUid, $aAppData)
{
return $this->refreshCaseLabel($sAppUid, $aAppData, "Title"); return $this->refreshCaseLabel($sAppUid, $aAppData, "Title");
} }
@@ -786,7 +796,8 @@ public function canStartCase($sUIDUser = '')
* @access public * @access public
* @return $appLabel * @return $appLabel
*/ */
function refreshCaseDescription($sAppUid, $aAppData) { public function refreshCaseDescription($sAppUid, $aAppData)
{
return $this->refreshCaseLabel($sAppUid, $aAppData, "Description"); return $this->refreshCaseLabel($sAppUid, $aAppData, "Description");
} }
@@ -800,7 +811,8 @@ public function canStartCase($sUIDUser = '')
* @access public * @access public
* @return $appLabel * @return $appLabel
*/ */
function refreshCaseStatusCode($sAppUid, $aAppData) { public function refreshCaseStatusCode($sAppUid, $aAppData)
{
return $this->refreshCaseLabel($sAppUid, $aAppData, "ProcCode"); return $this->refreshCaseLabel($sAppUid, $aAppData, "ProcCode");
} }
@@ -814,7 +826,8 @@ public function canStartCase($sUIDUser = '')
* @access public * @access public
* @return $appLabel * @return $appLabel
*/ */
function arrayRecursiveDiff($aArray1, $aArray2) { public function arrayRecursiveDiff($aArray1, $aArray2)
{
$aReturn = array(); $aReturn = array();
foreach ($aArray1 as $mKey => $mValue) { foreach ($aArray1 as $mKey => $mValue) {
@@ -846,7 +859,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function updateCase($sAppUid, $Fields = array()) { public function updateCase($sAppUid, $Fields = array())
{
try { try {
$aApplicationFields = $Fields['APP_DATA']; $aApplicationFields = $Fields['APP_DATA'];
$Fields['APP_UID'] = $sAppUid; $Fields['APP_UID'] = $sAppUid;
@@ -951,7 +965,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function removeCase($sAppUid) { public function removeCase($sAppUid)
{
try { try {
$oApplication = new Application(); $oApplication = new Application();
@@ -1027,7 +1042,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function setDelInitDate($sAppUid, $iDelIndex) { public function setDelInitDate($sAppUid, $iDelIndex)
{
try { try {
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex); $oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
$oAppDel->setDelInitDate("now"); $oAppDel->setDelInitDate("now");
@@ -1051,7 +1067,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function setCatchUser($sAppUid, $iDelIndex, $usrId) { public function setCatchUser($sAppUid, $iDelIndex, $usrId)
{
try { try {
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex); $oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
$oAppDel->setDelInitDate("now"); $oAppDel->setDelInitDate("now");
@@ -1074,7 +1091,8 @@ public function canStartCase($sUIDUser = '')
* @return $row (number of APP_DELEGATION rows) * @return $row (number of APP_DELEGATION rows)
*/ */
function GetOpenThreads($sAppUid) { public function GetOpenThreads($sAppUid)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" AND DEL_THREAD_STATUS="OPEN"'); //('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" AND DEL_THREAD_STATUS="OPEN"');
try { try {
$c = new Criteria(); $c = new Criteria();
@@ -1100,7 +1118,8 @@ public function canStartCase($sUIDUser = '')
* @return $aThreads * @return $aThreads
*/ */
function getSiblingThreads($sAppUid, $iDelIndex) { public function getSiblingThreads($sAppUid, $iDelIndex)
{
try { try {
//get the parent thread //get the parent thread
$c = new Criteria(); $c = new Criteria();
@@ -1145,7 +1164,8 @@ public function canStartCase($sUIDUser = '')
* @return $aThreads * @return $aThreads
*/ */
function getOpenSiblingThreads($sNextTask, $sAppUid, $iDelIndex, $sCurrentTask) { public function getOpenSiblingThreads($sNextTask, $sAppUid, $iDelIndex, $sCurrentTask)
{
try { try {
//Get all tasks that are previous to my NextTask, we want to know if there are pending task for my nexttask //Get all tasks that are previous to my NextTask, we want to know if there are pending task for my nexttask
//we need to filter only seq joins going to my next task //we need to filter only seq joins going to my next task
@@ -1185,7 +1205,8 @@ public function canStartCase($sUIDUser = '')
* @return $aThreads * @return $aThreads
*/ */
function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array()) { public function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array())
{
//in this array we are storing all open delegation rows. //in this array we are storing all open delegation rows.
$aTaskReviewed = array(); $aTaskReviewed = array();
@@ -1257,7 +1278,7 @@ public function canStartCase($sUIDUser = '')
* @return array within the open & closed tasks * @return array within the open & closed tasks
* false -> when has not any delegation started for that task * false -> when has not any delegation started for that task
*/ */
function getReviewedTasks($taskUid, $sAppUid) public function getReviewedTasks($taskUid, $sAppUid)
{ {
$openTasks = $closedTasks = array(); $openTasks = $closedTasks = array();
@@ -1297,7 +1318,8 @@ public function canStartCase($sUIDUser = '')
* @return $row[0] * @return $row[0]
*/ */
function CountTotalPreviousTasks($sTasUid) { public function CountTotalPreviousTasks($sTasUid)
{
//SELECT * FROM ROUTE WHERE ROU_NEXT_TASK="44756CDAC1BF4F"; //SELECT * FROM ROUTE WHERE ROU_NEXT_TASK="44756CDAC1BF4F";
try { try {
$c = new Criteria(); $c = new Criteria();
@@ -1322,7 +1344,8 @@ public function canStartCase($sUIDUser = '')
* @return $pendingDel * @return $pendingDel
*/ */
function getOpenNullDelegations($sAppUid, $sTasUid) { public function getOpenNullDelegations($sAppUid, $sTasUid)
{
$pendingDel = array(); $pendingDel = array();
//PRINT "getOpenNullDelegations ( $sAppUid, $sTasUid ) "; //PRINT "getOpenNullDelegations ( $sAppUid, $sTasUid ) ";
//SELECT D.*,R.* FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID) //SELECT D.*,R.* FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID)
@@ -1388,7 +1411,8 @@ public function canStartCase($sUIDUser = '')
* @return true or false * @return true or false
*/ */
function isRouteOpen($sAppUid, $sTasUid) { public function isRouteOpen($sAppUid, $sTasUid)
{
try { try {
$c = new Criteria(); $c = new Criteria();
$c->clearSelectColumns(); $c->clearSelectColumns();
@@ -1465,7 +1489,8 @@ public function canStartCase($sUIDUser = '')
* @return void * @return void
*/ */
function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel=null) { public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel=null)
{
try { try {
$appDel = new AppDelegation(); $appDel = new AppDelegation();
$result = $appDel->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel); $result = $appDel->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel);
@@ -1491,7 +1516,8 @@ public function canStartCase($sUIDUser = '')
* @return true * @return true
*/ */
function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex) { public function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex)
{
try { try {
$appDelegation = new AppDelegation(); $appDelegation = new AppDelegation();
@@ -1519,7 +1545,8 @@ public function canStartCase($sUIDUser = '')
* @return $aDelegations * @return $aDelegations
*/ */
function GetAllDelegations($sAppUid) { public function GetAllDelegations($sAppUid)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" '); //('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" ');
try { try {
$aDelegations = array(); $aDelegations = array();
@@ -1548,7 +1575,8 @@ public function canStartCase($sUIDUser = '')
* @return $aThreads * @return $aThreads
*/ */
function GetAllThreads($sAppUid) { public function GetAllThreads($sAppUid)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" '); //('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" ');
try { try {
$aThreads = array(); $aThreads = array();
@@ -1579,7 +1607,8 @@ public function canStartCase($sUIDUser = '')
* @return $iNewDelIndex; * @return $iNewDelIndex;
*/ */
function updateAppThread($sAppUid, $iAppThreadIndex, $iNewDelIndex) { public function updateAppThread($sAppUid, $iAppThreadIndex, $iNewDelIndex)
{
try { try {
/// updating the DEL_INDEX value in the APP_THREAD /// updating the DEL_INDEX value in the APP_THREAD
$con = Propel::getConnection('workflow'); $con = Propel::getConnection('workflow');
@@ -1619,7 +1648,8 @@ public function canStartCase($sUIDUser = '')
* @return true * @return true
*/ */
function closeAppThread($sAppUid, $iAppThreadIndex) { public function closeAppThread($sAppUid, $iAppThreadIndex)
{
try { try {
$appThread = new AppThread(); $appThread = new AppThread();
$aData = array(); $aData = array();
@@ -1642,7 +1672,8 @@ public function canStartCase($sUIDUser = '')
* @return void * @return void
*/ */
function closeAllThreads($sAppUid) { public function closeAllThreads($sAppUid)
{
try { try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"'); //Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria(); $c = new Criteria();
@@ -1679,7 +1710,8 @@ public function canStartCase($sUIDUser = '')
*/ */
function newAppThread($sAppUid, $iNewDelIndex, $iAppParent) { public function newAppThread($sAppUid, $iNewDelIndex, $iAppParent)
{
try { try {
$appThread = new AppThread(); $appThread = new AppThread();
$result = $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent); $result = $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent);
@@ -1700,7 +1732,8 @@ public function canStartCase($sUIDUser = '')
* @return * @return
*/ */
function closeAllDelegations($sAppUid) { public function closeAllDelegations($sAppUid)
{
try { try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"'); //Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria(); $c = new Criteria();
@@ -1735,7 +1768,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function CloseCurrentDelegation($sAppUid, $iDelIndex) { public function CloseCurrentDelegation($sAppUid, $iDelIndex)
{
try { try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"'); //Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria(); $c = new Criteria();
@@ -1773,7 +1807,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function ReactivateCurrentDelegation($sAppUid, $iDelegation) { public function ReactivateCurrentDelegation($sAppUid, $iDelegation)
{
try { try {
$c = new Criteria(); $c = new Criteria();
$c->add(AppDelegationPeer::APP_UID, $sAppUid); $c->add(AppDelegationPeer::APP_UID, $sAppUid);
@@ -1807,7 +1842,8 @@ public function canStartCase($sUIDUser = '')
* @return Fields * @return Fields
*/ */
function startCase($sTasUid, $sUsrUid, $isSubprocess=false) { public function startCase($sTasUid, $sUsrUid, $isSubprocess=false)
{
if ($sTasUid != '') { if ($sTasUid != '') {
try { try {
@@ -1883,7 +1919,8 @@ public function canStartCase($sUIDUser = '')
* @return array * @return array
*/ */
function getNextStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0) { public function getNextStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0)
{
G::LoadClass('pmScript'); G::LoadClass('pmScript');
$oPMScript = new PMScript(); $oPMScript = new PMScript();
$oApplication = new Application(); $oApplication = new Application();
@@ -1986,7 +2023,8 @@ public function canStartCase($sUIDUser = '')
* @return array * @return array
*/ */
function getPreviousStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0) { public function getPreviousStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0)
{
//Note: Depreciated, delete in the future //Note: Depreciated, delete in the future
G::LoadClass('pmScript'); G::LoadClass('pmScript');
$oPMScript = new PMScript(); $oPMScript = new PMScript();
@@ -2095,7 +2133,8 @@ public function canStartCase($sUIDUser = '')
* @return $aNextStep * @return $aNextStep
*/ */
function getNextSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM') { public function getNextSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM')
{
$iPosition += 1; $iPosition += 1;
$oCriteria = new Criteria(); $oCriteria = new Criteria();
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID); $oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
@@ -2129,7 +2168,8 @@ public function canStartCase($sUIDUser = '')
* @return $aNextStep * @return $aNextStep
*/ */
function getPreviousSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM') { public function getPreviousSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM')
{
$iPosition -= 1; $iPosition -= 1;
if ($iPosition > 0) { if ($iPosition > 0) {
$oCriteria = new Criteria(); $oCriteria = new Criteria();
@@ -2165,7 +2205,8 @@ public function canStartCase($sUIDUser = '')
* @return array * @return array
*/ */
function getTransferHistoryCriteria($sAppUid) { public function getTransferHistoryCriteria($sAppUid)
{
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->addAsColumn('TAS_TITLE', 'TAS_TITLE.CON_VALUE'); $c->addAsColumn('TAS_TITLE', 'TAS_TITLE.CON_VALUE');
$c->addSelectColumn(UsersPeer::USR_FIRSTNAME); $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);
@@ -2267,7 +2308,8 @@ public function canStartCase($sUIDUser = '')
* @return array * @return array
*/ */
function prepareCriteriaForToDo($sUIDUserLogged) { public function prepareCriteriaForToDo($sUIDUserLogged)
{
// NEW QUERY // NEW QUERY
$c = new Criteria('workflow'); $c = new Criteria('workflow');
//$gf->clearSelectColumns();DEL_INIT_DATE //$gf->clearSelectColumns();DEL_INIT_DATE
@@ -2323,7 +2365,8 @@ public function canStartCase($sUIDUser = '')
* @param string $aAdditionalFilter * @param string $aAdditionalFilter
* @return array * @return array
*/ */
function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession=true, $aAdditionalFilter=null) { public function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession=true, $aAdditionalFilter=null)
{
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn(ApplicationPeer::APP_UID); $c->addSelectColumn(ApplicationPeer::APP_UID);
@@ -2746,7 +2789,8 @@ public function canStartCase($sUIDUser = '')
* @return array * @return array
*/ */
function loadCaseInCurrentDelegation($APP_UID) { public function loadCaseInCurrentDelegation($APP_UID)
{
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn(ApplicationPeer::APP_UID); $c->addSelectColumn(ApplicationPeer::APP_UID);
@@ -2835,7 +2879,8 @@ public function canStartCase($sUIDUser = '')
* @author gustavo cruz * @author gustavo cruz
* @return array * @return array
*/ */
function loadCaseByDelegation($appUid, $delIndex) { public function loadCaseByDelegation($appUid, $delIndex)
{
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn(ApplicationPeer::APP_UID); $c->addSelectColumn(ApplicationPeer::APP_UID);
@@ -2923,7 +2968,8 @@ public function canStartCase($sUIDUser = '')
* Description: This method set all cases with the APP_DISABLE_ACTION_DATE for today * Description: This method set all cases with the APP_DISABLE_ACTION_DATE for today
* @return void * @return void
*/ */
function ThrowUnpauseDaemon($today) { public function ThrowUnpauseDaemon($today)
{
$today = ($today==date('Y-m-d'))?date('Y-m-d'):$today; $today = ($today==date('Y-m-d'))?date('Y-m-d'):$today;
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->clearSelectColumns(); $c->clearSelectColumns();