Performance improvement, deleted the grid with the cases counter on the cases start page

This commit is contained in:
Julio Cesar Laura
2012-09-24 13:06:05 -04:00
parent 88a2643a35
commit 648c7f095d
3 changed files with 36 additions and 75 deletions

View File

@@ -574,7 +574,7 @@ class Process extends BaseProcess {
return 0;
}
function getAllProcesses($start, $limit, $category=NULL, $processName=NULL) {
function getAllProcesses($start, $limit, $category=NULL, $processName=NULL, $counters = true) {
require_once PATH_RBAC . "model/RbacUsers.php";
require_once "classes/model/ProcessCategory.php";
require_once "classes/model/Users.php";
@@ -617,7 +617,9 @@ class Process extends BaseProcess {
$oCriteria->setLimit($limit);
//execute a query to obtain numbers, how many cases there are by process
$casesCnt = $this->getCasesCountInAllProcesses();
if ($counters) {
$casesCnt = $this->getCasesCountInAllProcesses();
}
//execute the query
$oDataset = ProcessPeer::doSelectRS ( $oCriteria );
@@ -667,10 +669,12 @@ class Process extends BaseProcess {
continue;
}
$casesCountTotal = 0;
if( isset($casesCnt[$process['PRO_UID']]) ) {
foreach($casesCnt[$process['PRO_UID']] as $item) {
$casesCountTotal += $item;
if ($counters) {
$casesCountTotal = 0;
if( isset($casesCnt[$process['PRO_UID']]) ) {
foreach($casesCnt[$process['PRO_UID']] as $item) {
$casesCountTotal += $item;
}
}
}
@@ -703,11 +707,13 @@ class Process extends BaseProcess {
$process['PRO_DEBUG_LABEL'] = ($process['PRO_DEBUG']=="1")? G::LoadTranslation('ID_ON'): G::LoadTranslation('ID_OFF');
$process['PRO_STATUS_LABEL'] = $process ['PRO_STATUS'] == 'ACTIVE'? G::LoadTranslation ('ID_ACTIVE'): G::LoadTranslation('ID_INACTIVE');
$process['PRO_CREATE_USER_LABEL'] = $userOwner;
$process['CASES_COUNT_TO_DO'] = (isset($casesCnt[$process['PRO_UID']]['TO_DO'])? $casesCnt[$process['PRO_UID']]['TO_DO']: 0);
$process['CASES_COUNT_COMPLETED'] = (isset($casesCnt[$process['PRO_UID']]['COMPLETED'])? $casesCnt[$process['PRO_UID']]['COMPLETED']: 0);
$process['CASES_COUNT_DRAFT'] = (isset($casesCnt[$process['PRO_UID']]['DRAFT'])? $casesCnt[$process['PRO_UID']]['DRAFT']: 0);
$process['CASES_COUNT_CANCELLED'] = (isset($casesCnt[$process['PRO_UID']]['CANCELLED'])? $casesCnt[$process['PRO_UID']]['CANCELLED']: 0);
$process['CASES_COUNT'] = $casesCountTotal;
if ($counters) {
$process['CASES_COUNT_TO_DO'] = (isset($casesCnt[$process['PRO_UID']]['TO_DO'])? $casesCnt[$process['PRO_UID']]['TO_DO']: 0);
$process['CASES_COUNT_COMPLETED'] = (isset($casesCnt[$process['PRO_UID']]['COMPLETED'])? $casesCnt[$process['PRO_UID']]['COMPLETED']: 0);
$process['CASES_COUNT_DRAFT'] = (isset($casesCnt[$process['PRO_UID']]['DRAFT'])? $casesCnt[$process['PRO_UID']]['DRAFT']: 0);
$process['CASES_COUNT_CANCELLED'] = (isset($casesCnt[$process['PRO_UID']]['CANCELLED'])? $casesCnt[$process['PRO_UID']]['CANCELLED']: 0);
$process['CASES_COUNT'] = $casesCountTotal;
}
unset( $process['PRO_CREATE_USER']);

View File

@@ -29,7 +29,7 @@ function getProcessList() {
//Get ProcessStatistics Info
$start = 0;
$limit = '';
$proData = $oProcess->getAllProcesses($start, $limit);
$proData = $oProcess->getAllProcesses($start, $limit, null, null, false);
$bCanStart = $oCase->canStartCase ( $_SESSION ['USER_LOGGED'] );
if ($bCanStart) {

View File

@@ -8,17 +8,6 @@ Ext.FlashComponent.EXPRESS_INSTALL_URL = '/images/expressinstall.swf';
var conn = new Ext.data.Connection();
var processNumbers = new Ext.data.ArrayStore({
fields: [
{name: 'CASES_COUNT_TO_DO', type: 'integer'},
{name: 'CASES_COUNT_DRAFT', type: 'integer'},
{name: 'CASES_COUNT_COMPLETED', type: 'integer'},
{name: 'CASES_COUNT_CANCELLED', type: 'integer'},
{name: 'CASES_COUNT', type: 'integer'}
]
});
var processNumbersData = [[0,0,0,0,0]];
Docs = {};
var infoCase = new Ext.form.FormPanel({
@@ -54,7 +43,7 @@ Ext.onReady(function() {
xtype : 'textfield',
name : 'processesFilter',
id : 'processesFilter',
emptyText : _('ID_FIND_A_PROCESS'),
emptyText : _('ID_FIND_A_PROCESS'),
enableKeyEvents : true,
listeners : {
render : function(f) {
@@ -79,14 +68,14 @@ Ext.onReady(function() {
}
}, ' ', ' ', {
iconCls : 'icon-expand-all',
tooltip : _('ID_EXPAND_ALL'),
tooltip : _('ID_EXPAND_ALL'),
handler : function() {
Ext.getCmp("startCaseTreePanel").root.expand(true);
},
scope : this
}, '-', {
iconCls : 'icon-collapse-all',
tooltip : _('ID_COLLAPSE_ALL'),
tooltip : _('ID_COLLAPSE_ALL'),
handler : function() {
Ext.getCmp("startCaseTreePanel").root.collapse(true);
},
@@ -119,13 +108,13 @@ Ext.onReady(function() {
}
}
});
var details = {
xtype:'form',
id : 'process-detail-panel',
region : 'east',
region : 'east',
split : true,
width : 450,
style : {
@@ -152,7 +141,7 @@ Ext.onReady(function() {
},
{
xtype: 'compositefield',
fieldLabel: TRANSLATIONS.ID_TASK,
fieldLabel: TRANSLATIONS.ID_TASK,
labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
@@ -205,32 +194,7 @@ Ext.onReady(function() {
id:"processCategory"
},
{
xtype: 'grid',
fieldLabel: ' ',
labelSeparator : '',
labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
ds: processNumbers,
cm: new Ext.grid.ColumnModel([
{id:'inbox',header: TRANSLATIONS.ID_INBOX, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_TO_DO'},
{id:'draft',header: TRANSLATIONS.ID_DRAFT, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_DRAFT'},
{id:'completed',header: TRANSLATIONS.ID_COMPLETED, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_COMPLETED'},
{id:'canceled',header: TRANSLATIONS.ID_CANCELLED, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_CANCELLED'},
{id:'totalCases',header: TRANSLATIONS.ID_TOTAL_CASES, width:80, sortable: false, locked:true , dataIndex: 'CASES_COUNT'}
]),
height: 49,
width: 355,
border: true,
stripeRows: false,
viewConfig: {
forceFit:true,
scrollOffset: 0
}
},
{
fieldLabel: TRANSLATIONS.ID_CALENDAR,
fieldLabel: TRANSLATIONS.ID_CALENDAR,
name: 'calendarName',
labelStyle : 'font-size:11px;',
style : {
@@ -240,7 +204,7 @@ Ext.onReady(function() {
},
{
xtype:'checkboxgroup',
fieldLabel: TRANSLATIONS.ID_WORKING_DAYS,
fieldLabel: TRANSLATIONS.ID_WORKING_DAYS,
name: 'calendarWorkDays',
disabled: true,
readOnly: true,
@@ -260,10 +224,10 @@ Ext.onReady(function() {
{boxLabel: TRANSLATIONS.ID_FRI, name: '5',disabledClass:""},
{boxLabel: TRANSLATIONS.ID_SAT, name: '6',disabledClass:""}
]
},
},
{
xtype:'checkbox',
fieldLabel: TRANSLATIONS.ID_DEBUG_MODE,
fieldLabel: TRANSLATIONS.ID_DEBUG_MODE,
name: 'processDebug',
labelStyle : 'font-size:11px;',
style : {
@@ -303,7 +267,7 @@ Ext.onReady(function() {
function openCaseA(n){
if (n.attributes.optionType == "startProcess") {
Ext.Msg.show({
title : '',
title : '',
msg : TRANSLATIONS.ID_STARTING_NEW_CASE + '<br><br><b>' + n.attributes.text + '</b>',
wait:true,
waitConfig: {interval:500}
@@ -316,12 +280,12 @@ function openCaseA(n){
taskId : n.attributes.tas_uid
},
success : function(response) {
try {
try {
var res = Ext.util.JSON.decode(response.responseText);
if (res.openCase) {
window.location = res.openCase.PAGE;
}
}
else {
Ext.Msg.show({
title : TRANSLATIONS.ID_ERROR_CREATING_NEW_CASE, // 'Error creating a new Case',
@@ -330,9 +294,9 @@ function openCaseA(n){
icon : Ext.MessageBox.ERROR,
buttons : Ext.Msg.OK
});
}
}
catch(e) {
}
}
catch(e) {
Ext.Msg.show({
title : TRANSLATIONS.ID_ERROR_CREATING_NEW_CASE, // 'Error creating a new Case',
msg : 'JSON Decode Error:<br /><textarea cols="50" rows="2">'
@@ -343,7 +307,7 @@ function openCaseA(n){
}
},
failure : function() {
Ext.Msg.alert(TRANSLATIONS.ID_ERROR, TRANSLATIONS.ID_UNABLE_START_CASE);
Ext.Msg.alert(TRANSLATIONS.ID_ERROR, TRANSLATIONS.ID_UNABLE_START_CASE);
}
});
}
@@ -379,15 +343,6 @@ function showDetailsA(selectedNode) {
});
processNumbersData = [[
otherAttributes.CASES_COUNT_TO_DO,
otherAttributes.CASES_COUNT_DRAFT,
otherAttributes.CASES_COUNT_COMPLETED,
otherAttributes.CASES_COUNT_CANCELLED,
otherAttributes.CASES_COUNT
]];
processNumbers.loadData(processNumbersData);
} else {
//detailEl.update('');
}