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;
|
return $processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,13 +629,6 @@ class Process extends BaseProcess
|
|||||||
|
|
||||||
$this->tmpCriteria = clone $oCriteria;
|
$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) {
|
if ($counters) {
|
||||||
$casesCnt = $this->getCasesCountInAllProcesses();
|
$casesCnt = $this->getCasesCountInAllProcesses();
|
||||||
@@ -742,7 +735,12 @@ class Process extends BaseProcess
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usort( $aProcesses, 'ordProcessByProTitle' );
|
$memcache = & PMmemcached::getSingleton( SYS_SYS );
|
||||||
|
if ($memcache->enabled == 0) {
|
||||||
|
usort( $aProcesses, 'ordProcess' );
|
||||||
|
$aProcesses = array_splice($aProcesses, $start, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
return $aProcesses;
|
return $aProcesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,16 +846,35 @@ class Process extends BaseProcess
|
|||||||
$r = $memcache->delete( $memkeyTotal );
|
$r = $memcache->delete( $memkeyTotal );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function orderMemcache($dataMemcache, $start, $limit)
|
||||||
|
{
|
||||||
|
usort( $dataMemcache, 'ordProcess' );
|
||||||
|
$dataMemcache = array_splice($dataMemcache, $start, $limit);
|
||||||
|
return $dataMemcache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ordProcessByProTitle ($a, $b)
|
function ordProcess ($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['PRO_TITLE'] > $b['PRO_TITLE']) {
|
if (isset($_POST['sort'])) {
|
||||||
|
if ($_POST['dir']=='ASC') {
|
||||||
|
if ($a[$_POST['sort']] > $b[$_POST['sort']]) {
|
||||||
return 1;
|
return 1;
|
||||||
} elseif ($a['PRO_TITLE'] < $b['PRO_TITLE']) {
|
} elseif ($a[$_POST['sort']] < $b[$_POST['sort']]) {
|
||||||
return - 1;
|
return - 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
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';
|
$memkey = 'no memcache';
|
||||||
$memcacheUsed = 'not used';
|
$memcacheUsed = 'not used';
|
||||||
$totalCount = 0;
|
$totalCount = 0;
|
||||||
|
|
||||||
if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
||||||
if (isset( $_POST['processName'] ))
|
if (isset( $_POST['processName'] ))
|
||||||
$proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] );
|
$proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] );
|
||||||
@@ -59,6 +58,8 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
|||||||
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
|
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
|
||||||
$memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR );
|
$memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR );
|
||||||
$memcacheUsed = 'no';
|
$memcacheUsed = 'no';
|
||||||
|
} else {
|
||||||
|
$proData = $oProcess->orderMemcache($proData, $start, $limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
store = new Ext.data.GroupingStore( {
|
store = new Ext.data.GroupingStore( {
|
||||||
//var store = new Ext.data.Store( {
|
//var store = new Ext.data.Store( {
|
||||||
|
remoteSort: true,
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
url: 'processesList'
|
url: 'processesList'
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user