CODE STYLE formating class.applications.php

This commit is contained in:
Fernando Ontiveros
2012-10-09 10:45:20 -04:00
parent 9987ad3a91
commit 0f08493967

View File

@@ -148,24 +148,8 @@ class Applications
if ($dateFrom != '') { if ($dateFrom != '') {
if ($dateTo != '') { if ($dateTo != '') {
$Criteria->add( $Criteria->add( $Criteria->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )->addAnd( $Criteria->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) );
$Criteria->getNewCriterion( $CriteriaCount->add( $CriteriaCount->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )->addAnd( $Criteria->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) );
AppCacheViewPeer::DEL_DELEGATE_DATE,
$dateFrom, Criteria::GREATER_EQUAL
)->addAnd($Criteria->getNewCriterion(
AppCacheViewPeer::DEL_DELEGATE_DATE,
$dateTo, Criteria::LESS_EQUAL
))
);
$CriteriaCount->add(
$CriteriaCount->getNewCriterion(
AppCacheViewPeer::DEL_DELEGATE_DATE,
$dateFrom, Criteria::GREATER_EQUAL
)->addAnd($Criteria->getNewCriterion(
AppCacheViewPeer::DEL_DELEGATE_DATE,
$dateTo, Criteria::LESS_EQUAL
))
);
} else { } else {
$Criteria->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL ); $Criteria->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL );
$CriteriaCount->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL ); $CriteriaCount->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL );
@@ -225,40 +209,16 @@ class Applications
// the criteria adds new fields if there are defined PM Table Fields in the cases list // the criteria adds new fields if there are defined PM Table Fields in the cases list
if ($oTmpCriteria != '') { if ($oTmpCriteria != '') {
$Criteria->add( $Criteria->add( $Criteria->getNewCriterion( AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE )->addOr( $oTmpCriteria ) ) ) );
$Criteria->getNewCriterion(
AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($Criteria->getNewCriterion(
AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($Criteria->getNewCriterion(
AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE
)->addOr($oTmpCriteria))
));
} else { } else {
$Criteria->add( $Criteria->add( $Criteria->getNewCriterion( AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE ) ) ) );
$Criteria->getNewCriterion(
AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($Criteria->getNewCriterion(
AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($Criteria->getNewCriterion(
AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE
))
));
} }
// the count query needs to be the normal criteria query if there are defined PM Table Fields in the cases list // the count query needs to be the normal criteria query if there are defined PM Table Fields in the cases list
if ($oTmpCriteria != '') { if ($oTmpCriteria != '') {
$CriteriaCount = $Criteria; $CriteriaCount = $Criteria;
} else { } else {
$CriteriaCount->add( $CriteriaCount->add( $CriteriaCount->getNewCriterion( AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $CriteriaCount->getNewCriterion( AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE )->addOr( $CriteriaCount->getNewCriterion( AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE ) ) ) );
$CriteriaCount->getNewCriterion(
AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($CriteriaCount->getNewCriterion(
AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE
)->addOr($CriteriaCount->getNewCriterion(
AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE
))
));
} }
} }
@@ -268,6 +228,7 @@ class Applications
//case 1. when the SEARCH action is selected and none filter, search criteria is defined, //case 1. when the SEARCH action is selected and none filter, search criteria is defined,
//we need to count using the table APPLICATION, because APP_CACHE_VIEW takes 3 seconds //we need to count using the table APPLICATION, because APP_CACHE_VIEW takes 3 seconds
if ($action == 'search' && $filter == '' && $search == '' && $process == '' && $status == '' && $dateFrom == '' && $dateTo == '' && $category == '') { if ($action == 'search' && $filter == '' && $search == '' && $process == '' && $status == '' && $dateFrom == '' && $dateTo == '' && $category == '') {
$totalCount = $oAppCache->getSearchAllCount(); $totalCount = $oAppCache->getSearchAllCount();
$doCountAlreadyExecuted = true; $doCountAlreadyExecuted = true;
@@ -307,18 +268,17 @@ class Applications
//add sortable options //add sortable options
if ($sort != '') { if ($sort != '') {
if ( $dir == 'DESC' ) if ($dir == 'DESC') {
$Criteria->addDescendingOrderByColumn( $sort ); $Criteria->addDescendingOrderByColumn( $sort );
else } else {
$Criteria->addAscendingOrderByColumn( $sort ); $Criteria->addAscendingOrderByColumn( $sort );
} }
}
//limit the results according the interface //limit the results according the interface
$Criteria->setLimit( $limit ); $Criteria->setLimit( $limit );
$Criteria->setOffset( $start ); $Criteria->setOffset( $start );
// this is the optimal way or query to render the cases search list // this is the optimal way or query to render the cases search list
// fixing the bug related to the wrong data displayed in the list // fixing the bug related to the wrong data displayed in the list
if ($action == 'search') { if ($action == 'search') {
@@ -334,7 +294,8 @@ class Applications
// adding the validation condition in order to get the right row using the group by sentence // adding the validation condition in order to get the right row using the group by sentence
$Criteria->add( AppCacheViewPeer::DEL_INDEX, $maxDelIndexList, Criteria::IN ); $Criteria->add( AppCacheViewPeer::DEL_INDEX, $maxDelIndexList, Criteria::IN );
// //
$params = array ( $maxDelIndexList ); $params = array ($maxDelIndexList
);
} }
@@ -346,15 +307,15 @@ class Applications
$result = array (); $result = array ();
$result['totalCount'] = $totalCount; $result['totalCount'] = $totalCount;
$rows = array (); $rows = array ();
$aPriorities = array('1'=>'VL', '2'=>'L', '3'=>'N', '4'=>'H', '5'=>'VH'); $aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH'
);
$index = $start; $index = $start;
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
//$aRow = $oAppCache->replaceRowUserData($aRow); //$aRow = $oAppCache->replaceRowUserData($aRow);
/* For participated cases, we want the last step in the case, not only
* the last step this user participated. To do that we get every case /*
* information again for the last step. (This could be solved by a subquery, * For participated cases, we want the last step in the case, not only the last step this user participated. To do that we get every case information again for the last step. (This could be solved by a subquery, but Propel might not support it and subqueries can be slower for larger
* but Propel might not support it and subqueries can be slower for larger
* datasets). * datasets).
*/ */
/*if ($action == 'sent' || $action == 'search') { /*if ($action == 'sent' || $action == 'search') {
@@ -376,8 +337,9 @@ class Applications
$maxDataset->close(); $maxDataset->close();
}*/ }*/
if (!isset($aRow['APP_CURRENT_USER'])) if (! isset( $aRow['APP_CURRENT_USER'] )) {
$aRow['APP_CURRENT_USER'] = "[Unassigned]"; $aRow['APP_CURRENT_USER'] = "[Unassigned]";
}
// replacing the status data with their respective translation // replacing the status data with their respective translation
if (isset( $aRow['APP_STATUS'] )) { if (isset( $aRow['APP_STATUS'] )) {
@@ -398,52 +360,83 @@ class Applications
return $result; return $result;
} }
//TODO: Encapsulates these and another default generation functions inside a class //TODO: Encapsulates these and another default generation functions inside a class
/** /**
* generate all the default fields * generate all the default fields
*
* @return Array $fields * @return Array $fields
*/ */
function setDefaultFields() { public function setDefaultFields ()
{
$fields = array (); $fields = array ();
$fields['APP_NUMBER'] = array( 'name' => 'APP_NUMBER' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_NUMBER') , 'width' => 40, 'align' => 'left'); $fields['APP_NUMBER'] = array ('name' => 'APP_NUMBER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_NUMBER' ),'width' => 40,'align' => 'left'
$fields['APP_UID'] = array( 'name' => 'APP_UID' , 'fieldType' => 'key', 'label' => G::loadTranslation('ID_CASESLIST_APP_UID'), 'width' => 80, 'align' => 'left'); );
$fields['DEL_INDEX'] = array( 'name' => 'DEL_INDEX' , 'fieldType' => 'key' , 'label' => G::loadTranslation('ID_CASESLIST_DEL_INDEX') , 'width' => 50, 'align' => 'left'); $fields['APP_UID'] = array ('name' => 'APP_UID','fieldType' => 'key','label' => G::loadTranslation( 'ID_CASESLIST_APP_UID' ),'width' => 80,'align' => 'left'
$fields['TAS_UID'] = array( 'name' => 'TAS_UID' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_TAS_UID') , 'width' => 80, 'align' => 'left'); );
$fields['USR_UID'] = array( 'name' => 'USR_UID' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_USR_UID') , 'width' => 80, 'align' => 'left', 'hidden' => true); $fields['DEL_INDEX'] = array ('name' => 'DEL_INDEX','fieldType' => 'key','label' => G::loadTranslation( 'ID_CASESLIST_DEL_INDEX' ),'width' => 50,'align' => 'left'
$fields['PREVIOUS_USR_UID'] = array( 'name' => 'PREVIOUS_USR_UID' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_PREVIOUS_USR_UID') , 'width' => 80, 'align' => 'left', 'hidden' => true); );
$fields['APP_TITLE'] = array( 'name' => 'APP_TITLE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_TITLE') , 'width' => 140, 'align' => 'left'); $fields['TAS_UID'] = array ('name' => 'TAS_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_TAS_UID' ),'width' => 80,'align' => 'left'
$fields['APP_PRO_TITLE'] = array( 'name' => 'APP_PRO_TITLE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_PRO_TITLE') , 'width' => 140, 'align' => 'left'); );
$fields['APP_TAS_TITLE'] = array( 'name' => 'APP_TAS_TITLE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_TAS_TITLE') , 'width' => 140, 'align' => 'left'); $fields['USR_UID'] = array ('name' => 'USR_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_USR_UID' ),'width' => 80,'align' => 'left','hidden' => true
$fields['APP_DEL_PREVIOUS_USER'] = array( 'name' => 'APP_DEL_PREVIOUS_USER' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DEL_PREVIOUS_USER') , 'width' => 120, 'align' => 'left'); );
$fields['APP_CURRENT_USER'] = array( 'name' => 'APP_CURRENT_USER' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER') ,'width' => 120, 'align' => 'left'); $fields['PREVIOUS_USR_UID'] = array ('name' => 'PREVIOUS_USR_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_PREVIOUS_USR_UID' ),'width' => 80,'align' => 'left','hidden' => true
$fields['USR_FIRSTNAME'] = array( 'name' => 'USR_FIRSTNAME' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER') , 'width' => 120, 'align' => 'left'); );
$fields['USR_LASTNAME'] = array( 'name' => 'USR_LASTNAME' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER') , 'width' => 120, 'align' => 'left'); $fields['APP_TITLE'] = array ('name' => 'APP_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TITLE' ),'width' => 140,'align' => 'left'
$fields['DEL_TASK_DUE_DATE'] = array( 'name' => 'DEL_TASK_DUE_DATE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_DEL_TASK_DUE_DATE') , 'width' => 100, 'align' => 'left'); );
$fields['APP_UPDATE_DATE'] = array( 'name' => 'APP_UPDATE_DATE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_UPDATE_DATE') , 'width' => 100, 'align' => 'left'); $fields['APP_PRO_TITLE'] = array ('name' => 'APP_PRO_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_PRO_TITLE' ),'width' => 140,'align' => 'left'
$fields['DEL_PRIORITY'] = array( 'name' => 'DEL_PRIORITY' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_DEL_PRIORITY') , 'width' => 80, 'align' => 'left'); );
$fields['APP_STATUS'] = array( 'name' => 'APP_STATUS' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_STATUS') , 'width' => 80, 'align' => 'left'); $fields['APP_TAS_TITLE'] = array ('name' => 'APP_TAS_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TAS_TITLE' ),'width' => 140,'align' => 'left'
$fields['APP_FINISH_DATE'] = array( 'name' => 'APP_FINISH_DATE' , 'fieldType' => 'case field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_FINISH_DATE') , 'width' => 100, 'align' => 'left'); );
$fields['APP_DELAY_UID'] = array( 'name' => 'APP_DELAY_UID' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DELAY_UID') , 'width' => 100, 'align' => 'left'); $fields['APP_DEL_PREVIOUS_USER'] = array ('name' => 'APP_DEL_PREVIOUS_USER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DEL_PREVIOUS_USER' ),'width' => 120,'align' => 'left'
$fields['APP_THREAD_INDEX'] = array( 'name' => 'APP_THREAD_INDEX' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_THREAD_INDEX') , 'width' => 100, 'align' => 'left'); );
$fields['APP_DEL_INDEX'] = array( 'name' => 'APP_DEL_INDEX' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DEL_INDEX') , 'width' => 100, 'align' => 'left'); $fields['APP_CURRENT_USER'] = array ('name' => 'APP_CURRENT_USER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
$fields['APP_TYPE'] = array( 'name' => 'APP_TYPE' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_TYPE') , 'width' => 100, 'align' => 'left'); );
$fields['APP_DELEGATION_USER'] = array( 'name' => 'APP_DELEGATION_USER' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DELEGATION_USER') , 'width' => 100, 'align' => 'left'); $fields['USR_FIRSTNAME'] = array ('name' => 'USR_FIRSTNAME','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
$fields['APP_ENABLE_ACTION_USER'] = array( 'name' => 'APP_ENABLE_ACTION_USER' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_ENABLE_ACTION_USER') , 'width' => 100, 'align' => 'left'); );
$fields['APP_ENABLE_ACTION_DATE'] = array( 'name' => 'APP_ENABLE_ACTION_DATE' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_AAPP_ENABLE_ACTION_DATE') , 'width' => 100, 'align' => 'left'); $fields['USR_LASTNAME'] = array ('name' => 'USR_LASTNAME','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
$fields['APP_DISABLE_ACTION_USER'] = array( 'name' => 'APP_DISABLE_ACTION_USER', 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DISABLE_ACTION_USER') , 'width' => 100, 'align' => 'left'); );
$fields['APP_DISABLE_ACTION_DATE'] = array( 'name' => 'APP_DISABLE_ACTION_DATE', 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_DISABLE_ACTION_DATE') , 'width' => 100, 'align' => 'left'); $fields['DEL_TASK_DUE_DATE'] = array ('name' => 'DEL_TASK_DUE_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_DEL_TASK_DUE_DATE' ),'width' => 100,'align' => 'left'
$fields['APP_AUTOMATIC_DISABLED_DATE'] = array( 'name' => 'APP_AUTOMATIC_DISABLED_DATE' , 'fieldType' => 'delay field' , 'label' => G::loadTranslation('ID_CASESLIST_APP_AUTOMATIC_DISABLED_DATE') , 'width' => 100, 'align' => 'left'); );
$fields['APP_UPDATE_DATE'] = array ('name' => 'APP_UPDATE_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_UPDATE_DATE' ),'width' => 100,'align' => 'left'
);
$fields['DEL_PRIORITY'] = array ('name' => 'DEL_PRIORITY','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_DEL_PRIORITY' ),'width' => 80,'align' => 'left'
);
$fields['APP_STATUS'] = array ('name' => 'APP_STATUS','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_STATUS' ),'width' => 80,'align' => 'left'
);
$fields['APP_FINISH_DATE'] = array ('name' => 'APP_FINISH_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_FINISH_DATE' ),'width' => 100,'align' => 'left'
);
$fields['APP_DELAY_UID'] = array ('name' => 'APP_DELAY_UID','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DELAY_UID' ),'width' => 100,'align' => 'left'
);
$fields['APP_THREAD_INDEX'] = array ('name' => 'APP_THREAD_INDEX','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_THREAD_INDEX' ),'width' => 100,'align' => 'left'
);
$fields['APP_DEL_INDEX'] = array ('name' => 'APP_DEL_INDEX','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DEL_INDEX' ),'width' => 100,'align' => 'left'
);
$fields['APP_TYPE'] = array ('name' => 'APP_TYPE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TYPE' ),'width' => 100,'align' => 'left'
);
$fields['APP_DELEGATION_USER'] = array ('name' => 'APP_DELEGATION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DELEGATION_USER' ),'width' => 100,'align' => 'left'
);
$fields['APP_ENABLE_ACTION_USER'] = array ('name' => 'APP_ENABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_ENABLE_ACTION_USER' ),'width' => 100,'align' => 'left'
);
$fields['APP_ENABLE_ACTION_DATE'] = array ('name' => 'APP_ENABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_AAPP_ENABLE_ACTION_DATE' ),'width' => 100,'align' => 'left'
);
$fields['APP_DISABLE_ACTION_USER'] = array ('name' => 'APP_DISABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DISABLE_ACTION_USER' ),'width' => 100,'align' => 'left'
);
$fields['APP_DISABLE_ACTION_DATE'] = array ('name' => 'APP_DISABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DISABLE_ACTION_DATE' ),'width' => 100,'align' => 'left'
);
$fields['APP_AUTOMATIC_DISABLED_DATE'] = array ('name' => 'APP_AUTOMATIC_DISABLED_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_AUTOMATIC_DISABLED_DATE' ),'width' => 100,'align' => 'left'
);
return $fields; return $fields;
} }
/** /**
* this function return the default fields for a default case list * this function return the default fields for a default case list
*
* @param $action * @param $action
* @return an array with the default fields for an specific case list (action) * @return an array with the default fields for an specific case list (action)
*/ */
function getDefaultFields ( $action ) { public function getDefaultFields ($action)
{
$rows = array (); $rows = array ();
switch ($action) { switch ($action) {
case 'todo': // #, Case, task, process, sent by, due date, Last Modify, Priority case 'todo': // #, Case, task, process, sent by, due date, Last Modify, Priority
@@ -461,7 +454,6 @@ class Applications
$rows[] = $fields['APP_UPDATE_DATE']; $rows[] = $fields['APP_UPDATE_DATE'];
$rows[] = $fields['DEL_PRIORITY']; $rows[] = $fields['DEL_PRIORITY'];
break; break;
case 'draft': //#, Case, task, process, due date, Last Modify, Priority }, case 'draft': //#, Case, task, process, due date, Last Modify, Priority },
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_UID']; $rows[] = $fields['APP_UID'];
@@ -536,7 +528,6 @@ class Applications
$rows[] = $fields['USR_UID']; $rows[] = $fields['USR_UID'];
$rows[] = $fields['PREVIOUS_USR_UID']; $rows[] = $fields['PREVIOUS_USR_UID'];
break; break;
case 'cancelled': //#, Case, task, process, due date, Last Modify case 'cancelled': //#, Case, task, process, due date, Last Modify
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_UID']; $rows[] = $fields['APP_UID'];
@@ -552,7 +543,6 @@ class Applications
$rows[] = $fields['USR_UID']; $rows[] = $fields['USR_UID'];
$rows[] = $fields['PREVIOUS_USR_UID']; $rows[] = $fields['PREVIOUS_USR_UID'];
break; break;
case 'to_revise': //#, Case, task, process, due date, Last Modify case 'to_revise': //#, Case, task, process, due date, Last Modify
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_UID']; $rows[] = $fields['APP_UID'];
@@ -568,7 +558,6 @@ class Applications
$rows[] = $fields['DEL_PRIORITY']; $rows[] = $fields['DEL_PRIORITY'];
$rows[] = $fields['APP_STATUS']; $rows[] = $fields['APP_STATUS'];
break; break;
case 'to_reassign': //#, Case, task, process, due date, Last Modify case 'to_reassign': //#, Case, task, process, due date, Last Modify
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_NUMBER']; $rows[] = $fields['APP_NUMBER'];
@@ -583,10 +572,7 @@ class Applications
$rows[] = $fields['APP_CURRENT_USER']; $rows[] = $fields['APP_CURRENT_USER'];
$rows[] = $fields['APP_UPDATE_DATE']; $rows[] = $fields['APP_UPDATE_DATE'];
$rows[] = $fields['APP_STATUS']; $rows[] = $fields['APP_STATUS'];
break; break;
case 'all': //#, Case, task, process, due date, Last Modify case 'all': //#, Case, task, process, due date, Last Modify
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_UID']; $rows[] = $fields['APP_UID'];
@@ -602,7 +588,6 @@ class Applications
$rows[] = $fields['APP_UPDATE_DATE']; $rows[] = $fields['APP_UPDATE_DATE'];
$rows[] = $fields['APP_STATUS']; $rows[] = $fields['APP_STATUS'];
break; break;
case 'gral': //#, Case, task, process, due date, Last Modify case 'gral': //#, Case, task, process, due date, Last Modify
$fields = $this->setDefaultFields(); $fields = $this->setDefaultFields();
$rows[] = $fields['APP_UID']; $rows[] = $fields['APP_UID'];
@@ -624,12 +609,14 @@ class Applications
/** /**
* set the generic Json Response, using two array for the grid stores and a string for the pmtable name * set the generic Json Response, using two array for the grid stores and a string for the pmtable name
*
* @param string $pmtable * @param string $pmtable
* @param array $first * @param array $first
* @param array $second * @param array $second
* @return $response a json string * @return $response a json string
*/ */
function genericJsonResponse($pmtable, $first, $second, $rowsperpage, $dateFormat ) { public function genericJsonResponse ($pmtable, $first, $second, $rowsperpage, $dateFormat)
{
$firstGrid['totalCount'] = count( $first ); $firstGrid['totalCount'] = count( $first );
$firstGrid['data'] = $first; $firstGrid['data'] = $first;
$secondGrid['totalCount'] = count( $second ); $secondGrid['totalCount'] = count( $second );
@@ -656,9 +643,9 @@ class Applications
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$steps = Array (); $steps = Array ();
$case = new Cases; $case = new Cases();
$step = new Step; $step = new Step();
$appDocument = new AppDocument; $appDocument = new AppDocument();
$caseSteps = $step->getAllCaseSteps( $proUid, $tasUid, $appUid ); $caseSteps = $step->getAllCaseSteps( $proUid, $tasUid, $appUid );
@@ -681,11 +668,11 @@ class Applications
$externalStepCount = 0; $externalStepCount = 0;
foreach ($caseSteps as $caseStep) { foreach ($caseSteps as $caseStep) {
// if it has a condition
if (trim($caseStep->getStepCondition()) != '') { // if it has a condition if (trim( $caseStep->getStepCondition() ) != '') {
$pmScript->setScript( $caseStep->getStepCondition() ); $pmScript->setScript( $caseStep->getStepCondition() );
if (!$pmScript->evaluate()) { //evaluate if (! $pmScript->evaluate()) {
//evaluated false, jump & continue with the others steps //evaluated false, jump & continue with the others steps
continue; continue;
} }
@@ -706,32 +693,25 @@ class Applications
$stepItem['title'] = $oDocument->getDynTitle(); $stepItem['title'] = $oDocument->getDynTitle();
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=EDIT"; $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=EDIT";
break; break;
case 'OUTPUT_DOCUMENT': case 'OUTPUT_DOCUMENT':
$oDocument = OutputDocumentPeer::retrieveByPK( $caseStep->getStepUidObj() ); $oDocument = OutputDocumentPeer::retrieveByPK( $caseStep->getStepUidObj() );
$outputDoc = $appDocument->getObject( $appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT' ); $outputDoc = $appDocument->getObject( $appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT' );
$stepItem['title'] = $oDocument->getOutDocTitle(); $stepItem['title'] = $oDocument->getOutDocTitle();
if ($outputDoc['APP_DOC_UID']) { if ($outputDoc['APP_DOC_UID']) {
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=VIEW&DOC={$outputDoc['APP_DOC_UID']}"; $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=VIEW&DOC={$outputDoc['APP_DOC_UID']}";
} } else {
else {
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=GENERATE"; $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=GENERATE";
} }
break; break;
case 'INPUT_DOCUMENT': case 'INPUT_DOCUMENT':
$oDocument = InputDocumentPeer::retrieveByPK( $stepUid ); $oDocument = InputDocumentPeer::retrieveByPK( $stepUid );
$stepItem['title'] = $oDocument->getInpDocTitle(); $stepItem['title'] = $oDocument->getInpDocTitle();
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=ATTACH"; $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=ATTACH";
break; break;
case 'EXTERNAL': case 'EXTERNAL':
$stepTitle = 'unknown ' . $caseStep->getStepUidObj(); $stepTitle = 'unknown ' . $caseStep->getStepUidObj();
$oPluginRegistry = PMPluginRegistry::getSingleton(); $oPluginRegistry = PMPluginRegistry::getSingleton();
$externalStep = $externalSteps[$caseStep->getStepUidObj()]; $externalStep = $externalSteps[$caseStep->getStepUidObj()];
$stepItem['id'] = $externalStep->sStepId; $stepItem['id'] = $externalStep->sStepId;
$stepItem['title'] = $externalStep->sStepTitle; $stepItem['title'] = $externalStep->sStepTitle;
@@ -754,3 +734,4 @@ class Applications
return $steps; return $steps;
} }
} }