BUG-13396 Ordenamiento en MessageHistory

Se agrego el odenamiento de todo el listado en MessageHistory y no solo porpagina como estaba funcionando.
This commit is contained in:
jennylee
2013-11-15 12:03:58 -04:00
parent 8a895b84f0
commit 604cf9310d
2 changed files with 23 additions and 14 deletions

View File

@@ -71,6 +71,8 @@ class Cases
{
private $appSolr = null;
public $dir = 'ASC';
public $sort = 'APP_MSG_DATE';
public function __construct()
{
@@ -5941,9 +5943,8 @@ class Cases
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('messages');
usort( $aMessages, 'ordProcess' );
$aMessages = array_splice($aMessages, $start, $limit);
usort( $aMessages, array($this, "ordProcess") );
return $aMessages;
}
@@ -6757,27 +6758,28 @@ class Cases
}
}
}
}
function ordProcess ($a, $b)
{
if (isset($_POST['sort'])) {
if ($_POST['dir']=='ASC') {
if ($a[$_POST['sort']] > $b[$_POST['sort']]) {
public function ordProcess ($a, $b)
{
if ($this->sort == '') {
$this->sort = 'APP_MSG_DATE';
}
if ($this->dir=='ASC') {
if ($a[$this->sort] > $b[$this->sort]) {
return 1;
} elseif ($a[$_POST['sort']] < $b[$_POST['sort']]) {
} elseif ($a[$this->sort] < $b[$this->sort]) {
return - 1;
} else {
return 0;
}
} else {
if ($a[$_POST['sort']] > $b[$_POST['sort']]) {
if ($a[$this->sort] > $b[$this->sort]) {
return - 1;
} elseif ($a[$_POST['sort']] < $b[$_POST['sort']]) {
} elseif ($a[$this->sort] < $b[$this->sort]) {
return 1;
} else {
return 0;
}
}
}
}
}
}

View File

@@ -36,9 +36,14 @@ if ($actionAjax == 'messageHistoryGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : '';
global $G_PUBLISH;
$oCase = new Cases();
$oCase->dir = $dir;
$oCase->sort = $sort;
$appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']);
$appMessageCountArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true);
@@ -98,6 +103,8 @@ if ($actionAjax == 'messageHistoryGridList_JXP') {
}
}
$aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']);
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;