formating complete of class.case.php using standard PSR2
This commit is contained in:
@@ -189,13 +189,21 @@ class Cases
|
||||
$c->addAlias('C2', 'CONTENT');
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::TAS_UID, 'C1.CON_ID');
|
||||
$aConditions[] = array('C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::PRO_UID, 'C2.CON_ID');
|
||||
$aConditions[] = array('C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
$c->addAscendingOrderByColumn('PRO_TITLE');
|
||||
@@ -204,11 +212,14 @@ class Cases
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
while ($row = $rs->getRow()) {
|
||||
$rows[] = array('uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')', 'pro_uid' => $row['PRO_UID']);
|
||||
$rows[] = array(
|
||||
'uid' => $row['TAS_UID'],
|
||||
'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')',
|
||||
'pro_uid' => $row['PRO_UID']
|
||||
);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
@@ -217,7 +228,7 @@ class Cases
|
||||
* @param string $sUIDUser
|
||||
* @return $rows
|
||||
*/
|
||||
public function getStartCasesPerType($sUIDUser = '', $typeView)
|
||||
public function getStartCasesPerType($sUIDUser = '', $typeView = null)
|
||||
{
|
||||
$rows[] = array('uid' => 'char', 'value' => 'char');
|
||||
$tasks = array();
|
||||
@@ -289,13 +300,21 @@ class Cases
|
||||
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::TAS_UID, 'C1.CON_ID');
|
||||
$aConditions[] = array('C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::PRO_UID, 'C2.CON_ID');
|
||||
$aConditions[] = array('C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
|
||||
@@ -313,10 +332,21 @@ class Cases
|
||||
if ($typeView == 'category') {
|
||||
$taskTitle = TaskPeer::retrieveByPK($row['TAS_UID']);
|
||||
$row['TAS_TITLE']= $taskTitle->getTasTitle();
|
||||
$row['CATEGORY_NAME'] = ($row['CATEGORY_NAME'] == '') ? G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME'];
|
||||
$rows[] = array('uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')', 'pro_uid' => $row['PRO_UID'], 'cat' => $row['PRO_CATEGORY'], 'catname' => $row['CATEGORY_NAME']);
|
||||
$row['CATEGORY_NAME'] = ($row['CATEGORY_NAME'] == '') ?
|
||||
G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME'];
|
||||
$rows[] = array(
|
||||
'uid' => $row['TAS_UID'],
|
||||
'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')',
|
||||
'pro_uid' => $row['PRO_UID'],
|
||||
'cat' => $row['PRO_CATEGORY'],
|
||||
'catname' => $row['CATEGORY_NAME']
|
||||
);
|
||||
} else {
|
||||
$rows[] = array('uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')', 'pro_uid' => $row['PRO_UID']);
|
||||
$rows[] = array(
|
||||
'uid' => $row['TAS_UID'],
|
||||
'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')',
|
||||
'pro_uid' => $row['PRO_UID']
|
||||
);
|
||||
}
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
@@ -390,13 +420,21 @@ class Cases
|
||||
$c->addAlias('C2', 'CONTENT');
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::TAS_UID, 'C1.CON_ID');
|
||||
$aConditions[] = array('C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C1.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C1.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(TaskPeer::PRO_UID, 'C2.CON_ID');
|
||||
$aConditions[] = array('C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array('C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
|
||||
$aConditions[] = array(
|
||||
'C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$aConditions[] = array(
|
||||
'C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()
|
||||
);
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
$c->addAscendingOrderByColumn('PRO_TITLE');
|
||||
@@ -405,7 +443,11 @@ class Cases
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
while ($row = $rs->getRow()) {
|
||||
$rows[] = array('uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')', 'pro_uid' => $row['PRO_UID']);
|
||||
$rows[] = array(
|
||||
'uid' => $row['TAS_UID'],
|
||||
'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')',
|
||||
'pro_uid' => $row['PRO_UID']
|
||||
);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
@@ -478,7 +520,8 @@ class Cases
|
||||
$aFields['UPDATE_DATE'] = $oApp->getAppUpdateDate();
|
||||
}
|
||||
|
||||
if ($iDelIndex > 0) { //get the Delegation fields,
|
||||
if ($iDelIndex > 0) {
|
||||
//get the Delegation fields,
|
||||
$oAppDel = new AppDelegation();
|
||||
$oAppDel->Load($sAppUid, $iDelIndex);
|
||||
$aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
@@ -614,7 +657,6 @@ class Cases
|
||||
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
|
||||
$currentDelegations = AppDelegationPeer::doSelect($cri);
|
||||
//load only the tas_def fields, because these three or two values are needed
|
||||
//SELECT CONTENT.CON_CATEGORY, CONTENT.CON_VALUE FROM CONTENT WHERE CONTENT.CON_ID='63515150649b03231c3b020026243292' AND CONTENT.CON_LANG='es'
|
||||
for ($r = count($currentDelegations) - 1; $r >= 0; $r--) {
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
@@ -629,14 +671,14 @@ class Cases
|
||||
|
||||
while (is_array($row)) {
|
||||
switch ($row['CON_CATEGORY']) {
|
||||
case 'TAS_DEF_TITLE' :
|
||||
case 'TAS_DEF_TITLE':
|
||||
$tasDefTitle = $row['CON_VALUE'];
|
||||
if ($tasDefTitle != '' && !$bUpdatedDefTitle) {
|
||||
$res['APP_TITLE'] = G::replaceDataField($tasDefTitle, $aAppData);
|
||||
$bUpdatedDefTitle = true;
|
||||
}
|
||||
break;
|
||||
case 'TAS_DEF_DESCRIPTION' :
|
||||
case 'TAS_DEF_DESCRIPTION':
|
||||
$tasDefDescription = $row['CON_VALUE'];
|
||||
$tasDefDescription = $row['CON_VALUE'];
|
||||
if ($tasDefDescription != '' && !$bUpdatedDefDescription) {
|
||||
@@ -681,7 +723,6 @@ class Cases
|
||||
$rowCri = $rsCri->getRow();
|
||||
|
||||
//load only the tas_def fields, because these three or two values are needed
|
||||
//SELECT CONTENT.CON_CATEGORY, CONTENT.CON_VALUE FROM CONTENT WHERE CONTENT.CON_ID='63515150649b03231c3b020026243292' AND CONTENT.CON_LANG='es'
|
||||
while (is_array($rowCri)) {
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
@@ -695,7 +736,7 @@ class Cases
|
||||
$row = $rs->getRow();
|
||||
while (is_array($row)) {
|
||||
switch ($row['CON_CATEGORY']) {
|
||||
case 'TAS_DEF_TITLE' :
|
||||
case 'TAS_DEF_TITLE':
|
||||
if ($bUpdatedDefTitle) {
|
||||
break;
|
||||
}
|
||||
@@ -720,7 +761,7 @@ class Cases
|
||||
BasePeer::doUpdate($c1, $c2,$con);
|
||||
}
|
||||
break;
|
||||
case 'TAS_DEF_DESCRIPTION' :
|
||||
case 'TAS_DEF_DESCRIPTION':
|
||||
if ($bUpdatedDefDescription) {
|
||||
break;
|
||||
}
|
||||
@@ -728,7 +769,8 @@ class Cases
|
||||
if ($tasDefDescription != '' ) {
|
||||
$newAppDescription = G::replaceDataField($tasDefDescription, $aAppData);
|
||||
$res['APP_DESCRIPTION'] = $newAppDescription;
|
||||
if ( isset($fields['APP_DESCRIPTION']) && $fields['APP_DESCRIPTION'] == $newAppDescription ) {
|
||||
if (isset($fields['APP_DESCRIPTION']) &&
|
||||
$fields['APP_DESCRIPTION'] == $newAppDescription) {
|
||||
break;
|
||||
}
|
||||
$bUpdatedDefDescription = true;
|
||||
@@ -852,13 +894,17 @@ class Cases
|
||||
*/
|
||||
$oApp = ApplicationPeer::retrieveByPk( $sAppUid );
|
||||
$appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
if (isset($Fields['APP_TITLE'])) $appFields['APP_TITLE'] = $Fields['APP_TITLE'];
|
||||
if (isset($Fields['APP_DESCRIPTION'])) $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
|
||||
|
||||
if (isset($Fields['APP_TITLE'])) {
|
||||
$appFields['APP_TITLE'] = $Fields['APP_TITLE'];
|
||||
}
|
||||
if (isset($Fields['APP_DESCRIPTION'])) {
|
||||
$appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
|
||||
}
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields);
|
||||
|
||||
//Start: Save History --By JHL
|
||||
if (isset($Fields['CURRENT_DYNAFORM'])) {//only when that variable is set.. from Save
|
||||
if (isset($Fields['CURRENT_DYNAFORM'])) {
|
||||
//only when that variable is set.. from Save
|
||||
$FieldsBefore = $this->loadCase( $sAppUid );
|
||||
$FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields);
|
||||
$fieldsOnBoth = array_intersect_assoc($FieldsBefore['APP_DATA'], $aApplicationFields);
|
||||
@@ -868,7 +914,8 @@ class Cases
|
||||
$FieldsDifference[$key] = $value;
|
||||
}
|
||||
}
|
||||
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {//There are changes
|
||||
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {
|
||||
//There are changes
|
||||
$appHistory = new AppHistory();
|
||||
$aFieldsHistory = $Fields;
|
||||
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
|
||||
@@ -877,9 +924,14 @@ class Cases
|
||||
}
|
||||
//End Save History
|
||||
|
||||
//we are removing the app_title and app_description from this array, because they already be updated in newRefreshCaseTitleAndDescription function
|
||||
if (isset($Fields['APP_TITLE'])) unset ($Fields['APP_TITLE']);
|
||||
if (isset($Fields['APP_DESCRIPTION'])) unset ($Fields['APP_DESCRIPTION']);
|
||||
//we are removing the app_title and app_description from this array,
|
||||
//because they already be updated in newRefreshCaseTitleAndDescription function
|
||||
if (isset($Fields['APP_TITLE'])) {
|
||||
unset ($Fields['APP_TITLE']);
|
||||
}
|
||||
if (isset($Fields['APP_DESCRIPTION'])) {
|
||||
unset ($Fields['APP_DESCRIPTION']);
|
||||
}
|
||||
$oApp->update($Fields);
|
||||
|
||||
$DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : '';
|
||||
@@ -891,7 +943,9 @@ class Cases
|
||||
$addtionalTables = new additionalTables();
|
||||
|
||||
$oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields);
|
||||
$addtionalTables->updateReportTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields);
|
||||
$addtionalTables->updateReportTables(
|
||||
$appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields
|
||||
);
|
||||
|
||||
//now update the priority in appdelegation table, using the defined variable in task
|
||||
if (trim($DEL_INDEX) != '' && trim($TAS_UID) != '') {
|
||||
@@ -905,10 +959,6 @@ class Cases
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$VAR_PRI = substr($row['TAS_PRIORITY_VARIABLE'], 2);
|
||||
|
||||
//$oTask = new Task;
|
||||
//$array = $oTask->load($TAS_UID);
|
||||
//$VAR_PRI = substr($array['TAS_PRIORITY_VARIABLE'], 2);
|
||||
//end optimized code.
|
||||
|
||||
$x = unserialize($Fields['APP_DATA']);
|
||||
@@ -919,20 +969,18 @@ class Cases
|
||||
$array['APP_UID'] = $sAppUid;
|
||||
$array['DEL_INDEX'] = $DEL_INDEX;
|
||||
$array['TAS_UID'] = $TAS_UID;
|
||||
$array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ? ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3');
|
||||
$array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ?
|
||||
($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3');
|
||||
$oDel->update($array);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Update Solr Index
|
||||
if($this->appSolr != null)
|
||||
{
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
|
||||
return $Fields;
|
||||
}
|
||||
catch (exception $e) {
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
@@ -946,7 +994,6 @@ class Cases
|
||||
*/
|
||||
public function removeCase($sAppUid)
|
||||
{
|
||||
|
||||
try {
|
||||
$oApplication = new Application();
|
||||
$oAppDelegation = new AppDelegation();
|
||||
@@ -1003,9 +1050,9 @@ class Cases
|
||||
$result = $oApp->remove($sAppUid);
|
||||
|
||||
//delete application from index
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->deleteApplicationSearchIndex($sAppUid);
|
||||
|
||||
}
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1027,7 +1074,7 @@ class Cases
|
||||
$oAppDel->setDelInitDate("now");
|
||||
$oAppDel->save();
|
||||
//update searchindex
|
||||
if($this->appSolr != null) {
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
} catch (exception $e) {
|
||||
@@ -1053,7 +1100,7 @@ class Cases
|
||||
$oAppDel->save();
|
||||
|
||||
//update searchindex
|
||||
if($this->appSolr != null) {
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
} catch (exception $e) {
|
||||
@@ -1070,7 +1117,6 @@ class Cases
|
||||
*/
|
||||
public function GetOpenThreads($sAppUid)
|
||||
{
|
||||
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" AND DEL_THREAD_STATUS="OPEN"');
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
@@ -1155,14 +1201,11 @@ class Cases
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aPrevious = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid);
|
||||
|
||||
if (is_array($aPrevious) && count($aPrevious) > 0 ) {
|
||||
$aThreads[] = array_merge($aPrevious, $aThreads);
|
||||
}
|
||||
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
return $aThreads;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1176,7 +1219,7 @@ class Cases
|
||||
* @name searchOpenPreviousTasks,
|
||||
* @param string $taskUid
|
||||
* @param string $sAppUid
|
||||
* @param array $aPreviousTasks optional array that serves to trace the task routes in order to avoid infinite loops.
|
||||
* @param array $aPreviousTasks optional array that serves to trace the task routes and avoid infinite loops.
|
||||
* @return $aThreads
|
||||
*/
|
||||
public function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array())
|
||||
@@ -1188,11 +1231,10 @@ class Cases
|
||||
$delegations = $this->getReviewedTasks($taskUid, $sAppUid);
|
||||
|
||||
if ($delegations !== false) {
|
||||
if ( count($delegations['open']) > 0) {
|
||||
if (count($delegations['open']) > 0) {
|
||||
//there is an open delegation, so we need to return the delegation row
|
||||
return $delegations['open'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return array(); //returning empty array
|
||||
}
|
||||
}
|
||||
@@ -1209,38 +1251,31 @@ class Cases
|
||||
|
||||
while (is_array($aRow)) {
|
||||
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid);
|
||||
|
||||
if ($delegations !== false) {
|
||||
if ( count($delegations['open']) > 0) {
|
||||
//there is an open delegation, so we need to return the delegation row
|
||||
$aTaskReviewed = array_merge($aTaskReviewed, $delegations['open']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') {
|
||||
$aTaskReviewed = array();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$aTaskReviewed = array_merge($aTaskReviewed, $delegations['closed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!in_array($aRow['TAS_UID'], $aPreviousTasks)) {
|
||||
// storing the current task uid of the task currently checked
|
||||
$aPreviousTasks[] = $aRow['TAS_UID'];
|
||||
// passing the array of previous tasks in oprder to avoid an infinite loop that prevents
|
||||
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid, $aPreviousTasks);
|
||||
|
||||
if (count($aPreviousTasks) > 0) {
|
||||
$aTaskReviewed = array_merge($aTaskReviewed, $openPreviousTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
}
|
||||
|
||||
return $aTaskReviewed;
|
||||
}
|
||||
|
||||
@@ -1267,19 +1302,16 @@ class Cases
|
||||
// loop and separate open & closed delegations in theirs respective arrays
|
||||
while ($oDataset2->next()) {
|
||||
$row = $oDataset2->getRow();
|
||||
|
||||
if ($row['DEL_THREAD_STATUS'] == 'OPEN') {
|
||||
$openTasks[] = $row;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$closedTasks[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($openTasks) == 0 && count($closedTasks) == 0) {
|
||||
return false; // return false because there is not any delegation for this task.
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return array('open' => $openTasks, 'closed' => $closedTasks);
|
||||
}
|
||||
}
|
||||
@@ -1293,7 +1325,6 @@ class Cases
|
||||
*/
|
||||
public function CountTotalPreviousTasks($sTasUid)
|
||||
{
|
||||
//SELECT * FROM ROUTE WHERE ROU_NEXT_TASK="44756CDAC1BF4F";
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
@@ -1319,11 +1350,6 @@ class Cases
|
||||
public function getOpenNullDelegations($sAppUid, $sTasUid)
|
||||
{
|
||||
$pendingDel = array();
|
||||
//PRINT "getOpenNullDelegations ( $sAppUid, $sTasUid ) ";
|
||||
//SELECT D.*,R.* FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID)
|
||||
//WHERE ((D.DEL_THREAD_STATUS="OPEN" AND D.APP_UID="'.$nextDel['APP_UID'].'") OR ISNULL(D.DEL_THREAD_STATUS)) AND R.ROU_NEXT_TASK="'.$nextDel['TAS_UID'].'"";
|
||||
//SELECT D.*,R.* FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID)
|
||||
//where ROU_NEXT_TASK = '8479670B93B749' AND APP_UID = ''
|
||||
try {
|
||||
//first query
|
||||
$c = new Criteria();
|
||||
@@ -1360,11 +1386,9 @@ class Cases
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
while (is_array($row)) {
|
||||
if ($row['DEL_THREAD_STATUS'] == 'OPEN' && $row['APP_UID'] = $sAppUid)
|
||||
if ($row['DEL_THREAD_STATUS'] == 'OPEN' && $row['APP_UID'] = $sAppUid) {
|
||||
$pendingDel[] = $row;
|
||||
else
|
||||
krumo($row['DEL_THREAD_STATUS']);
|
||||
|
||||
}
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
@@ -1395,9 +1419,9 @@ class Cases
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$open = ($row[0] >= 1);
|
||||
if ($open)
|
||||
if ($open) {
|
||||
return true;
|
||||
|
||||
}
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
@@ -1416,7 +1440,9 @@ class Cases
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$sql = 'SELECT D.*,R.* FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID) WHERE APP_UID="' . $sAppUid . '" AND ROU_NEXT_TASK="' . $sTasUid . '"';
|
||||
$sql = 'SELECT D.*,R.* ' .
|
||||
'FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID) WHERE APP_UID="' .
|
||||
$sAppUid . '" AND ROU_NEXT_TASK="' . $sTasUid . '"';
|
||||
|
||||
while (is_array($row)) {
|
||||
switch ($row['DEL_THREAD_STATUS']) {
|
||||
@@ -1434,8 +1460,9 @@ class Cases
|
||||
$open = $this->isRouteOpen($sAppUid, $row['TAS_UID']);
|
||||
break;
|
||||
}
|
||||
if ($open)
|
||||
if ($open) {
|
||||
return true;
|
||||
}
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
@@ -1460,18 +1487,36 @@ class Cases
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public 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 {
|
||||
$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
|
||||
);
|
||||
//update searchindex
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
return $result;
|
||||
}
|
||||
catch (exception $e) {
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
@@ -1496,7 +1541,7 @@ class Cases
|
||||
$aData['DEL_THREAD'] = $iAppThreadIndex;
|
||||
$appDelegation->update($aData);
|
||||
//update searchindex
|
||||
if($this->appSolr != null) {
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
return true;
|
||||
@@ -1586,21 +1631,12 @@ class Cases
|
||||
$c2 = new Criteria('workflow');
|
||||
$c2->add(AppThreadPeer::DEL_INDEX, $iNewDelIndex );
|
||||
BasePeer::doUpdate($c1, $c2,$con);
|
||||
/*
|
||||
$appThread = new AppThread();
|
||||
$aData = array();
|
||||
$aData['APP_UID'] = $sAppUid;
|
||||
$aData['APP_THREAD_INDEX'] = $iAppThreadIndex;
|
||||
$aData['DEL_INDEX'] = $iNewDelIndex;
|
||||
$appThread->update($aData);
|
||||
*/
|
||||
//update searchindex
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
return $iNewDelIndex;
|
||||
}
|
||||
catch (exception $e) {
|
||||
return $iNewDelIndex;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
@@ -1639,7 +1675,6 @@ class Cases
|
||||
public function closeAllThreads($sAppUid)
|
||||
{
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
$c->add(AppThreadPeer::APP_UID, $sAppUid);
|
||||
$c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
|
||||
@@ -1650,13 +1685,14 @@ class Cases
|
||||
$appThread->Save();
|
||||
} else {
|
||||
$msg = '';
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure)
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
//update searchindex
|
||||
if($this->appSolr != null) {
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
} catch (exception $e) {
|
||||
@@ -1679,8 +1715,9 @@ class Cases
|
||||
$appThread = new AppThread();
|
||||
$result = $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent);
|
||||
//update searchindex
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1697,7 +1734,6 @@ class Cases
|
||||
public function closeAllDelegations($sAppUid)
|
||||
{
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
@@ -1708,14 +1744,16 @@ class Cases
|
||||
$appDel->Save();
|
||||
} else {
|
||||
$msg = '';
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure)
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
//update searchindex
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1732,7 +1770,6 @@ class Cases
|
||||
public function CloseCurrentDelegation($sAppUid, $iDelIndex)
|
||||
{
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
$c->add(AppDelegationPeer::DEL_INDEX, $iDelIndex);
|
||||
@@ -1742,13 +1779,13 @@ class Cases
|
||||
foreach ($rowObj as $appDel) {
|
||||
$appDel->setDelThreadStatus('CLOSED');
|
||||
$appDel->setDelFinishDate('now');
|
||||
//$appDel->setDelDuration($oDates->calculateDuration($appDel->getDelInitDate(), $appDel->getDelFinishDate(), null, null, $appDel->getTasUid()));
|
||||
if ($appDel->Validate()) {
|
||||
$appDel->Save();
|
||||
} else {
|
||||
$msg = '';
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure)
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
@@ -1782,8 +1819,9 @@ class Cases
|
||||
$appDel->Save();
|
||||
} else {
|
||||
$msg = '';
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure)
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
@@ -1801,10 +1839,9 @@ class Cases
|
||||
* @param string $sUsrUid
|
||||
* @return Fields
|
||||
*/
|
||||
public function startCase($sTasUid, $sUsrUid, $isSubprocess=false)
|
||||
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false)
|
||||
{
|
||||
if ($sTasUid != '') {
|
||||
|
||||
try {
|
||||
$this->Task = new Task;
|
||||
$Fields = $this->Task->Load($sTasUid);
|
||||
@@ -1827,7 +1864,9 @@ class Cases
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex = 1; // Start Thread
|
||||
$iAppDelPrio = 3; // Priority
|
||||
$iDelIndex = $AppDelegation->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess);
|
||||
$iDelIndex = $AppDelegation->createAppDelegation(
|
||||
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess
|
||||
);
|
||||
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
@@ -1837,7 +1876,9 @@ class Cases
|
||||
$Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$aApplicationFields = $Fields['APP_DATA'];
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields );
|
||||
if (! isset($newValues['APP_TITLE']) ) $newValues['APP_TITLE'] = '';
|
||||
if (! isset($newValues['APP_TITLE']) ) {
|
||||
$newValues['APP_TITLE'] = '';
|
||||
}
|
||||
|
||||
$caseNumber = $Fields['APP_NUMBER'];
|
||||
$Application->update($Fields);
|
||||
@@ -1847,8 +1888,9 @@ class Cases
|
||||
$oDerivation = new Derivation();
|
||||
$oDerivation->setTasLastAssigned($sTasUid, $sUsrUid);
|
||||
//update searchindex
|
||||
if($this->appSolr != null)
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
}
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1858,13 +1900,23 @@ class Cases
|
||||
|
||||
//call plugin
|
||||
if (class_exists('folderData')) {
|
||||
$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid);
|
||||
$folderData = new folderData(
|
||||
$sProUid,
|
||||
$proFields['PRO_TITLE'],
|
||||
$sAppUid,
|
||||
$newValues['APP_TITLE'],
|
||||
$sUsrUid
|
||||
);
|
||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
|
||||
}
|
||||
//end plugin
|
||||
|
||||
return array('APPLICATION' => $sAppUid, 'INDEX' => $iDelIndex, 'PROCESS' => $sProUid, 'CASE_NUMBER' => $caseNumber);
|
||||
return array(
|
||||
'APPLICATION' => $sAppUid,
|
||||
'INDEX' => $iDelIndex,
|
||||
'PROCESS' => $sProUid,
|
||||
'CASE_NUMBER' => $caseNumber
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1898,8 +1950,9 @@ class Cases
|
||||
$c->add(AppDelegationPeer::DEL_INDEX, $iDelIndex);
|
||||
$aRow = AppDelegationPeer::doSelect($c);
|
||||
|
||||
if (!isset($aRow[0]))
|
||||
if (!isset($aRow[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sTaskUid = $aRow[0]->getTasUid();
|
||||
|
||||
@@ -1934,7 +1987,6 @@ class Cases
|
||||
} else {
|
||||
$bAccessStep = true;
|
||||
}
|
||||
|
||||
if ($bAccessStep) {
|
||||
switch ($oStep->getStepTypeObj()) {
|
||||
case 'DYNAFORM':
|
||||
@@ -1953,8 +2005,14 @@ class Cases
|
||||
$sAction = '';
|
||||
break;
|
||||
}
|
||||
$aNextStep = array('TYPE' => $oStep->getStepTypeObj(), 'UID' => $oStep->getStepUidObj(), 'POSITION' => $oStep->getStepPosition(), 'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' . $oStep->
|
||||
getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . '&ACTION=' . $sAction);
|
||||
$aNextStep = array(
|
||||
'TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
|
||||
'&ACTION=' . $sAction
|
||||
);
|
||||
$iPosition = $iLastStep;
|
||||
}
|
||||
}
|
||||
@@ -1962,7 +2020,12 @@ class Cases
|
||||
}
|
||||
}
|
||||
if (!$aNextStep) {
|
||||
$aNextStep = array('TYPE' => 'DERIVATION', 'UID' => -1, 'POSITION' => ($iLastStep + 1), 'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN');
|
||||
$aNextStep = array(
|
||||
'TYPE' => 'DERIVATION',
|
||||
'UID' => -1,
|
||||
'POSITION' => ($iLastStep + 1),
|
||||
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
|
||||
);
|
||||
}
|
||||
return $aNextStep;
|
||||
} catch (exception $e) {
|
||||
@@ -2022,13 +2085,6 @@ class Cases
|
||||
|
||||
$aPreviousStep = null;
|
||||
if ($iPosition >= 1) {
|
||||
//to do: G::LoadClass('application');
|
||||
//to do: $oApplication = new Application($this->_dbc);
|
||||
//to do: $oApplication->load($sApplicationUID);
|
||||
//to do: G::LoadClass('pmScript');
|
||||
//to do: $oPMScript = new PMScript();
|
||||
//to do: $oPMScript->setFields($oApplication->Fields['APP_DATA']);
|
||||
|
||||
while ($iPosition >= $iFirstStep) {
|
||||
$bAccessStep = false;
|
||||
//step
|
||||
@@ -2062,7 +2118,9 @@ class Cases
|
||||
$aPreviousStep = array('TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' . $oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . '&ACTION=' . $sAction
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' .
|
||||
$oStep->getStepPosition() . '&ACTION=' . $sAction
|
||||
);
|
||||
$iPosition = $iFirstStep;
|
||||
}
|
||||
@@ -2070,7 +2128,6 @@ class Cases
|
||||
$iPosition -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$aPreviousStep) {
|
||||
$aPreviousStep = false;
|
||||
}
|
||||
@@ -2176,15 +2233,20 @@ class Cases
|
||||
G::LoadSystem($sDataBase);
|
||||
$oDataBase = new database();
|
||||
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
|
||||
$c->addAsColumn('DEL_FINISH_DATE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'-'", AppDelegationPeer::DEL_FINISH_DATE ) );
|
||||
$c->addAsColumn('APP_TYPE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'IN_PROGRESS'", AppDelayPeer::APP_TYPE ) );
|
||||
$c->addAsColumn(
|
||||
'DEL_FINISH_DATE',
|
||||
$oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL",
|
||||
"'-'",
|
||||
AppDelegationPeer::DEL_FINISH_DATE )
|
||||
);
|
||||
$c->addAsColumn(
|
||||
'APP_TYPE',
|
||||
$oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL",
|
||||
"'IN_PROGRESS'",
|
||||
AppDelayPeer::APP_TYPE )
|
||||
);
|
||||
}
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
//$c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
///-- $c->addAsColumn('DEL_FINISH_DATE', "IF (DEL_FINISH_DATE IS NULL, '-', " . AppDelegationPeer::DEL_FINISH_DATE . ") ");
|
||||
|
||||
//$c->addSelectColumn(AppDelayPeer::APP_TYPE);
|
||||
///-- $c->addAsColumn('APP_TYPE', "IF (DEL_FINISH_DATE IS NULL, 'IN_PROGRESS', " . AppDelayPeer::APP_TYPE . ") ");
|
||||
$c->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE);
|
||||
$c->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE);
|
||||
//APP_DELEGATION LEFT JOIN USERS
|
||||
@@ -2222,42 +2284,6 @@ class Cases
|
||||
* Get the Criteria for To Do Cases List
|
||||
* @param string $sUIDUserLogged
|
||||
* @return array ( 'where' => Criteria, 'group' => Criteria )
|
||||
* description: Listado de casos que se encuentran en estado TO_DO que pertenezcan al usuario actual
|
||||
*
|
||||
* Query:
|
||||
* SELECT APPLICATION.APP_UID,
|
||||
* APPLICATION.APP_NUMBER,
|
||||
* APPLICATION.APP_UPDATE_DATE,
|
||||
* APP_DELEGATION.DEL_PRIORITY,
|
||||
* APP_DELEGATION.DEL_INDEX,
|
||||
* APP_DELEGATION.TAS_UID,
|
||||
* APP_DELEGATION.DEL_INIT_DATE,
|
||||
* APP_DELEGATION.DEL_FINISH_DATE,
|
||||
* USERS.USR_UID,
|
||||
* APPLICATION.APP_STATUS,
|
||||
* IF (APP_DELEGATION.DEL_TASK_DUE_DATE <= NOW(), CONCAT('', APP_DELEGATION.DEL_TASK_DUE_DATE, ''),
|
||||
* APP_DELEGATION.DEL_TASK_DUE_DATE) AS DEL_TASK_DUE_DATE,
|
||||
* CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME) AS APP_CURRENT_USER,
|
||||
* APP_TITLE.CON_VALUE AS APP_TITLE,
|
||||
* PRO_TITLE.CON_VALUE AS APP_PRO_TITLE,
|
||||
* TAS_TITLE.CON_VALUE AS APP_TAS_TITLE,
|
||||
* CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME) AS APP_DEL_PREVIOUS_USER
|
||||
* FROM
|
||||
* APPLICATION LEFT JOIN APP_DELEGATION ON (APPLICATION.APP_UID=APP_DELEGATION.APP_UID) LEFT JOIN TASK ON (APP_DELEGATION.TAS_UID=TASK.TAS_UID) LEFT JOIN USERS ON (APP_DELEGATION.USR_UID=USERS.USR_UID) LEFT JOIN APP_THREAD ON (APPLICATION.APP_UID=APP_THREAD.APP_UID AND APP_DELEGATION.DEL_INDEX=APP_THREAD.DEL_INDEX) LEFT JOIN CONTENT APP_TITLE ON (APPLICATION.APP_UID=APP_TITLE.CON_ID AND APP_TITLE.CON_CATEGORY='APP_TITLE' AND APP_TITLE.CON_LANG='en')
|
||||
* LEFT JOIN CONTENT PRO_TITLE ON (APPLICATION.PRO_UID=PRO_TITLE.CON_ID AND PRO_TITLE.CON_CATEGORY='PRO_TITLE' AND PRO_TITLE.CON_LANG='en')
|
||||
* LEFT JOIN CONTENT TAS_TITLE ON (APP_DELEGATION.TAS_UID=TAS_TITLE.CON_ID AND TAS_TITLE.CON_CATEGORY='TAS_TITLE' AND TAS_TITLE.CON_LANG='en')
|
||||
* LEFT JOIN APP_DELEGATION APP_PREV_DEL ON (APPLICATION.APP_UID=APP_PREV_DEL.APP_UID AND APP_PREV_DEL.DEL_INDEX=APP_DELEGATION.DEL_PREVIOUS)
|
||||
* LEFT JOIN USERS APP_LAST_USER ON (APP_PREV_DEL.USR_UID=APP_LAST_USER.USR_UID)
|
||||
* WHERE
|
||||
* TASK.TAS_TYPE<>'SUBPROCESS'
|
||||
* AND USERS.USR_UID='69726522248da554d01a9d1053079479'
|
||||
* AND APPLICATION.APP_STATUS='TO_DO'
|
||||
* AND APP_DELEGATION.DEL_FINISH_DATE IS NULL
|
||||
* AND APP_THREAD.APP_THREAD_STATUS='OPEN'
|
||||
* AND APP_DELEGATION.DEL_THREAD_STATUS='OPEN'
|
||||
* AND (APPLICATION.APP_NUMBER LIKE "%%" OR APP_TITLE.CON_VALUE LIKE "%%" OR TAS_TITLE.CON_VALUE LIKE "%%" OR PRO_TITLE.CON_VALUE LIKE "%%")
|
||||
* ORDER BY APPLICATION.APP_NUMBER DESC
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function prepareCriteriaForToDo($sUIDUserLogged)
|
||||
@@ -2276,7 +2302,11 @@ class Cases
|
||||
$c->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE);
|
||||
$c->addSelectColumn(AppCacheViewPeer::DEL_INIT_DATE);
|
||||
//$c->addSelectColumn(AppCacheViewPeer::DEL_TASK_DUE_DATE );
|
||||
$c->addAsColumn('DEL_TASK_DUE_DATE', " IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ") ");
|
||||
$c->addAsColumn(
|
||||
'DEL_TASK_DUE_DATE',
|
||||
" IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
|
||||
AppCacheViewPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ") "
|
||||
);
|
||||
$c->addSelectColumn(AppCacheViewPeer::DEL_FINISH_DATE);
|
||||
$c->addSelectColumn(AppCacheViewPeer::DEL_THREAD_STATUS);
|
||||
$c->addSelectColumn(AppCacheViewPeer::APP_THREAD_STATUS);
|
||||
@@ -2332,7 +2362,11 @@ class Cases
|
||||
$c->addSelectColumn(ApplicationPeer::APP_INIT_USER);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
|
||||
//$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$c->addAsColumn('DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") ");
|
||||
$c->addAsColumn(
|
||||
'DEL_TASK_DUE_DATE',
|
||||
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
|
||||
AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
|
||||
);
|
||||
|
||||
global $RBAC;
|
||||
//seems the PM_SUPERVISOR can delete a completed case
|
||||
@@ -2351,7 +2385,12 @@ class Cases
|
||||
$c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE');
|
||||
$c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
|
||||
//$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
|
||||
$c->addAsColumn('APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)");
|
||||
$c->addAsColumn(
|
||||
'APP_DEL_PREVIOUS_USER',
|
||||
"CONCAT(APP_LAST_USER.USR_LASTNAME,
|
||||
' ',
|
||||
APP_LAST_USER.USR_FIRSTNAME)"
|
||||
);
|
||||
|
||||
$c->addAlias("APP_TITLE", 'CONTENT');
|
||||
$c->addAlias("PRO_TITLE", 'CONTENT');
|
||||
@@ -2397,7 +2436,8 @@ class Cases
|
||||
$c->add(TaskPeer::TAS_TYPE, 'SUBPROCESS', Criteria::NOT_EQUAL);
|
||||
|
||||
//gral, to_revise, to_reassign dont have userid in the query
|
||||
if ($sTypeList != 'gral' && $sTypeList != 'to_revise' && $sTypeList != 'to_reassign' && $sTypeList != 'my_started' && $sTypeList != 'sent') {
|
||||
if ($sTypeList != 'gral' && $sTypeList != 'to_revise' && $sTypeList != 'to_reassign' &&
|
||||
$sTypeList != 'my_started' && $sTypeList != 'sent') {
|
||||
$c->add(UsersPeer::USR_UID, $sUIDUserLogged);
|
||||
}
|
||||
|
||||
@@ -2505,11 +2545,17 @@ class Cases
|
||||
$c->addJoinMC($appDelayConds, Criteria::LEFT_JOIN);
|
||||
$c->add(AppDelayPeer::APP_DELAY_UID, null, Criteria::ISNOTNULL);
|
||||
$c->add(AppDelayPeer::APP_TYPE, array("REASSIGN", "ADHOC", "CANCEL"), Criteria::NOT_IN);
|
||||
$c->add($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)));
|
||||
$c->add(
|
||||
$c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->
|
||||
addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0))
|
||||
);
|
||||
$c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
break;
|
||||
case 'cancelled':
|
||||
$c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')->addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED')));
|
||||
$c->add(
|
||||
$c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')->
|
||||
addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED'))
|
||||
);
|
||||
$c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
break;
|
||||
case 'completed':
|
||||
@@ -2520,7 +2566,11 @@ class Cases
|
||||
$c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
break;
|
||||
case 'gral':
|
||||
$c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))));
|
||||
$c->add(
|
||||
$c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->
|
||||
addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->
|
||||
addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0)))
|
||||
);
|
||||
$c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
$params = array();
|
||||
$sSql = BasePeer::createSelectSql($c, $params);
|
||||
@@ -2563,7 +2613,12 @@ class Cases
|
||||
$c->addSelectColumn(ApplicationPeer::APP_INIT_USER);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
|
||||
|
||||
$c->addAsColumn('DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") ");
|
||||
$c->addAsColumn(
|
||||
'DEL_TASK_DUE_DATE',
|
||||
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),
|
||||
CONCAT('<span style=\'color:red\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE .
|
||||
", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
|
||||
);
|
||||
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
@@ -2610,7 +2665,10 @@ class Cases
|
||||
$c->add(AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN);
|
||||
break;
|
||||
case 'to_reassign':
|
||||
$c->add($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT')));
|
||||
$c->add(
|
||||
$c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')->
|
||||
addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT'))
|
||||
);
|
||||
$c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||
$c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
|
||||
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
|
||||
Reference in New Issue
Block a user