HOR-472 Change log de dynaforms obtiene un orden extraño de los cambios

+ Refactor of ChangeLog History
This commit is contained in:
davidcallizaya
2016-03-23 23:04:27 -04:00
parent 7973236975
commit c278a93594
3 changed files with 43 additions and 46 deletions

View File

@@ -13,8 +13,6 @@ use Task;
/** /**
* Return the ChangeLog of a Dynaform * Return the ChangeLog of a Dynaform
* http://localhost:8083/sysworkflow/en/neoclassic/cases/casesHistoryDynaformPage_Ajax?actionAjax=showDynaformListHistory&PRO_UID=23134954556f0727c3fde11063016937&APP_UID=93748078756f16cd8e665b7099829333&TAS_UID=16304814956f0729495da25001454322&DYN_UID=12434578956f07308e54d44056464541
* http://localhost:8083/sysworkflow/en/neoclassic/cases/ajaxListener?action=changeLogTab&idHistory=23134954556f0727c3fde11063016937_48789444056f0747d7e2e19034608525_16304814956f0729495da25001454322
*/ */
class ChangeLog class ChangeLog
{ {
@@ -58,11 +56,13 @@ class ChangeLog
private function getResultSet($appUid) private function getResultSet($appUid)
{ {
$conn = Propel::getConnection('workflow'); $conn = Propel::getConnection('workflow');
$stmt = $conn->createStatement(); $sql = 'SELECT APP_HISTORY.*, USERS.USR_USERNAME FROM APP_HISTORY'
$sql = 'SELECT APP_HISTORY.*, USERS.USR_USERNAME FROM APP_HISTORY LEFT JOIN USERS ON(APP_HISTORY.USR_UID=USERS.USR_UID)' . ' LEFT JOIN USERS ON(APP_HISTORY.USR_UID=USERS.USR_UID)'
. ' WHERE APP_UID="'.$appUid.'" ORDER BY HISTORY_DATE ASC'; . ' WHERE APP_UID=? ORDER BY HISTORY_DATE ASC';
if (!$stmt->execute($sql)) { $stmt = $conn->prepareStatement($sql);
throw Exception('Unable to read history'); $stmt->set(1, $appUid);
if (!$stmt->executeQuery()) {
throw Exception(G::LoadTranslation('ID_MSG_AJAX_FAILURE'));
} }
return $stmt->getResultSet(); return $stmt->getResultSet();
} }
@@ -86,7 +86,6 @@ class ChangeLog
$this->hasPermission($row['DYN_UID']), true); $this->hasPermission($row['DYN_UID']), true);
$limit-= $a; $limit-= $a;
$index+= $a; $index+= $a;
error_log("+$a = $index / $limit");
if ($limit < 0) { if ($limit < 0) {
$index+=1; $index+=1;
break; break;
@@ -125,7 +124,6 @@ class ChangeLog
$node->record = $this->getHistoryTitle($row); $node->record = $this->getHistoryTitle($row);
$this->tree[] = $node; $this->tree[] = $node;
} }
// error_log($key);
$i++; $i++;
} }
$this->values[$key] = $value; $this->values[$key] = $value;

View File

@@ -32,7 +32,7 @@ Ext.onReady(function () {
groupField: 'record', groupField: 'record',
remoteSort: true, remoteSort: true,
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
url: '/sysworkflow/en/neoclassic/cases/ajaxListener?action=changeLogAjax&idHistory='+ID_HISTORY, url: 'ajaxListener?action=changeLogAjax&idHistory='+ID_HISTORY,
reader: new Ext.data.JsonReader({ reader: new Ext.data.JsonReader({
fields: [ fields: [
{name: 'record'}, {name: 'record'},

View File

@@ -780,27 +780,26 @@ Ext.onReady(function(){
}); });
} }
Actions.changeLogHistory = function() Actions.changeLogHistory = function ()
{ {
Ext.Ajax.request({ Ext.Ajax.request({
url : 'ajaxListener' , url: 'ajaxListener',
params : {action : 'verifySession'}, params: {action: 'verifySession'},
success: function ( result, request ) { success: function (result, request) {
var data = Ext.util.JSON.decode(result.responseText); var data = Ext.util.JSON.decode(result.responseText);
if( data.lostSession ) { if (data.lostSession) {
Ext.Msg.show({ Ext.Msg.show({
title: _('ID_ERROR'), title: _('ID_ERROR'),
msg: data.message, msg: data.message,
animEl: 'elId', animEl: 'elId',
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
fn : function(btn) { fn: function (btn) {
try try
{ {
prnt = parent.parent; prnt = parent.parent;
top.location = top.location; top.location = top.location;
} } catch (err)
catch (err)
{ {
parent.location = parent.location; parent.location = parent.location;
} }
@@ -810,9 +809,9 @@ Ext.onReady(function(){
Actions.tabFrame('changeLogHistory'); Actions.tabFrame('changeLogHistory');
} }
}, },
failure: function ( result, request) { failure: function (result, request) {
if (typeof(result.responseText) != 'undefined') { if (typeof (result.responseText) != 'undefined') {
Ext.MessageBox.alert( _('ID_FAILED'), result.responseText); Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
} }
} }
}); });