BUG-13421 Ordenamiento en el listado de procesos 'Designer'.
Se agregaron validaciones en los files: workflow/engine/classes/model/Process.php y workflow/engine/methods/processes/processesList.php para que se realize el ordenamiento ASC y DESC tomando en cuenta si se encuentra o no habilitado el uso de 'memcache' para listar de una forma mas veloz todos los procesos.
This commit is contained in:
@@ -387,7 +387,7 @@ class Process extends BaseProcess
|
||||
}
|
||||
}
|
||||
|
||||
usort( $processes, 'ordProcessByProTitle' );
|
||||
usort( $processes, 'ordProcess' );
|
||||
return $processes;
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ class Process extends BaseProcess
|
||||
|
||||
public function getAllProcesses ($start, $limit, $category = null, $processName = null, $counters = true, $reviewSubProcess = false)
|
||||
{
|
||||
require_once PATH_RBAC . "model/RbacUsers.php";
|
||||
require_once PATH_RBAC . "model/RbacUsers.php";
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
require_once "classes/model/Users.php";
|
||||
|
||||
@@ -629,14 +629,7 @@ class Process extends BaseProcess
|
||||
|
||||
$this->tmpCriteria = clone $oCriteria;
|
||||
|
||||
if ($start != '') {
|
||||
$oCriteria->setOffset( $start );
|
||||
}
|
||||
if ($limit != '' && ! isset( $category ) && ! isset( $processName )) {
|
||||
$oCriteria->setLimit( $limit );
|
||||
}
|
||||
|
||||
//execute a query to obtain numbers, how many cases there are by process
|
||||
//execute a query to obtain numbers, how many cases there are by process
|
||||
if ($counters) {
|
||||
$casesCnt = $this->getCasesCountInAllProcesses();
|
||||
}
|
||||
@@ -741,8 +734,13 @@ class Process extends BaseProcess
|
||||
$aProcesses[] = $process;
|
||||
|
||||
}
|
||||
|
||||
usort( $aProcesses, 'ordProcessByProTitle' );
|
||||
|
||||
$memcache = & PMmemcached::getSingleton( SYS_SYS );
|
||||
if ($memcache->enabled == 0) {
|
||||
usort( $aProcesses, 'ordProcess' );
|
||||
$aProcesses = array_splice($aProcesses, $start, $limit);
|
||||
}
|
||||
|
||||
return $aProcesses;
|
||||
}
|
||||
|
||||
@@ -848,16 +846,35 @@ class Process extends BaseProcess
|
||||
$r = $memcache->delete( $memkeyTotal );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ordProcessByProTitle ($a, $b)
|
||||
{
|
||||
if ($a['PRO_TITLE'] > $b['PRO_TITLE']) {
|
||||
return 1;
|
||||
} elseif ($a['PRO_TITLE'] < $b['PRO_TITLE']) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
public function orderMemcache($dataMemcache, $start, $limit)
|
||||
{
|
||||
usort( $dataMemcache, 'ordProcess' );
|
||||
$dataMemcache = array_splice($dataMemcache, $start, $limit);
|
||||
return $dataMemcache;
|
||||
}
|
||||
}
|
||||
|
||||
function ordProcess ($a, $b)
|
||||
{
|
||||
if (isset($_POST['sort'])) {
|
||||
if ($_POST['dir']=='ASC') {
|
||||
if ($a[$_POST['sort']] > $b[$_POST['sort']]) {
|
||||
return 1;
|
||||
} elseif ($a[$_POST['sort']] < $b[$_POST['sort']]) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ($a[$_POST['sort']] > $b[$_POST['sort']]) {
|
||||
return - 1;
|
||||
} elseif ($a[$_POST['sort']] < $b[$_POST['sort']]) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ $oProcess = new Process();
|
||||
$memkey = 'no memcache';
|
||||
$memcacheUsed = 'not used';
|
||||
$totalCount = 0;
|
||||
|
||||
if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
||||
if (isset( $_POST['processName'] ))
|
||||
$proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] );
|
||||
@@ -54,12 +53,14 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
||||
$memkeyTotal = $memkey . '-total';
|
||||
$memcacheUsed = 'yes';
|
||||
if (($proData = $memcache->get( $memkey )) === false || ($totalCount = $memcache->get( $memkeyTotal )) === false) {
|
||||
$proData = $oProcess->getAllProcesses( $start, $limit );
|
||||
$proData = $oProcess->getAllProcesses( $start, $limit );
|
||||
$totalCount = $oProcess->getAllProcessesCount();
|
||||
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
|
||||
$memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR );
|
||||
$memcacheUsed = 'no';
|
||||
}
|
||||
} else {
|
||||
$proData = $oProcess->orderMemcache($proData, $start, $limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
$r = new stdclass();
|
||||
|
||||
@@ -37,6 +37,7 @@ Ext.onReady(function(){
|
||||
|
||||
store = new Ext.data.GroupingStore( {
|
||||
//var store = new Ext.data.Store( {
|
||||
remoteSort: true,
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'processesList'
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user