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:10:56 -04:00
parent c278a93594
commit 5afd26e00e
2 changed files with 88 additions and 89 deletions

View File

@@ -44,8 +44,7 @@ class ChangeLog
*/
private $permissions = [];
public function getChangeLog($appUid, $proUid, $tasUid, $start,
$limit)
public function getChangeLog($appUid, $proUid, $tasUid, $start, $limit)
{
$this->loadPermissions($appUid, $proUid, $tasUid);
$result = $this->getResultSet($appUid);
@@ -57,8 +56,8 @@ class ChangeLog
{
$conn = Propel::getConnection('workflow');
$sql = 'SELECT APP_HISTORY.*, USERS.USR_USERNAME FROM APP_HISTORY'
. ' LEFT JOIN USERS ON(APP_HISTORY.USR_UID=USERS.USR_UID)'
. ' WHERE APP_UID=? ORDER BY HISTORY_DATE ASC';
.' LEFT JOIN USERS ON(APP_HISTORY.USR_UID=USERS.USR_UID)'
.' WHERE APP_UID=? ORDER BY HISTORY_DATE ASC';
$stmt = $conn->prepareStatement($sql);
$stmt->set(1, $appUid);
if (!$stmt->executeQuery()) {
@@ -77,9 +76,8 @@ class ChangeLog
continue;
}
if ($index < $start) {
$index += $this->updateData($data, $row,
$this->hasPermission($row['DYN_UID']),
false);
$index += $this->updateData(
$data, $row, $this->hasPermission($row['DYN_UID']), false);
continue;
}
$a = $this->updateData($data, $row,
@@ -112,7 +110,8 @@ class ChangeLog
if (array_search($key, $this->reserved) !== false) {
continue;
}
if ($hasPermission && (!isset($this->values[$key]) || $this->values[$key] !== $value)) {
if ($hasPermission && (!isset($this->values[$key]) || $this->values[$key]
!== $value)) {
if ($addToTree) {
$node = new StdClass();
$node->field = $key;

View File

@@ -5,19 +5,35 @@ Ext.onReady(function () {
var viewport = new Ext.Viewport({
layout: 'border',
items: [
new Ext.grid.GridPanel({
new Ext.grid.GridPanel({
region: 'center',
"width": "100%",
"height": 300,
"stateful": true,
"stateId": "stateGrid",
enableColumnHide: false,
view: new Ext.grid.GroupingView({
forceFit: true,
enableGroupingMenu:false
}),
"store": store = new Ext.data.GroupingStore({
pageSize: 15,
"width": "100%",
"height": 300,
"stateful": true,
"stateId": "stateGrid",
"enableColumnHide": false,
"view": new Ext.grid.GroupingView({
forceFit: true,
enableGroupingMenu: false
}),
"store": store = new Ext.data.GroupingStore({
pageSize: 15,
fields: [
{name: 'record'},
{name: 'field'},
{name: 'previousValue'},
{name: 'currentValue'},
{name: 'previousValueType'},
{name: 'currentValueType'},
{name: 'task'},
{name: 'updateDate'},
{name: 'user'}
],
groupField: 'record',
remoteSort: true,
proxy: new Ext.data.HttpProxy({
url: 'ajaxListener?action=changeLogAjax&idHistory=' + ID_HISTORY,
reader: new Ext.data.JsonReader({
fields: [
{name: 'record'},
{name: 'field'},
@@ -29,77 +45,61 @@ Ext.onReady(function () {
{name: 'updateDate'},
{name: 'user'}
],
groupField: 'record',
remoteSort: true,
proxy: new Ext.data.HttpProxy({
url: 'ajaxListener?action=changeLogAjax&idHistory='+ID_HISTORY,
reader: new Ext.data.JsonReader({
fields: [
{name: 'record'},
{name: 'field'},
{name: 'previousValue'},
{name: 'currentValue'},
{name: 'previousValueType'},
{name: 'currentValueType'},
{name: 'task'},
{name: 'updateDate'},
{name: 'user'}
],
root: 'data',
totalProperty: 'totalCount'
}),
})
})
, colModel: new Ext.grid.ColumnModel({
"columns": [
{
header: _('ID_FIELD_NAME'),
width: 120,
sortable: false,
dataIndex: 'field'
},
{
header: _('ID_PREV_VALUES'),
flex: 1,
sortable: false,
dataIndex: 'previousValue',
renderer: function (value, p, record) {
return value +
' <button disabled="disabled">'
+ record.data.previousValueType + '</button>';
}
},
{
header: _('ID_CURRENT_VALUES'),
flex: 1,
sortable: false,
dataIndex: 'currentValue',
renderer: function (value, p, record) {
return value +
' <button disabled="disabled">'
+ record.data.currentValueType + '</button>';
}
},
{
header: '',
width: 1,
sortable: false,
hidden: true,
hideable: true,
dataIndex: 'record'
}
]}),
bbar: new Ext.PagingToolbar({
pageSize: 20,
store: store,
displayInfo: true,
displayMsg: _('ID_GRID_PAGE_DISPLAYING_ITEMS'),
emptyMsg: "",
items: []
})
root: 'data',
totalProperty: 'totalCount'
}),
})
}),
"colModel": new Ext.grid.ColumnModel({
"columns": [
{
header: _('ID_FIELD_NAME'),
width: 120,
sortable: false,
dataIndex: 'field'
},
{
header: _('ID_PREV_VALUES'),
flex: 1,
sortable: false,
dataIndex: 'previousValue',
renderer: function (value, p, record) {
return value +
' <button disabled="disabled">'
+ record.data.previousValueType + '</button>';
}
},
{
header: _('ID_CURRENT_VALUES'),
flex: 1,
sortable: false,
dataIndex: 'currentValue',
renderer: function (value, p, record) {
return value +
' <button disabled="disabled">'
+ record.data.currentValueType + '</button>';
}
},
{
header: '',
width: 1,
sortable: false,
hidden: true,
hideable: true,
dataIndex: 'record'
}
]}),
"bbar": new Ext.PagingToolbar({
pageSize: 20,
store: store,
displayInfo: true,
displayMsg: '{0} - {1}',,
emptyMsg: "",
items: []
})
})
]
]
});
store.load();