BUG 7197 New feature request: "Categories" column/filter... SOLVED

- According to the specifications.
- Was added the filter "Categories" only when Solar is disabled.
This commit is contained in:
Marco Antonio Nina
2012-09-17 10:30:12 -04:00
parent 29cf78ee8b
commit 0c71029c54
5 changed files with 208 additions and 15 deletions

View File

@@ -3,7 +3,7 @@
class Applications
{
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')
public function getAll($userUid, $start=null, $limit=null, $action=null, $filter=null, $search=null, $process=null, $category=null, $user=null, $status=null, $type=null, $dateFrom=null, $dateTo=null, $callback=null, $dir=null, $sort='APP_CACHE_VIEW.APP_NUMBER')
{
$callback = isset($callback) ? $callback : 'stcCallback1001';
$dir = isset($dir) ? $dir : 'DESC';
@@ -13,6 +13,7 @@ class Applications
$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';
@@ -28,6 +29,7 @@ class Applications
require_once ( "classes/model/AppDelay.php" );
require_once ( "classes/model/Fields.php" );
require_once ( "classes/model/Users.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();
@@ -125,6 +127,14 @@ class Applications
$CriteriaCount->add (AppCacheViewPeer::PRO_UID, $process, Criteria::EQUAL );
}
// add the category filter
if ($category != '') {
$Criteria->addAlias('CP', 'PROCESS');
$Criteria->add ('CP.PRO_CATEGORY', $category, Criteria::EQUAL );
$Criteria->addJoin(AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN);
$Criteria->addAsColumn('CATEGORY_UID', 'CP.PRO_CATEGORY');
}
// add the user filter
if ( $user != '' ) {
$Criteria->add (AppCacheViewPeer::USR_UID, $user, Criteria::EQUAL );
@@ -258,10 +268,14 @@ class Applications
//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
if ( $action == 'search' && $filter == '' && $search == '' && $process == '' && $status == '' && $dateFrom == '' && $dateTo == '') {
if ( $action == 'search' && $filter == '' && $search == '' && $process == '' && $category == '' && $status == '' && $dateFrom == '' && $dateTo == '') {
$totalCount = $oAppCache->getSearchAllCount();
$doCountAlreadyExecuted = true;
}
if ( $category != '' ) {
$totalCount = $oAppCache->getSearchCountCriteria();
$doCountAlreadyExecuted = true;
}
if ( $doCountAlreadyExecuted == false ) {
// in the case of reassign the distinct attribute shows a diferent count result comparing to the
@@ -289,7 +303,6 @@ class Applications
}
}
$totalCount = AppCacheViewPeer::doCount( $CriteriaCount, $distinct );
}
//add sortable options
@@ -312,6 +325,7 @@ class Applications
$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'];

View File

@@ -81,6 +81,7 @@
//get values for the comboBoxes
$processes = getProcessArray($action, $userUid );
$status = getStatusArray($action, $userUid );
$category = getCategoryArray();
$users = getUserArray($action, $userUid );
$allUsers = getAllUsersArray($action);
@@ -94,6 +95,8 @@
$oHeadPublisher->assign( 'PMDateFormat', $dateFormat ); //sending the fields to get from proxy
$oHeadPublisher->assign( 'statusValues', $status ); //sending the columns to display in grid
$oHeadPublisher->assign( 'processValues', $processes); //sending the columns to display in grid
$oHeadPublisher->assign( 'solrConf', System::solrEnv()); //sending the columns to display in grid
$oHeadPublisher->assign( 'categoryValues', $category); //sending the columns to display in grid
$oHeadPublisher->assign( 'userValues', $users); //sending the columns to display in grid
$oHeadPublisher->assign( 'allUsersValues',$allUsers); //sending the columns to display in grid
@@ -241,6 +244,25 @@
return $users;
}
function getCategoryArray () {
global $oAppCache;
require_once 'classes/model/ProcessCategory.php';
$category[] = array("", G::LoadTranslation("ID_ALL_CATEGORIES"));
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
$criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$dataset = ProcessCategoryPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$category[] = array( $row['CATEGORY_UID'], $row['CATEGORY_NAME']);
$dataset->next();
}
return $category;
}
function getAllUsersArray ( $action ) {
global $oAppCache;
$status = array();

View File

@@ -28,20 +28,118 @@
require_once 'classes/model/AppDelay.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
require_once ( "classes/model/AppCacheView.php" );
require_once ( "classes/model/AppDelegation.php" );
require_once ( "classes/model/AdditionalTables.php" );
require_once ( "classes/model/AppDelay.php" );
G::LoadClass('case');
$actionAjax = isset($_REQUEST['actionAjax'])?$_REQUEST['actionAjax']: null;
if ($actionAjax == "processListExtJs") {
$action = isset($_REQUEST['action']) ? $_REQUEST['action']: null;
$categoryUid = isset($_REQUEST['CATEGORY_UID']) ? $_REQUEST['CATEGORY_UID'] : null;
$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null;
if($actionAjax=="getUsersToReassign"){
global $oAppCache;
$oAppCache = new AppCacheView();
$processes = Array();
$processes[] = array ( '', G::LoadTranslation('ID_ALL_PROCESS') );
//get the list based in the action provided
switch ( $action ) {
case 'draft' :
$cProcess = $oAppCache->getDraftListCriteria($userUid); //fast enough
break;
case 'sent' :
$cProcess = $oAppCache->getSentListProcessCriteria ($userUid); // fast enough
break;
case 'simple_search':
case 'search' :
//in search action, the query to obtain all process is too slow, so we need to query directly to
//process and content tables, and for that reason we need the current language in AppCacheView.
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE','','','','');
$appCacheViewEngine = $oConf->aConfig;
$lang = isset($appCacheViewEngine['LANG']) ? $appCacheViewEngine['LANG'] : 'en';
$cProcess = new Criteria('workflow');
$cProcess->clearSelectColumns ( );
$cProcess->addSelectColumn ( ProcessPeer::PRO_UID );
$cProcess->addSelectColumn ( ContentPeer::CON_VALUE );
if ($categoryUid) {
$cProcess->add ( ProcessPeer::PRO_CATEGORY, $categoryUid );
}
$del = DBAdapter::getStringDelimiter();
$conds = array();
$conds[] = array(ProcessPeer::PRO_UID, ContentPeer::CON_ID );
$conds[] = array(ContentPeer::CON_CATEGORY, $del . 'PRO_TITLE' . $del);
$conds[] = array(ContentPeer::CON_LANG, $del . $lang . $del);
$cProcess->addJoinMC($conds, Criteria::LEFT_JOIN);
$cProcess->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
$oDataset = ProcessPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while($aRow = $oDataset->getRow()){
$processes[] = array ( $aRow['PRO_UID'], $aRow['CON_VALUE'] );
$oDataset->next();
}
return print G::json_encode($processes);
break;
case 'unassigned' :
$cProcess = $oAppCache->getUnassignedListCriteria($userUid);
break;
case 'paused' :
$cProcess = $oAppCache->getPausedListCriteria($userUid);
break;
case 'to_revise' :
$cProcess = $oAppCache->getToReviseListCriteria($userUid);
break;
case 'to_reassign' :
$cProcess = $oAppCache->getToReassignListCriteria();
$cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
break;
case 'gral' :
$cProcess = $oAppCache->getGeneralListCriteria();
$cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
break;
case 'todo' :
default:
$cProcess = $oAppCache->getToDoListCriteria($userUid); //fast enough
break;
}
//get the processes for this user in this action
$cProcess->clearSelectColumns();
$cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
$cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
$cProcess->setDistinct(AppCacheViewPeer::PRO_UID);
if ($categoryUid) {
$cProcess->addAlias('CP', 'PROCESS');
$cProcess->add ('CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL );
$cProcess->addJoin(AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN);
$cProcess->addAsColumn('CATEGORY_UID', 'CP.PRO_CATEGORY');
}
$oDataset = AppCacheViewPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while($aRow = $oDataset->getRow()){
$processes[] = array ( $aRow['PRO_UID'], $aRow['APP_PRO_TITLE'] );
$oDataset->next();
}
return print G::json_encode($processes);
}
if ($actionAjax=="getUsersToReassign") {
$_SESSION['TASK'] = $_REQUEST['TAS_UID'];
$case = new Cases();
$result->data = $case->getUsersToReassign($_SESSION['TASK'], $_SESSION['USER_LOGGED']);
print G::json_encode($result);
}
if($actionAjax=='reassignCase'){
if ($actionAjax=='reassignCase') {
$APP_UID = $_REQUEST["APP_UID"];
$DEL_INDEX = $_REQUEST["DEL_INDEX"];

View File

@@ -7,6 +7,7 @@ $start = isset($_POST["start"])? $_POST["start"] : "0";
$limit = isset($_POST["limit"])? $_POST["limit"] : "25";
$filter = isset($_POST ["filter"])? $_POST["filter"] : "";
$process = isset($_POST["process"])? $_POST["process"] : "";
$category = isset($_POST["category"])? $_POST["category"] : "";
$status = isset($_POST["status"])? strtoupper($_POST["status"]) : "";
$user = isset($_POST["user"])? $_POST["user"] : "";
$search = isset($_POST["search"])? $_POST["search"] : "";
@@ -67,6 +68,7 @@ try {
$filter,
$search,
$process,
$category,
$user,
$status,
$type,

View File

@@ -394,6 +394,7 @@ Ext.onReady ( function() {
var ids = '';
var filterProcess = '';
var filterCategory = '';
var filterUser = '';
var caseIdToDelete = '';
var caseIdToUnpause = '';
@@ -868,6 +869,51 @@ Ext.onReady ( function() {
iconCls: 'no-icon' //use iconCls if placing within menu to shift to right side of menu
});
var comboCategory = new Ext.form.ComboBox({
width : 200,
boxMaxWidth : 200,
editable : true,
displayField : 'CATEGORY_NAME',
valueField : 'CATEGORY_UID',
forceSelection : false,
emptyText : _('ID_PROCESS_NO_CATEGORY'),
selectOnFocus : true,
typeAhead : true,
mode : 'local',
autocomplete : true,
triggerAction : 'all',
store : new Ext.data.ArrayStore({
fields : ['CATEGORY_UID','CATEGORY_NAME'],
data : categoryValues
}),
listeners:{
scope: this,
'select': function() {
filterCategory = comboCategory.value;
storeCases.setBaseParam('category', filterCategory);
storeCases.load({params:{category: filterCategory, start : 0 , limit : pageSize}});
Ext.Ajax.request({
url : 'casesList_Ajax' ,
params : {actionAjax : 'processListExtJs',
action: action,
CATEGORY_UID: filterCategory},
success: function ( result, request ) {
var data = Ext.util.JSON.decode(result.responseText);
comboProcess.getStore().removeAll();
comboProcess.getStore().loadData( data );
comboProcess.setValue('');
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});
}},
iconCls: 'no-icon'
});
var btnSelectAll = new Ext.Button ({
text: _('CHECK_ALL'),
// text: 'Check All',
@@ -1393,6 +1439,8 @@ Ext.onReady ( function() {
value: ''
});
var optionCategory = (solrConf != true) ? [ _('ID_CATEGORY'), comboCategory, '-'] : [''] ;
var toolbarTodo = [
optionMenuOpen,
{
@@ -1408,6 +1456,7 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1429,6 +1478,7 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1450,6 +1500,7 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1473,6 +1524,7 @@ Ext.onReady ( function() {
menu: menuItems
},
'->',
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1489,6 +1541,7 @@ Ext.onReady ( function() {
var toolbarToRevise = [
optionMenuOpen,
'->', // begin using the right-justified button container
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1513,6 +1566,7 @@ Ext.onReady ( function() {
_("ID_USER"),
comboAllUsers,
"-",
optionCategory,
_("ID_PROCESS"),
comboProcess,
textSearch,
@@ -1530,6 +1584,7 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1546,6 +1601,8 @@ Ext.onReady ( function() {
' '
];
var toolbarSearch = [
' ',
_('ID_DELEGATE_DATE_FROM'),
@@ -1560,8 +1617,7 @@ Ext.onReady ( function() {
storeCases.setBaseParam('dateTo', dateTo.getValue());
storeCases.load({params:{ start : 0 , limit : pageSize }});
}
}),
'-'
})
];
var firstToolbarSearch = new Ext.Toolbar({
@@ -1571,6 +1627,7 @@ Ext.onReady ( function() {
items: [
optionMenuOpen,
'->',
optionCategory,
_('ID_PROCESS'),
comboProcess,
'-',