Merge pull request #888 from victorsl/BUG-9830
BUG 9924 "Participated list only display TO_DO cases" SOLVED
This commit is contained in:
@@ -1,28 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Applications
|
class Applications
|
||||||
{
|
{
|
||||||
|
public function getAll(
|
||||||
|
$userUid,
|
||||||
|
$start = null,
|
||||||
|
$limit = null,
|
||||||
|
$action = null,
|
||||||
|
$filter = null,
|
||||||
|
$search = null,
|
||||||
|
$process = null,
|
||||||
|
$status = null,
|
||||||
|
$type = null,
|
||||||
|
$dateFrom = null,
|
||||||
|
$dateTo = null,
|
||||||
|
$callback = null,
|
||||||
|
$dir = null,
|
||||||
|
$sort = "APP_CACHE_VIEW.APP_NUMBER",
|
||||||
|
$category = null
|
||||||
|
) {
|
||||||
|
$callback = isset($callback)? $callback : "stcCallback1001";
|
||||||
|
$dir = isset($dir)? $dir : "DESC";
|
||||||
|
$sort = isset($sort)? $sort : "";
|
||||||
|
$start = isset($start)? $start : "0";
|
||||||
|
$limit = isset($limit)? $limit : "25";
|
||||||
|
$filter = isset($filter)? $filter : "";
|
||||||
|
$search = isset($search)? $search : "";
|
||||||
|
$process = isset($process)? $process : "";
|
||||||
|
$category = isset($category)? $category : "";
|
||||||
|
$status = isset($status)? $status : "";
|
||||||
|
$action = isset($action)? $action : "todo";
|
||||||
|
$type = isset($type)? $type : "extjs";
|
||||||
|
$dateFrom = isset($dateFrom)? $dateFrom : "";
|
||||||
|
$dateTo = isset($dateTo)? $dateTo : "";
|
||||||
|
|
||||||
public function getAll ($userUid, $start = null, $limit = null, $action = null, $filter = null, $search = null, $process = null, $user = null, $status = null, $type = null, $dateFrom = null, $dateTo = null, $callback = null, $dir = null, $sort = 'APP_CACHE_VIEW.APP_NUMBER', $category = null)
|
G::LoadClass("BasePeer");
|
||||||
{
|
G::LoadClass("configuration");
|
||||||
$callback = isset( $callback ) ? $callback : 'stcCallback1001';
|
|
||||||
$dir = isset( $dir ) ? $dir : 'DESC';
|
|
||||||
$sort = isset( $sort ) ? $sort : '';
|
|
||||||
$start = isset( $start ) ? $start : '0';
|
|
||||||
$limit = isset( $limit ) ? $limit : '25';
|
|
||||||
$filter = isset( $filter ) ? $filter : '';
|
|
||||||
$search = isset( $search ) ? $search : '';
|
|
||||||
$process = isset( $process ) ? $process : '';
|
|
||||||
$category = isset( $category ) ? $category : '';
|
|
||||||
$user = isset( $user ) ? $user : '';
|
|
||||||
$status = isset( $status ) ? strtoupper( $status ) : '';
|
|
||||||
$action = isset( $action ) ? $action : 'todo';
|
|
||||||
$type = isset( $type ) ? $type : 'extjs';
|
|
||||||
$dateFrom = isset( $dateFrom ) ? $dateFrom : '';
|
|
||||||
$dateTo = isset( $dateTo ) ? $dateTo : '';
|
|
||||||
|
|
||||||
G::LoadClass( "BasePeer" );
|
|
||||||
G::LoadClass( 'configuration' );
|
|
||||||
require_once ("classes/model/AppCacheView.php");
|
require_once ("classes/model/AppCacheView.php");
|
||||||
require_once ("classes/model/AppDelegation.php");
|
require_once ("classes/model/AppDelegation.php");
|
||||||
require_once ("classes/model/AdditionalTables.php");
|
require_once ("classes/model/AdditionalTables.php");
|
||||||
@@ -31,72 +43,107 @@ class Applications
|
|||||||
require_once ("classes/model/Users.php");
|
require_once ("classes/model/Users.php");
|
||||||
require_once ("classes/model/Process.php");
|
require_once ("classes/model/Process.php");
|
||||||
|
|
||||||
//$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; <-- passed by param
|
|
||||||
$oAppCache = new AppCacheView();
|
$oAppCache = new AppCacheView();
|
||||||
|
|
||||||
//get data configuration
|
//get data configuration
|
||||||
$conf = new Configurations();
|
$conf = new Configurations();
|
||||||
$confCasesList = $conf->getConfiguration( 'casesList', ($action == 'search' || $action == 'simple_search') ? 'sent' : $action );
|
$confCasesList = $conf->getConfiguration( 'casesList', ($action == 'search' || $action == 'simple_search') ? 'sent' : $action );
|
||||||
// var_dump($confCasesList);
|
|
||||||
$oAppCache->confCasesList = $confCasesList;
|
$oAppCache->confCasesList = $confCasesList;
|
||||||
|
|
||||||
// get the action based list
|
// get the action based list
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'draft':
|
case "draft":
|
||||||
$Criteria = $oAppCache->getDraftListCriteria( $userUid );
|
$Criteria = $oAppCache->getDraftListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getDraftCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getDraftCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'sent':
|
case "sent":
|
||||||
$Criteria = $oAppCache->getSentListCriteria( $userUid );
|
$Criteria = $oAppCache->getSentListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getSentCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getSentCountCriteria($userUid);
|
||||||
// var_dump($Criteria);
|
|
||||||
|
if (!empty($status)) {
|
||||||
|
$Criteria->add(AppCacheViewPeer::APP_STATUS, $status);
|
||||||
|
$CriteriaCount->add(AppCacheViewPeer::APP_STATUS, $status);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'selfservice':
|
case "selfservice":
|
||||||
case 'unassigned':
|
case "unassigned":
|
||||||
$Criteria = $oAppCache->getUnassignedListCriteria( $userUid );
|
//$userUid can't be empty or null
|
||||||
$CriteriaCount = $oAppCache->getUnassignedCountCriteria( $userUid );
|
$Criteria = $oAppCache->getUnassignedListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getUnassignedCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'paused':
|
case "paused":
|
||||||
$Criteria = $oAppCache->getPausedListCriteria( $userUid );
|
$Criteria = $oAppCache->getPausedListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getPausedCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getPausedCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'completed':
|
case "completed":
|
||||||
$Criteria = $oAppCache->getCompletedListCriteria( $userUid );
|
$Criteria = $oAppCache->getCompletedListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getCompletedCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getCompletedCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'cancelled':
|
case "cancelled":
|
||||||
$Criteria = $oAppCache->getCancelledListCriteria( $userUid );
|
$Criteria = $oAppCache->getCancelledListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getCancelledCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getCancelledCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'search':
|
case "search":
|
||||||
$Criteria = $oAppCache->getSearchListCriteria();
|
//$Criteria = $oAppCache->getSearchListCriteria();
|
||||||
$CriteriaCount = $oAppCache->getSearchCountCriteria();
|
//$CriteriaCount = $oAppCache->getSearchCountCriteria();
|
||||||
|
|
||||||
|
switch ($status) {
|
||||||
|
case "TO_DO":
|
||||||
|
$Criteria = $oAppCache->getToDoListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getToDoCountCriteria($userUid);
|
||||||
|
break;
|
||||||
|
case "DRAFT":
|
||||||
|
$Criteria = $oAppCache->getDraftListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getDraftCountCriteria($userUid);
|
||||||
|
break;
|
||||||
|
case "PAUSED":
|
||||||
|
$Criteria = $oAppCache->getPausedListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getPausedCountCriteria($userUid);
|
||||||
|
break;
|
||||||
|
case "CANCELLED":
|
||||||
|
$Criteria = $oAppCache->getCancelledListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getCancelledCountCriteria($userUid);
|
||||||
|
break;
|
||||||
|
case "COMPLETED":
|
||||||
|
$Criteria = $oAppCache->getCompletedListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getCompletedCountCriteria($userUid);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//All status
|
||||||
|
$Criteria = $oAppCache->getAllCasesListCriteria2($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getAllCasesCountCriteria2($userUid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'simple_search':
|
case "simple_search":
|
||||||
$Criteria = $oAppCache->getSimpleSearchListCriteria();
|
$Criteria = $oAppCache->getSimpleSearchListCriteria();
|
||||||
$CriteriaCount = $oAppCache->getSimpleSearchCountCriteria();
|
$CriteriaCount = $oAppCache->getSimpleSearchCountCriteria();
|
||||||
break;
|
break;
|
||||||
case 'to_revise':
|
case "to_revise":
|
||||||
$Criteria = $oAppCache->getToReviseListCriteria( $userUid );
|
$Criteria = $oAppCache->getToReviseListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getToReviseCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getToReviseCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'to_reassign':
|
case "to_reassign":
|
||||||
$Criteria = $oAppCache->getToReassignListCriteria();
|
$Criteria = $oAppCache->getToReassignListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getToReassignCountCriteria();
|
$CriteriaCount = $oAppCache->getToReassignCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'all':
|
case "all":
|
||||||
$Criteria = $oAppCache->getAllCasesListCriteria( $userUid );
|
$Criteria = $oAppCache->getAllCasesListCriteria($userUid);
|
||||||
$CriteriaCount = $oAppCache->getAllCasesCountCriteria( $userUid );
|
$CriteriaCount = $oAppCache->getAllCasesCountCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
// general criteria probably will be deprecated
|
case "gral":
|
||||||
case 'gral':
|
//General criteria probably will be deprecated
|
||||||
$Criteria = $oAppCache->getGeneralListCriteria();
|
$Criteria = $oAppCache->getGeneralListCriteria();
|
||||||
$CriteriaCount = $oAppCache->getGeneralCountCriteria();
|
$CriteriaCount = $oAppCache->getGeneralCountCriteria();
|
||||||
break;
|
break;
|
||||||
case 'todo':
|
case "todo":
|
||||||
|
$Criteria = $oAppCache->getToDoListCriteria($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getToDoCountCriteria($userUid);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$Criteria = $oAppCache->getToDoListCriteria( $userUid );
|
//All status
|
||||||
$CriteriaCount = $oAppCache->getToDoCountCriteria( $userUid );
|
$Criteria = $oAppCache->getAllCasesListCriteria2($userUid);
|
||||||
|
$CriteriaCount = $oAppCache->getAllCasesCountCriteria2($userUid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +154,7 @@ class Applications
|
|||||||
$Criteria->addAsColumn( 'USR_USERNAME', 'CU.USR_USERNAME' );
|
$Criteria->addAsColumn( 'USR_USERNAME', 'CU.USR_USERNAME' );
|
||||||
|
|
||||||
// Fix for previous user
|
// Fix for previous user
|
||||||
if ($action == 'todo' || $action == 'selfservice' || $action == 'unassigned' || $action == 'paused' || $action == 'to_revise' || $action == 'sent') {
|
if (($action == "todo" || $action == "selfservice" || $action == "unassigned" || $action == "paused" || $action == "to_revise" || $action == "sent") || ($status == "TO_DO" || $status == "DRAFT" || $status == "PAUSED" || $status == "CANCELLED" || $status == "COMPLETED")) {
|
||||||
$Criteria->addAlias( 'PU', 'USERS' );
|
$Criteria->addAlias( 'PU', 'USERS' );
|
||||||
$Criteria->addJoin( AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN );
|
$Criteria->addJoin( AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN );
|
||||||
$Criteria->addAsColumn( 'PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME' );
|
$Criteria->addAsColumn( 'PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME' );
|
||||||
@@ -115,11 +162,13 @@ class Applications
|
|||||||
$Criteria->addAsColumn( 'PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME' );
|
$Criteria->addAsColumn( 'PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (! is_array( $confCasesList )) {
|
if (! is_array( $confCasesList )) {
|
||||||
$rows = $this->getDefaultFields( $action );
|
$rows = $this->getDefaultFields( $action );
|
||||||
$result = $this->genericJsonResponse( '', array (), $rows, 20, '' );
|
$result = $this->genericJsonResponse( '', array (), $rows, 20, '' );
|
||||||
//$conf->saveObject($result,'casesList',$action,'','','');
|
//$conf->saveObject($result,'casesList',$action,'','','');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// add the process filter
|
// add the process filter
|
||||||
if ($process != '') {
|
if ($process != '') {
|
||||||
@@ -136,15 +185,19 @@ class Applications
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the user filter
|
// add the user filter
|
||||||
|
/*
|
||||||
if ($user != '') {
|
if ($user != '') {
|
||||||
$Criteria->add( AppCacheViewPeer::USR_UID, $user, Criteria::EQUAL );
|
$Criteria->add( AppCacheViewPeer::USR_UID, $user, Criteria::EQUAL );
|
||||||
$CriteriaCount->add( AppCacheViewPeer::USR_UID, $user, Criteria::EQUAL );
|
$CriteriaCount->add( AppCacheViewPeer::USR_UID, $user, Criteria::EQUAL );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
if ($status != '') {
|
if ($status != '') {
|
||||||
$Criteria->add( AppCacheViewPeer::APP_STATUS, $status, Criteria::EQUAL );
|
$Criteria->add( AppCacheViewPeer::APP_STATUS, $status, Criteria::EQUAL );
|
||||||
$CriteriaCount->add( AppCacheViewPeer::APP_STATUS, $status, Criteria::EQUAL );
|
$CriteriaCount->add( AppCacheViewPeer::APP_STATUS, $status, Criteria::EQUAL );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($dateFrom != '') {
|
if ($dateFrom != '') {
|
||||||
if ($dateTo != '') {
|
if ($dateTo != '') {
|
||||||
@@ -183,7 +236,6 @@ class Applications
|
|||||||
|
|
||||||
//add the search filter
|
//add the search filter
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
|
|
||||||
$defaultFields = $oAppCache->getDefaultFields();
|
$defaultFields = $oAppCache->getDefaultFields();
|
||||||
$oTmpCriteria = '';
|
$oTmpCriteria = '';
|
||||||
// if there is PMTABLE for this case list:
|
// if there is PMTABLE for this case list:
|
||||||
@@ -222,13 +274,33 @@ class Applications
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
/*
|
||||||
|
if ($action == 'search') {
|
||||||
|
$oDatasetIndex = AppCacheViewPeer::doSelectRS( $Criteria );
|
||||||
|
$oDatasetIndex->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
$oDatasetIndex->next();
|
||||||
|
$maxDelIndexList = array ();
|
||||||
|
// a list of MAX_DEL_INDEXES is required in order to validate the right row
|
||||||
|
while ($aRow = $oDatasetIndex->getRow()) {
|
||||||
|
$maxDelIndexList[] = $aRow['MAX_DEL_INDEX'];
|
||||||
|
$oDatasetIndex->next();
|
||||||
|
}
|
||||||
|
// adding the validation condition in order to get the right row using the group by sentence
|
||||||
|
$Criteria->add( AppCacheViewPeer::DEL_INDEX, $maxDelIndexList, Criteria::IN );
|
||||||
|
//
|
||||||
|
//$params = array($maxDelIndexList);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//here we count how many records exists for this criteria.
|
//here we count how many records exists for this criteria.
|
||||||
//BUT there are some special cases, and if we dont optimize them the server will crash.
|
//BUT there are some special cases, and if we dont optimize them the server will crash.
|
||||||
$doCountAlreadyExecuted = false;
|
$doCountAlreadyExecuted = false;
|
||||||
//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;
|
||||||
@@ -237,11 +309,12 @@ class Applications
|
|||||||
$totalCount = $oAppCache->getSearchCountCriteria();
|
$totalCount = $oAppCache->getSearchCountCriteria();
|
||||||
$doCountAlreadyExecuted = true;
|
$doCountAlreadyExecuted = true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($doCountAlreadyExecuted == false) {
|
if ($doCountAlreadyExecuted == false) {
|
||||||
// in the case of reassign the distinct attribute shows a diferent count result comparing to the
|
// in the case of reassign the distinct attribute shows a diferent count result comparing to the
|
||||||
// original list
|
// original list
|
||||||
if ($action == 'to_reassign' || $action == 'todo') {
|
if (($action == "to_reassign" || $action == "todo") || ($status == "TO_DO")) {
|
||||||
$distinct = false;
|
$distinct = false;
|
||||||
} else {
|
} else {
|
||||||
$distinct = true;
|
$distinct = true;
|
||||||
@@ -279,26 +352,6 @@ class Applications
|
|||||||
$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
|
|
||||||
// fixing the bug related to the wrong data displayed in the list
|
|
||||||
if ($action == 'search') {
|
|
||||||
$oDatasetIndex = AppCacheViewPeer::doSelectRS( $Criteria );
|
|
||||||
$oDatasetIndex->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
|
||||||
$oDatasetIndex->next();
|
|
||||||
$maxDelIndexList = array ();
|
|
||||||
// a list of MAX_DEL_INDEXES is required in order to validate the right row
|
|
||||||
while ($aRow = $oDatasetIndex->getRow()) {
|
|
||||||
$maxDelIndexList[] = $aRow['MAX_DEL_INDEX'];
|
|
||||||
$oDatasetIndex->next();
|
|
||||||
}
|
|
||||||
// adding the validation condition in order to get the right row using the group by sentence
|
|
||||||
$Criteria->add( AppCacheViewPeer::DEL_INDEX, $maxDelIndexList, Criteria::IN );
|
|
||||||
//
|
|
||||||
$params = array ($maxDelIndexList
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//execute the query
|
//execute the query
|
||||||
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria );
|
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria );
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
$criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
$criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL);
|
$criteria->add(AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL);
|
||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||||
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
||||||
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||||
@@ -145,7 +149,10 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
}
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL);
|
$criteria->add(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL);
|
||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
//$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
//$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||||
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
||||||
@@ -175,27 +182,31 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the SENT cases list criteria
|
* Gets the criteria object of the sent cases
|
||||||
* param $userUid the current userUid
|
*
|
||||||
* param $doCount if true this will return the criteria for count cases only
|
* Return the criteria object of the sent cases
|
||||||
* @return Criteria object $Criteria
|
*
|
||||||
|
* @param string $userUid The user ID
|
||||||
|
* @param bool $doCount If true this will return the criteria for count cases only
|
||||||
|
* @return criteria Object criteria
|
||||||
*/
|
*/
|
||||||
public function getSent($userUid, $doCount)
|
public function getSent($userUid, $doCount)
|
||||||
{
|
{
|
||||||
//adding configuration fields from the configuration options
|
//Adding configuration fields from the configuration options
|
||||||
//and forming the criteria object
|
//and forming the criteria object
|
||||||
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
|
if ($doCount && !isset($this->confCasesList["PMTable"]) && !empty($this->confCasesList["PMTable"])) {
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria("workflow");
|
||||||
} else {
|
} else {
|
||||||
$criteria = $this->addPMFieldsToCriteria('sent');
|
$criteria = $this->addPMFieldsToCriteria("sent");
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL);
|
if (!empty($userUid)) {
|
||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
//$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
if (!$doCount) {
|
||||||
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
$criteria->addGroupByColumn(AppCacheViewPeer::APP_UID);
|
||||||
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
}
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -213,7 +224,9 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
|
||||||
return $criteria;*/
|
return $criteria;*/
|
||||||
return $this->getSentListCriteria($userUid);
|
//return $this->getSentListCriteria($userUid);
|
||||||
|
|
||||||
|
return $this->getSent($userUid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,6 +236,7 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
*/
|
*/
|
||||||
public function getSentListCriteria ($userUid)
|
public function getSentListCriteria ($userUid)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
$criteria = $this->addPMFieldsToCriteria('sent');
|
$criteria = $this->addPMFieldsToCriteria('sent');
|
||||||
|
|
||||||
//$criteria->addAsColumn('MAX_DEL_INDEX', 'MAX(' . AppDelegationPeer::DEL_INDEX . ')');
|
//$criteria->addAsColumn('MAX_DEL_INDEX', 'MAX(' . AppDelegationPeer::DEL_INDEX . ')');
|
||||||
@@ -234,6 +248,9 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $this->getSent($userUid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSentListProcessCriteria($userUid)
|
public function getSentListProcessCriteria($userUid)
|
||||||
@@ -421,35 +438,43 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
|
|
||||||
public function getProUidSupervisor($userUid)
|
public function getProUidSupervisor($userUid)
|
||||||
{
|
{
|
||||||
//finding cases PRO_UID where $userUid is supervising
|
//finding cases PRO_UID where $userUid is supervising
|
||||||
require_once ('classes/model/ProcessUser.php');
|
require_once ('classes/model/ProcessUser.php');
|
||||||
require_once ('classes/model/GroupUser.php');
|
require_once ('classes/model/GroupUser.php');
|
||||||
|
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
|
|
||||||
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
|
if (!empty($userUid)) {
|
||||||
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
|
$oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset->next();
|
|
||||||
$aProcesses = array();
|
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
|
||||||
$aProcesses[] = $aRow['PRO_UID'];
|
|
||||||
$oDataset->next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
|
||||||
$oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
|
|
||||||
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
|
|
||||||
$oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN);
|
|
||||||
$oCriteria->add(GroupUserPeer::USR_UID, $userUid);
|
|
||||||
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
|
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
|
$aProcesses = array();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
|
||||||
$aProcesses[] = $aRow['PRO_UID'];
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$oDataset->next();
|
$aProcesses[] = $aRow['PRO_UID'];
|
||||||
|
$oDataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
$oCriteria = new Criteria('workflow');
|
||||||
|
$oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
|
||||||
|
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
|
||||||
|
$oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$oCriteria->add(GroupUserPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
|
||||||
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$oDataset->next();
|
||||||
|
|
||||||
|
while ($aRow = $oDataset->getRow()) {
|
||||||
|
$aProcesses[] = $aRow['PRO_UID'];
|
||||||
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $aProcesses;
|
return $aProcesses;
|
||||||
@@ -475,15 +500,23 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
|
|
||||||
//add a validation to show the processes of which $userUid is supervisor
|
//add a validation to show the processes of which $userUid is supervisor
|
||||||
//$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
//$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
$criteria->add(
|
|
||||||
$criteria->getNewCriterion(AppCacheViewPeer::USR_UID, $userUid)->
|
if (!empty($userUid)) {
|
||||||
addOr($criteria->getNewCriterion(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN))
|
$criteria->add(
|
||||||
);
|
$criteria->getNewCriterion(AppCacheViewPeer::USR_UID, $userUid)->addOr(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (count($aProcesses) > 0) {
|
||||||
|
$criteria->add(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//join with APP_DELAY table using APP_UID and DEL_INDEX
|
//join with APP_DELAY table using APP_UID and DEL_INDEX
|
||||||
$appDelayConds[] = array(AppCacheViewPeer::APP_UID, AppDelayPeer::APP_UID);
|
$arrayCondition = array();
|
||||||
$appDelayConds[] = array(AppCacheViewPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);
|
$arrayCondition[] = array(AppCacheViewPeer::APP_UID, AppDelayPeer::APP_UID);
|
||||||
$criteria->addJoinMC($appDelayConds, Criteria::LEFT_JOIN);
|
$arrayCondition[] = array(AppCacheViewPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);
|
||||||
|
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
$criteria->add(
|
$criteria->add(
|
||||||
$criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->
|
$criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->
|
||||||
@@ -578,15 +611,14 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
}
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::APP_STATUS, "COMPLETED", CRITERIA::EQUAL);
|
$criteria->add(AppCacheViewPeer::APP_STATUS, "COMPLETED", CRITERIA::EQUAL);
|
||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
|
||||||
//$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
if (!empty($userUid)) {
|
||||||
$criteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
}
|
||||||
|
|
||||||
|
if (!$doCount) {
|
||||||
//$c->add(AppDelegationPeer::DEL_PREVIOUS, '0', Criteria::NOT_EQUAL);
|
$criteria->addGroupByColumn(AppCacheViewPeer::APP_UID);
|
||||||
$criteria->addGroupByColumn(AppCacheViewPeer::APP_UID);
|
}
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -628,7 +660,11 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
}
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::APP_STATUS, "CANCELLED", CRITERIA::EQUAL);
|
$criteria->add(AppCacheViewPeer::APP_STATUS, "CANCELLED", CRITERIA::EQUAL);
|
||||||
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'CLOSED');
|
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'CLOSED');
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
@@ -900,7 +936,10 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
public function getAllCasesCountCriteria($userUid)
|
public function getAllCasesCountCriteria($userUid)
|
||||||
{
|
{
|
||||||
$oCriteria = $this->getGeneralCases(true);
|
$oCriteria = $this->getGeneralCases(true);
|
||||||
$oCriteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$oCriteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
return $oCriteria;
|
return $oCriteria;
|
||||||
}
|
}
|
||||||
@@ -912,11 +951,122 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
public function getAllCasesListCriteria($userUid)
|
public function getAllCasesListCriteria($userUid)
|
||||||
{
|
{
|
||||||
$oCriteria = $this->getGeneralCases(false);
|
$oCriteria = $this->getGeneralCases(false);
|
||||||
$oCriteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$oCriteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
return $oCriteria;
|
return $oCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the SQL string for an case
|
||||||
|
*
|
||||||
|
* Return the SQL string for an case
|
||||||
|
*
|
||||||
|
* @param string $fieldAppUid The field APP_UID
|
||||||
|
* @param string $fieldDelIndex The field DEL_INDEX
|
||||||
|
* @return string SQL string
|
||||||
|
*/
|
||||||
|
public function getAppDelaySql($fieldAppUid, $fieldDelIndex)
|
||||||
|
{
|
||||||
|
$sql = "SELECT DISTINCT " . AppDelayPeer::APP_UID . "
|
||||||
|
FROM " . AppDelayPeer::TABLE_NAME . "
|
||||||
|
WHERE " . AppDelayPeer::APP_UID . " = $fieldAppUid AND
|
||||||
|
" . AppDelayPeer::APP_DEL_INDEX . " = $fieldDelIndex AND
|
||||||
|
(" . AppDelayPeer::APP_DISABLE_ACTION_USER . " IS NULL OR " . AppDelayPeer::APP_DISABLE_ACTION_USER . " = '0') AND
|
||||||
|
" . AppDelayPeer::APP_DELAY_UID . " IS NOT NULL AND
|
||||||
|
" . AppDelayPeer::APP_TYPE . " = 'PAUSE'";
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the criteria object of all cases
|
||||||
|
*
|
||||||
|
* Return the criteria object of all cases
|
||||||
|
*
|
||||||
|
* @param string $userUid The user ID
|
||||||
|
* @param bool $doCount If true this will return the criteria for count cases only
|
||||||
|
* @return criteria Object criteria
|
||||||
|
*/
|
||||||
|
public function getAllCases2($userUid, $doCount)
|
||||||
|
{
|
||||||
|
//Adding configuration fields from the configuration options
|
||||||
|
//and forming the criteria object
|
||||||
|
if ($doCount && !isset($this->confCasesList["PMTable"]) && !empty($this->confCasesList["PMTable"])) {
|
||||||
|
$criteria = new Criteria("workflow");
|
||||||
|
} else {
|
||||||
|
$criteria = $this->addPMFieldsToCriteria("all");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//paused
|
||||||
|
$sqlAppDelay = $this->getAppDelaySql(AppCacheViewPeer::APP_UID, AppCacheViewPeer::DEL_INDEX);
|
||||||
|
|
||||||
|
$criteria->add(
|
||||||
|
//todo - getToDo()
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL)->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL))->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||||
|
)->addOr(
|
||||||
|
//draft - getDraft()
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL)->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||||
|
)->addOr(
|
||||||
|
//paused
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "PAUSED")->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_UID, AppCacheViewPeer::APP_UID . " IN ($sqlAppDelay)", Criteria::CUSTOM))
|
||||||
|
)->addOr(
|
||||||
|
//cancelled - getCancelled()
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "CANCELLED", CRITERIA::EQUAL)->addAnd(
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "CLOSED"))
|
||||||
|
)->addOr(
|
||||||
|
//completed - getCompleted()
|
||||||
|
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "COMPLETED", CRITERIA::EQUAL)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$doCount) {
|
||||||
|
//completed - getCompleted()
|
||||||
|
$criteria->addGroupByColumn(AppCacheViewPeer::APP_UID);
|
||||||
|
|
||||||
|
//$criteria->addGroupByColumn(AppCacheViewPeer::USR_UID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the criteria object of all cases for the list
|
||||||
|
*
|
||||||
|
* Return the criteria object of all cases for the list
|
||||||
|
*
|
||||||
|
* @param string $userUid The user ID
|
||||||
|
* @return criteria Object criteria
|
||||||
|
*/
|
||||||
|
public function getAllCasesListCriteria2($userUid)
|
||||||
|
{
|
||||||
|
return $this->getAllCases2($userUid, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the criteria object of all cases for the count
|
||||||
|
*
|
||||||
|
* Return the criteria object of all cases for the count
|
||||||
|
*
|
||||||
|
* @param string $userUid The user ID
|
||||||
|
* @return criteria Object criteria
|
||||||
|
*/
|
||||||
|
public function getAllCasesCountCriteria2($userUid)
|
||||||
|
{
|
||||||
|
return $this->getAllCases2($userUid, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the ALL cases list criteria for count
|
* gets the ALL cases list criteria for count
|
||||||
* @return Criteria object $Criteria
|
* @return Criteria object $Criteria
|
||||||
@@ -935,7 +1085,7 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
return $this->getGeneralCases(false);
|
return $this->getGeneralCases(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToReassign($doCount)
|
public function getToReassign($userUid, $doCount)
|
||||||
{
|
{
|
||||||
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
|
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
@@ -944,6 +1094,11 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oCriteria->add(AppCacheViewPeer::APP_STATUS, 'TO_DO');
|
$oCriteria->add(AppCacheViewPeer::APP_STATUS, 'TO_DO');
|
||||||
|
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$oCriteria->add(AppCacheViewPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
|
||||||
$oCriteria->add(AppCacheViewPeer::APP_CURRENT_USER, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(AppCacheViewPeer::APP_CURRENT_USER, '', Criteria::NOT_EQUAL);
|
||||||
$oCriteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
$oCriteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||||
$oCriteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
$oCriteria->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
|
||||||
@@ -957,18 +1112,18 @@ class AppCacheView extends BaseAppCacheView
|
|||||||
* gets the ALL cases list criteria for count
|
* gets the ALL cases list criteria for count
|
||||||
* @return Criteria object $Criteria
|
* @return Criteria object $Criteria
|
||||||
*/
|
*/
|
||||||
public function getToReassignCountCriteria()
|
public function getToReassignCountCriteria($userUid)
|
||||||
{
|
{
|
||||||
return $this->getToReassign(true);
|
return $this->getToReassign($userUid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the ALL cases list criteria for list
|
* gets the ALL cases list criteria for list
|
||||||
* @return Criteria object $Criteria
|
* @return Criteria object $Criteria
|
||||||
*/
|
*/
|
||||||
public function getToReassignListCriteria()
|
public function getToReassignListCriteria($userUid)
|
||||||
{
|
{
|
||||||
return $this->getToReassign(false);
|
return $this->getToReassign($userUid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultFields()
|
public function getDefaultFields()
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ function getAllUsersArray ($action)
|
|||||||
|
|
||||||
if ($action == 'to_reassign') {
|
if ($action == 'to_reassign') {
|
||||||
//now get users, just for the Search action
|
//now get users, just for the Search action
|
||||||
$cUsers = $oAppCache->getToReassignListCriteria();
|
$cUsers = $oAppCache->getToReassignListCriteria(null);
|
||||||
$cUsers->addSelectColumn( AppCacheViewPeer::USR_UID );
|
$cUsers->addSelectColumn( AppCacheViewPeer::USR_UID );
|
||||||
|
|
||||||
if (g::MySQLSintaxis()) {
|
if (g::MySQLSintaxis()) {
|
||||||
@@ -237,7 +237,7 @@ function getStatusArray ($action, $userUid)
|
|||||||
// $cStatus = $oAppCache->getPausedListCriteria($userUid);
|
// $cStatus = $oAppCache->getPausedListCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'to_reassign':
|
case 'to_reassign':
|
||||||
$cStatus = $oAppCache->getToReassignListCriteria();
|
$cStatus = $oAppCache->getToReassignListCriteria($userUid);
|
||||||
break;
|
break;
|
||||||
case 'todo':
|
case 'todo':
|
||||||
case 'draft':
|
case 'draft':
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ if ($actionAjax == "processListExtJs") {
|
|||||||
$cProcess = $oAppCache->getToReviseListCriteria( $userUid );
|
$cProcess = $oAppCache->getToReviseListCriteria( $userUid );
|
||||||
break;
|
break;
|
||||||
case 'to_reassign':
|
case 'to_reassign':
|
||||||
$cProcess = $oAppCache->getToReassignListCriteria();
|
$cProcess = $oAppCache->getToReassignListCriteria($userUid);
|
||||||
$cProcess->addAscendingOrderByColumn( AppCacheViewPeer::APP_PRO_TITLE );
|
$cProcess->addAscendingOrderByColumn( AppCacheViewPeer::APP_PRO_TITLE );
|
||||||
break;
|
break;
|
||||||
case 'gral':
|
case 'gral':
|
||||||
|
|||||||
@@ -17,30 +17,82 @@ $dateFrom = isset( $_POST["dateFrom"] ) ? substr( $_POST["dateFrom"], 0, 10 ) :
|
|||||||
$dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : "";
|
$dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
|
||||||
$result = "";
|
$result = "";
|
||||||
$userUid = (isset( $_SESSION["USER_LOGGED"] ) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null;
|
|
||||||
$user = ($user == "CURRENT_USER") ? $userUid : $user;
|
|
||||||
|
|
||||||
if (($action == "todo" || $action == "draft" || $action == "sent" || $action == "selfservice" || $action == "unassigned" || $action == "search") && (($solrConf = System::solrEnv()) !== false)) {
|
if ((
|
||||||
G::LoadClass( "AppSolr" );
|
$action == "todo" || $action == "draft" || $action == "sent" || $action == "selfservice" ||
|
||||||
|
$action == "unassigned" || $action == "search"
|
||||||
|
) &&
|
||||||
|
(($solrConf = System::solrEnv()) !== false)
|
||||||
|
) {
|
||||||
|
G::LoadClass("AppSolr");
|
||||||
|
|
||||||
$ApplicationSolrIndex = new AppSolr( $solrConf["solr_enabled"], $solrConf["solr_host"], $solrConf["solr_instance"] );
|
$user = ($user == "CURRENT_USER")? $userUid : $user;
|
||||||
|
|
||||||
$data = $ApplicationSolrIndex->getAppGridData( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort );
|
$ApplicationSolrIndex = new AppSolr(
|
||||||
|
$solrConf["solr_enabled"],
|
||||||
|
$solrConf["solr_host"],
|
||||||
|
$solrConf["solr_instance"]
|
||||||
|
);
|
||||||
|
|
||||||
$result = G::json_encode( $data );
|
$data = $ApplicationSolrIndex->getAppGridData(
|
||||||
|
$userUid,
|
||||||
|
$start,
|
||||||
|
$limit,
|
||||||
|
$action,
|
||||||
|
$filter,
|
||||||
|
$search,
|
||||||
|
$process,
|
||||||
|
$user, //delete
|
||||||
|
$status,
|
||||||
|
$type,
|
||||||
|
$dateFrom,
|
||||||
|
$dateTo,
|
||||||
|
$callback,
|
||||||
|
$dir,
|
||||||
|
$sort
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = G::json_encode($data);
|
||||||
} else {
|
} else {
|
||||||
G::LoadClass( "applications" );
|
G::LoadClass("applications");
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case "search":
|
||||||
|
case "to_reassign":
|
||||||
|
$user = ($user == "CURRENT_USER")? $userUid : $user;
|
||||||
|
$userUid = $user;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$apps = new Applications();
|
$apps = new Applications();
|
||||||
$data = $apps->getAll( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort, $category );
|
$data = $apps->getAll(
|
||||||
|
$userUid,
|
||||||
|
$start,
|
||||||
|
$limit,
|
||||||
|
$action,
|
||||||
|
$filter,
|
||||||
|
$search,
|
||||||
|
$process,
|
||||||
|
$status,
|
||||||
|
$type,
|
||||||
|
$dateFrom,
|
||||||
|
$dateTo,
|
||||||
|
$callback,
|
||||||
|
$dir,
|
||||||
|
$sort,
|
||||||
|
$category
|
||||||
|
);
|
||||||
|
|
||||||
$result = G::json_encode( $data );
|
$result = G::json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $result;
|
echo $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$msg = array ("error" => $e->getMessage() );
|
$msg = array("error" => $e->getMessage());
|
||||||
echo G::json_encode( $msg );
|
echo G::json_encode($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ $oCases = new Cases();
|
|||||||
require_once ('classes/model/Task.php');
|
require_once ('classes/model/Task.php');
|
||||||
require_once ('classes/model/AppCacheView.php');
|
require_once ('classes/model/AppCacheView.php');
|
||||||
$oAppCacheView = new AppCacheView();
|
$oAppCacheView = new AppCacheView();
|
||||||
$oCasesReassignList = $oAppCacheView->getToReassignListCriteria();
|
$oCasesReassignList = $oAppCacheView->getToReassignListCriteria(null);
|
||||||
if (isset( $_POST['selected'] ) && $_POST['selected'] == 'true') {
|
if (isset( $_POST['selected'] ) && $_POST['selected'] == 'true') {
|
||||||
$oCasesReassignList->add( AppCacheViewPeer::APP_UID, $appSelectedUids, Criteria::IN );
|
$oCasesReassignList->add( AppCacheViewPeer::APP_UID, $appSelectedUids, Criteria::IN );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Services_Rest_Case
|
|||||||
$app = new Applications();
|
$app = new Applications();
|
||||||
$userUid = Services_Rest_Auth::$userId;
|
$userUid = Services_Rest_Auth::$userId;
|
||||||
|
|
||||||
return $app->getAll($userUid, $start, $limit, $type, $filter, $search, $process, $user, $status, $typeResource, $dateFrom, $dateTo);
|
return $app->getAll($userUid, $start, $limit, $type, $filter, $search, $process, $status, $typeResource, $dateFrom, $dateTo);
|
||||||
} else {
|
} else {
|
||||||
// get a specific record.
|
// get a specific record.
|
||||||
G::loadClass('wsBase');
|
G::loadClass('wsBase');
|
||||||
|
|||||||
Reference in New Issue
Block a user