PM-3340
0018094: Batch routing doesn-t work in ProcessMaker 3.0.x
This commit is contained in:
@@ -88,7 +88,7 @@ class ConsolidatedCases
|
||||
$json = G::json_decode($dataDyna["DYN_CONTENT"]);
|
||||
$fieldsDyna = $json->items[0]->items;
|
||||
foreach ($fieldsDyna as $value) {
|
||||
$_POST['form']['FIELDS'][] = $value[0]->name . '-' . $value[0]->type;
|
||||
$_POST['form']['FIELDS'][] = ($value[0]->type !== 'panel') ? $value[0]->name . '-' . $value[0]->type : $value[0]->id . '-' . $value[0]->type;
|
||||
}
|
||||
|
||||
$aFieldsClases = array();
|
||||
@@ -176,16 +176,21 @@ class ConsolidatedCases
|
||||
$oCaseConsolidated->setTasUid($sTasUid);
|
||||
}
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
|
||||
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
|
||||
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
|
||||
if ($rsCriteria->next()) {
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
|
||||
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
|
||||
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
$oCaseConsolidated->delete();
|
||||
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
|
||||
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
|
||||
}
|
||||
|
||||
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
|
||||
$oCaseConsolidated = new CaseConsolidatedCore();
|
||||
$oCaseConsolidated->setTasUid($sTasUid);
|
||||
}
|
||||
|
||||
$oCaseConsolidated->setConStatus('ACTIVE');
|
||||
$oCaseConsolidated->setDynUid($sDynUid);
|
||||
$oCaseConsolidated->setRepTabUid($sRepTabUid);
|
||||
|
||||
@@ -597,6 +597,21 @@ class ajax_con extends WebResource
|
||||
$oCaseConsolidated->setTasUid($sTasUid);
|
||||
}
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
|
||||
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
|
||||
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
$oCaseConsolidated->delete();
|
||||
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
|
||||
}
|
||||
|
||||
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
|
||||
$oCaseConsolidated = new CaseConsolidatedCore();
|
||||
$oCaseConsolidated->setTasUid($sTasUid);
|
||||
}
|
||||
|
||||
if ($sStatus == '1') {
|
||||
$oCaseConsolidated->setConStatus('ACTIVE');
|
||||
} else {
|
||||
|
||||
@@ -83,18 +83,18 @@ class Consolidated
|
||||
if (!isset($Fields["DEL_INIT_DATE"])) {
|
||||
$oCase->setDelInitDate($app_uid, $del_index);
|
||||
$aFields = $oCase->loadCase($app_uid, $del_index);
|
||||
//Update data grid
|
||||
$aData = $aFields['APP_DATA'];
|
||||
foreach ($aData as $k => $dataField) {
|
||||
if(is_array($dataField)){
|
||||
$pos = count($dataField);
|
||||
if(isset($aData[$k][$pos][$fieldName])){
|
||||
$aData[$k][$pos][$fieldName] = $fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$aFields['APP_DATA'] = $aData;
|
||||
$oCase->updateCase($app_uid, $aFields);
|
||||
//Update data grid
|
||||
$aData = $aFields['APP_DATA'];
|
||||
foreach ($aData as $k => $dataField) {
|
||||
if(is_array($dataField)){
|
||||
$pos = count($dataField);
|
||||
if(isset($aData[$k][$pos][$fieldName])){
|
||||
$aData[$k][$pos][$fieldName] = $fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$aFields['APP_DATA'] = $aData;
|
||||
$oCase->updateCase($app_uid, $aFields);
|
||||
//End update
|
||||
}
|
||||
|
||||
@@ -394,7 +394,9 @@ class Consolidated
|
||||
foreach ($aTaskConsolidated as $key => $val) {
|
||||
foreach ($val as $iKey => $iVal) {
|
||||
if (self::checkValidDate($iVal)) {
|
||||
$val[$iKey] = str_replace("-", "/", $val[$iKey]);
|
||||
$iKeyView = str_replace("-", "/", $val[$iKey]);
|
||||
$iKeyView = str_replace("T", " ", $iKeyView);
|
||||
$val[$iKey] = $iKeyView;
|
||||
}
|
||||
}
|
||||
$response["data"][] = $val;
|
||||
@@ -465,7 +467,7 @@ class Consolidated
|
||||
$xmlfrm = new \stdclass();
|
||||
$xmlfrm->fields = array();
|
||||
foreach ($fieldsDyna as $key => $value) {
|
||||
if ($value[0]->type == 'title' || $value[0]->type == 'submit') {
|
||||
if ($value[0]->type == 'title' || $value[0]->type == 'submit' || $value[0]->type == 'panel' || $value[0]->type == 'image' || $value[0]->type == 'button' || $value[0]->type == 'grid' || $value[0]->type == 'checkgroup' || $value[0]->type == 'radiogroup' || $value[0]->type == 'radio' || $value[0]->type == 'hidden' || $value[0]->type == 'link' || $value[0]->type == 'file' || $value[0]->type == 'subform') {
|
||||
continue;
|
||||
}
|
||||
$temp = new \stdclass();
|
||||
@@ -478,7 +480,7 @@ class Consolidated
|
||||
if (!empty($value[0]->options)) {
|
||||
$temp->storeData = '[';
|
||||
foreach ($value[0]->options as $valueOption) {
|
||||
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
|
||||
$temp->storeData .= '["' . $valueOption->value . '", "' . $valueOption->label . '"],';
|
||||
}
|
||||
$temp->storeData = substr($temp->storeData,0,-1);
|
||||
$temp->storeData .= ']';
|
||||
@@ -528,12 +530,12 @@ class Consolidated
|
||||
$required = (isset($field->required))? $field->required : null;
|
||||
$validate = (isset($field->validate))? strtolower($field->validate) : null;
|
||||
|
||||
$fieldReadOnly = ($readOnly . "" == "1")? "readOnly: true," : null;
|
||||
$fieldReadOnly = ($readOnly . "" == "1" || $field->readOnly == 'view')? "readOnly: true," : null;
|
||||
$fieldRequired = ($required . "" == "1")? "allowBlank: false," : null;
|
||||
$fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null;
|
||||
|
||||
$fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>*</span> ": null) . $field->label;
|
||||
$fieldDisabled = ($field->mode != "edit")? "true" : "false";
|
||||
$fieldDisabled = ($field->mode == "view")? "true" : "false";
|
||||
|
||||
switch ($field->type) {
|
||||
case "dropdown":
|
||||
@@ -633,7 +635,7 @@ class Consolidated
|
||||
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
|
||||
} *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
if ($field->mode == "view") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
@@ -735,6 +737,33 @@ class Consolidated
|
||||
|
||||
$hasTextArea = true;
|
||||
break;
|
||||
case "datetime":
|
||||
$align = "center";
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.DateField({
|
||||
format: \"$dateFormat\",
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
//$renderer = "* formatDate *";
|
||||
$renderer = "* function (value){
|
||||
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
|
||||
} *";
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name, "type" => "date");
|
||||
break;
|
||||
case "link":
|
||||
$align = 'center';
|
||||
$size = 100;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var grdNumRows = 0; //
|
||||
var grdRowLabel = []; //
|
||||
var fieldGridGral = '';
|
||||
var fieldGridGral = '';
|
||||
var fieldGridGralVal = '';
|
||||
|
||||
|
||||
@@ -406,22 +406,27 @@ Ext.onReady(function () {
|
||||
text: "Derivate",
|
||||
//iconCls: 'ICON_CASES_PAUSED',
|
||||
handler : function (){
|
||||
htmlMessage = "";
|
||||
var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections();
|
||||
var maxLenght = selectedRow.length;
|
||||
for (var i in selectedRow) {
|
||||
rowGrid = selectedRow[i].data
|
||||
for (fieldGrid in rowGrid){
|
||||
if(fieldGrid != 'APP_UID' && fieldGrid != 'APP_NUMBER' && fieldGrid != 'APP_TITLE' && fieldGrid != 'DEL_INDEX' ){
|
||||
fieldGridGral = fieldGrid;
|
||||
fieldGridGralVal = rowGrid[fieldGrid];
|
||||
}
|
||||
}
|
||||
if (selectedRow[i].data) {
|
||||
//alert (derivateRequestAjax(selectedRow[i].data["company"]));
|
||||
ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal);
|
||||
}
|
||||
}
|
||||
Ext.Msg.confirm('Confirm Routing', 'Route cases per batch?',
|
||||
function(btn, text){
|
||||
if (btn=='yes'){
|
||||
htmlMessage = "";
|
||||
var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections();
|
||||
var maxLenght = selectedRow.length;
|
||||
for (var i in selectedRow) {
|
||||
rowGrid = selectedRow[i].data
|
||||
for (fieldGrid in rowGrid){
|
||||
if(fieldGrid != 'APP_UID' && fieldGrid != 'APP_NUMBER' && fieldGrid != 'APP_TITLE' && fieldGrid != 'DEL_INDEX' ){
|
||||
fieldGridGral = fieldGrid;
|
||||
fieldGridGralVal = rowGrid[fieldGrid];
|
||||
}
|
||||
}
|
||||
if (selectedRow[i].data) {
|
||||
ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
switch(action){
|
||||
@@ -716,276 +721,267 @@ function renderSummary (val, p, r) {
|
||||
|
||||
function generateGridClassic(proUid, tasUid, dynUid){
|
||||
|
||||
var pager = 20; //pageSize
|
||||
var pager = 20; //pageSize
|
||||
var pagei = 0; //start
|
||||
Ext.Ajax.request({
|
||||
url: '../pmConsolidatedCL/proxyGenerateGrid',
|
||||
success: function(response) {
|
||||
//Obtenemos el column model y los reader fields de proxyGenerateGrid
|
||||
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||
var viewConfigObject;
|
||||
var textArea = dataResponse.hasTextArea;
|
||||
|
||||
if (textArea == false) {
|
||||
viewConfigObject = { //forceFit: true
|
||||
};
|
||||
} else {
|
||||
viewConfigObject = {
|
||||
//forceFit:true,
|
||||
enableRowBody:true,
|
||||
showPreview:true,
|
||||
getRowClass : function(record, rowIndex, p, store){
|
||||
if (this.showPreview) {
|
||||
p.body = '<p><br /></p>';
|
||||
return 'x-grid3-row-expanded';
|
||||
}
|
||||
return 'x-grid3-row-collapsed';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
storeConsolidated = new Ext.data.Store({
|
||||
id: "storeConsolidatedGrid",
|
||||
remoteSort: true,
|
||||
//definimos un proxy como un objeto de la clase HttpProxy
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
url: "../pmConsolidatedCL/proxyConsolidated",
|
||||
api: {
|
||||
read: "../pmConsolidatedCL/proxyConsolidated",
|
||||
//update: "../pmConsolidatedCL/proxySaveConsolidated"
|
||||
update: "../pmConsolidatedCL/consolidatedUpdateAjax"
|
||||
}
|
||||
}),
|
||||
|
||||
//el data reader obtiene los reader fields de la consulta en ajax
|
||||
reader: new Ext.data.JsonReader({
|
||||
fields: dataResponse.readerFields,
|
||||
totalProperty: "totalCount",
|
||||
//successProperty: "success",
|
||||
idProperty: "APP_UID",
|
||||
root: "data",
|
||||
messageProperty: "message"
|
||||
}),
|
||||
|
||||
//el data writer es un objeto generico pero q permitira a futuro el escribir los datos al servidor mediante el proxy
|
||||
writer: new Ext.data.JsonWriter({
|
||||
encode: true,
|
||||
writeAllFields: false
|
||||
}), //<-- plug a DataWriter into the store just as you would a Reader
|
||||
autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
|
||||
|
||||
//el ordenamiento para los campos posiblemente este tenga q ser el tercer dato obtenido del proxy dado q los listados son muy cambiantes de tarea en tarea
|
||||
//sortInfo:{
|
||||
// field: 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
// direction: "DESC"
|
||||
//}
|
||||
|
||||
//,
|
||||
listeners: { //
|
||||
beforeload:function (store, options) { //
|
||||
grdNumRows = 0; //
|
||||
}, //
|
||||
|
||||
load:function (store, records, options) { //
|
||||
grdNumRows = store.getCount(); //
|
||||
|
||||
consolidatedGrid.setDisabled(false);
|
||||
} //
|
||||
} //
|
||||
});
|
||||
|
||||
var xColumns = dataResponse.columnModel;
|
||||
xColumns.unshift(smodel);
|
||||
|
||||
|
||||
var cm = new Ext.grid.ColumnModel(xColumns);
|
||||
cm.config[2].renderer = renderTitle; //Case Number
|
||||
cm.config[3].renderer = renderTitle; //Case Title
|
||||
cm.config[4].renderer = renderSummary;//Case Summary
|
||||
|
||||
//generacion del grid basados en los atributos definidos con anterioridad
|
||||
storeConsolidated.setBaseParam("limit", pager);
|
||||
storeConsolidated.setBaseParam("start", pagei);
|
||||
storeConsolidated.setBaseParam('tasUid', tasUid);
|
||||
storeConsolidated.setBaseParam('dynUid', dynUid);
|
||||
storeConsolidated.setBaseParam('proUid', proUid);
|
||||
storeConsolidated.setBaseParam('dropList', Ext.util.JSON.encode(dataResponse.dropList));
|
||||
storeConsolidated.load();
|
||||
|
||||
consolidatedGrid = new Ext.grid.EditorGridPanel({
|
||||
id: gridId,
|
||||
region: "center",
|
||||
|
||||
store: storeConsolidated,
|
||||
cm: cm,
|
||||
sm: smodel,
|
||||
//autoHeight: true,
|
||||
|
||||
//height: pnlMain.getSize().height - pnlMain.getFrameHeight(), //
|
||||
width: pnlMain.getSize().width, //
|
||||
height: browserHeight - 35, //
|
||||
|
||||
layout: 'fit',
|
||||
//plugins: filters,
|
||||
viewConfig: viewConfigObject,
|
||||
|
||||
listeners: {
|
||||
beforeedit: function (e) {
|
||||
var selRow = Ext.getCmp(gridId).getSelectionModel().getSelected();
|
||||
|
||||
var swDropdown = 0;
|
||||
for (var i = 0; i <= dataResponse.dropList.length - 1 && swDropdown == 0; i++) {
|
||||
if (dataResponse.dropList[i] == e.field) {
|
||||
swDropdown = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var swYesNo = 0;
|
||||
for (var i = 0; i <= dataResponse.comboBoxYesNoList.length - 1 && swYesNo == 0; i++) {
|
||||
if (dataResponse.comboBoxYesNoList[i] == e.field) {
|
||||
swYesNo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (swDropdown == 1 && swYesNo == 0) {
|
||||
storeAux = Ext.StoreMgr.get("store" + e.field + "_" + proUid);
|
||||
storeAux.setBaseParam("appUid", selRow.data["APP_UID"]);
|
||||
storeAux.setBaseParam("dynUid", dynUid);
|
||||
storeAux.setBaseParam("proUid", proUid);
|
||||
storeAux.setBaseParam("fieldName", e.field);
|
||||
//currentFieldEdited = e.field;
|
||||
storeAux.load();
|
||||
}
|
||||
},
|
||||
|
||||
afteredit: function (e) {
|
||||
//var store = consolidatedGrid.getStore();
|
||||
|
||||
if (Ext.getCmp("chk_allColumn").checked) {
|
||||
Ext.Msg.show({
|
||||
title: "",
|
||||
msg: "The modification will be applied to all rows in your selection.",
|
||||
buttons: Ext.Msg.YESNO,
|
||||
fn: function (btn) {
|
||||
if (btn == "yes") {
|
||||
//storeConsolidated.each(function (record) {
|
||||
// record.set(e.field, e.value);
|
||||
//});
|
||||
|
||||
consolidatedGrid.setDisabled(true);
|
||||
|
||||
var dataUpdate = "";
|
||||
var strValue = "";
|
||||
var sw = 0;
|
||||
|
||||
if (e.value instanceof Date) {
|
||||
var mAux = e.value.getMonth() + 1;
|
||||
var dAux = e.value.getDate();
|
||||
var hAux = e.value.getHours();
|
||||
var iAux = e.value.getMinutes();
|
||||
var sAux = e.value.getSeconds();
|
||||
|
||||
strValue = e.value.getFullYear() + "-" + ((mAux <= 9)? "0" : "") + mAux + "-" + ((dAux <= 9)? "0" : "") + dAux;
|
||||
strValue = strValue + " " + ((hAux <= 9)? "0" + ((hAux == 0)? "0" : hAux) : hAux) + ":" + ((iAux <= 9)? "0" + ((iAux == 0)? "0" : iAux) : iAux) + ":" + ((sAux <= 9)? "0" + ((sAux == 0)? "0" : sAux) : sAux);
|
||||
} else {
|
||||
strValue = strReplace("\"", "\\\"", e.value + "");
|
||||
}
|
||||
|
||||
storeConsolidated.each(function (record) {
|
||||
dataUpdate = dataUpdate + ((sw == 1)? "(sep1 /)": "") + record.data["APP_UID"] + "(sep2 /)" + e.field + "(sep2 /)" + strValue;
|
||||
sw = 1;
|
||||
});
|
||||
|
||||
///////
|
||||
Ext.Ajax.request({
|
||||
url: "consolidatedUpdateAjax",
|
||||
method: "POST",
|
||||
params: {
|
||||
"option": "ALL",
|
||||
"dynaformUid": dynUid,
|
||||
"dataUpdate": dataUpdate
|
||||
},
|
||||
|
||||
success: function (response, opts) {
|
||||
var dataResponse = eval("(" + response.responseText + ")"); //json
|
||||
|
||||
if (dataResponse.status && dataResponse.status == "OK") {
|
||||
if (typeof(storeConsolidated.lastOptions.params) != "undefined") {
|
||||
pagei = storeConsolidated.lastOptions.params.start;
|
||||
}
|
||||
|
||||
storeConsolidated.setBaseParam("start", pagei);
|
||||
storeConsolidated.load();
|
||||
} else {
|
||||
//
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//animEl: "elId",
|
||||
icon: Ext.MessageBox.QUESTION
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
mouseover: function (e, cell) {
|
||||
var rowIndex = consolidatedGrid.getView().findRowIndex(cell);
|
||||
if (!(rowIndex === false)) {
|
||||
var record = consolidatedGrid.store.getAt(rowIndex);
|
||||
var msg = record.get('APP_TITLE');
|
||||
Ext.QuickTips.register({
|
||||
text: msg,
|
||||
target: e.target
|
||||
});
|
||||
} else {
|
||||
Ext.QuickTips.unregister(e.target);
|
||||
}
|
||||
},
|
||||
|
||||
mouseout: function (e, cell) {
|
||||
Ext.QuickTips.unregister(e.target);
|
||||
}
|
||||
},
|
||||
|
||||
//tbar: tb,
|
||||
|
||||
tbar: new Ext.Toolbar({
|
||||
height: 33,
|
||||
items: toolbarconsolidated
|
||||
}),
|
||||
|
||||
bbar: new Ext.PagingToolbar({
|
||||
pageSize: pager,
|
||||
store: storeConsolidated,
|
||||
displayInfo: true,
|
||||
displayMsg: _("ID_DISPLAY_ITEMS"),
|
||||
emptyMsg: _("ID_DISPLAY_EMPTY")
|
||||
})
|
||||
});
|
||||
|
||||
//remocion de todos los elementos del panel principal donde se carga el grid
|
||||
//Ext.ComponentMgr.get("myId").body.update("");
|
||||
//pnlMain.removeAll(false);
|
||||
pnlMain.removeAll();
|
||||
//adicion del grid definido con anterioridad
|
||||
pnlMain.add(consolidatedGrid);
|
||||
//recarga de los elementos del grid, para su visualizacion.
|
||||
pnlMain.doLayout();
|
||||
},
|
||||
|
||||
//en caso de fallo ejecutar la siguiente funcion.
|
||||
failure: function(){
|
||||
alert("Failure...");
|
||||
},
|
||||
// parametros que son enviados en la peticion al servidor.
|
||||
params: {
|
||||
xaction: 'read',
|
||||
tasUid: tasUid,
|
||||
dynUid: dynUid,
|
||||
proUid: proUid
|
||||
}
|
||||
});
|
||||
Ext.Ajax.request({
|
||||
url: '../pmConsolidatedCL/proxyGenerateGrid',
|
||||
success: function(response) {
|
||||
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||
var viewConfigObject;
|
||||
var textArea = dataResponse.hasTextArea;
|
||||
|
||||
if (textArea == false) {
|
||||
viewConfigObject = { //forceFit: true
|
||||
};
|
||||
} else {
|
||||
viewConfigObject = {
|
||||
//forceFit:true,
|
||||
enableRowBody:true,
|
||||
showPreview:true,
|
||||
getRowClass : function(record, rowIndex, p, store){
|
||||
if (this.showPreview) {
|
||||
p.body = '<p><br /></p>';
|
||||
return 'x-grid3-row-expanded';
|
||||
}
|
||||
return 'x-grid3-row-collapsed';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
storeConsolidated = new Ext.data.Store({
|
||||
id: "storeConsolidatedGrid",
|
||||
remoteSort: true,
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
url: "../pmConsolidatedCL/proxyConsolidated",
|
||||
api: {
|
||||
read: "../pmConsolidatedCL/proxyConsolidated",
|
||||
//update: "../pmConsolidatedCL/proxySaveConsolidated"
|
||||
update: "../pmConsolidatedCL/consolidatedUpdateAjax"
|
||||
}
|
||||
}),
|
||||
|
||||
reader: new Ext.data.JsonReader({
|
||||
fields: dataResponse.readerFields,
|
||||
totalProperty: "totalCount",
|
||||
//successProperty: "success",
|
||||
idProperty: "APP_UID",
|
||||
root: "data",
|
||||
messageProperty: "message"
|
||||
}),
|
||||
|
||||
writer: new Ext.data.JsonWriter({
|
||||
encode: true,
|
||||
writeAllFields: false
|
||||
}), //<-- plug a DataWriter into the store just as you would a Reader
|
||||
autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
|
||||
|
||||
//sortInfo:{
|
||||
// field: 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
// direction: "DESC"
|
||||
//}
|
||||
|
||||
//,
|
||||
listeners: { //
|
||||
beforeload:function (store, options) { //
|
||||
grdNumRows = 0; //
|
||||
}, //
|
||||
|
||||
load:function (store, records, options) { //
|
||||
grdNumRows = store.getCount(); //
|
||||
|
||||
consolidatedGrid.setDisabled(false);
|
||||
} //
|
||||
} //
|
||||
});
|
||||
|
||||
var xColumns = dataResponse.columnModel;
|
||||
xColumns.unshift(smodel);
|
||||
|
||||
|
||||
var cm = new Ext.grid.ColumnModel(xColumns);
|
||||
cm.config[2].renderer = renderTitle; //Case Number
|
||||
cm.config[3].renderer = renderTitle; //Case Title
|
||||
cm.config[4].renderer = renderSummary;//Case Summary
|
||||
|
||||
storeConsolidated.setBaseParam("limit", pager);
|
||||
storeConsolidated.setBaseParam("start", pagei);
|
||||
storeConsolidated.setBaseParam('tasUid', tasUid);
|
||||
storeConsolidated.setBaseParam('dynUid', dynUid);
|
||||
storeConsolidated.setBaseParam('proUid', proUid);
|
||||
storeConsolidated.setBaseParam('dropList', Ext.util.JSON.encode(dataResponse.dropList));
|
||||
storeConsolidated.load();
|
||||
|
||||
consolidatedGrid = new Ext.grid.EditorGridPanel({
|
||||
id: gridId,
|
||||
region: "center",
|
||||
|
||||
store: storeConsolidated,
|
||||
cm: cm,
|
||||
sm: smodel,
|
||||
//autoHeight: true,
|
||||
|
||||
//height: pnlMain.getSize().height - pnlMain.getFrameHeight(), //
|
||||
width: pnlMain.getSize().width, //
|
||||
height: browserHeight - 35, //
|
||||
|
||||
layout: 'fit',
|
||||
//plugins: filters,
|
||||
viewConfig: viewConfigObject,
|
||||
|
||||
listeners: {
|
||||
beforeedit: function (e) {
|
||||
var selRow = Ext.getCmp(gridId).getSelectionModel().getSelected();
|
||||
|
||||
var swDropdown = 0;
|
||||
for (var i = 0; i <= dataResponse.dropList.length - 1 && swDropdown == 0; i++) {
|
||||
if (dataResponse.dropList[i] == e.field) {
|
||||
swDropdown = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var swYesNo = 0;
|
||||
for (var i = 0; i <= dataResponse.comboBoxYesNoList.length - 1 && swYesNo == 0; i++) {
|
||||
if (dataResponse.comboBoxYesNoList[i] == e.field) {
|
||||
swYesNo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (swDropdown == 1 && swYesNo == 0) {
|
||||
storeAux = Ext.StoreMgr.get("store" + e.field + "_" + proUid);
|
||||
storeAux.setBaseParam("appUid", selRow.data["APP_UID"]);
|
||||
storeAux.setBaseParam("dynUid", dynUid);
|
||||
storeAux.setBaseParam("proUid", proUid);
|
||||
storeAux.setBaseParam("fieldName", e.field);
|
||||
//currentFieldEdited = e.field;
|
||||
storeAux.load();
|
||||
}
|
||||
},
|
||||
|
||||
afteredit: function (e) {
|
||||
//var store = consolidatedGrid.getStore();
|
||||
|
||||
if (Ext.getCmp("chk_allColumn").checked) {
|
||||
Ext.Msg.show({
|
||||
title: "",
|
||||
msg: "The modification will be applied to all rows in your selection.",
|
||||
buttons: Ext.Msg.YESNO,
|
||||
fn: function (btn) {
|
||||
if (btn == "yes") {
|
||||
//storeConsolidated.each(function (record) {
|
||||
// record.set(e.field, e.value);
|
||||
//});
|
||||
|
||||
consolidatedGrid.setDisabled(true);
|
||||
|
||||
var dataUpdate = "";
|
||||
var strValue = "";
|
||||
var sw = 0;
|
||||
|
||||
if (e.value instanceof Date) {
|
||||
var mAux = e.value.getMonth() + 1;
|
||||
var dAux = e.value.getDate();
|
||||
var hAux = e.value.getHours();
|
||||
var iAux = e.value.getMinutes();
|
||||
var sAux = e.value.getSeconds();
|
||||
|
||||
strValue = e.value.getFullYear() + "-" + ((mAux <= 9)? "0" : "") + mAux + "-" + ((dAux <= 9)? "0" : "") + dAux;
|
||||
strValue = strValue + " " + ((hAux <= 9)? "0" + ((hAux == 0)? "0" : hAux) : hAux) + ":" + ((iAux <= 9)? "0" + ((iAux == 0)? "0" : iAux) : iAux) + ":" + ((sAux <= 9)? "0" + ((sAux == 0)? "0" : sAux) : sAux);
|
||||
} else {
|
||||
strValue = strReplace("\"", "\\\"", e.value + "");
|
||||
}
|
||||
|
||||
storeConsolidated.each(function (record) {
|
||||
dataUpdate = dataUpdate + ((sw == 1)? "(sep1 /)": "") + record.data["APP_UID"] + "(sep2 /)" + e.field + "(sep2 /)" + strValue;
|
||||
sw = 1;
|
||||
});
|
||||
|
||||
///////
|
||||
Ext.Ajax.request({
|
||||
url: "consolidatedUpdateAjax",
|
||||
method: "POST",
|
||||
params: {
|
||||
"option": "ALL",
|
||||
"dynaformUid": dynUid,
|
||||
"dataUpdate": dataUpdate
|
||||
},
|
||||
|
||||
success: function (response, opts) {
|
||||
var dataResponse = eval("(" + response.responseText + ")"); //json
|
||||
|
||||
if (dataResponse.status && dataResponse.status == "OK") {
|
||||
if (typeof(storeConsolidated.lastOptions.params) != "undefined") {
|
||||
pagei = storeConsolidated.lastOptions.params.start;
|
||||
}
|
||||
|
||||
storeConsolidated.setBaseParam("start", pagei);
|
||||
storeConsolidated.load();
|
||||
} else {
|
||||
//
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//animEl: "elId",
|
||||
icon: Ext.MessageBox.QUESTION
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
mouseover: function (e, cell) {
|
||||
var rowIndex = consolidatedGrid.getView().findRowIndex(cell);
|
||||
if (!(rowIndex === false)) {
|
||||
var record = consolidatedGrid.store.getAt(rowIndex);
|
||||
var msg = record.get('APP_TITLE');
|
||||
Ext.QuickTips.register({
|
||||
text: msg,
|
||||
target: e.target
|
||||
});
|
||||
} else {
|
||||
Ext.QuickTips.unregister(e.target);
|
||||
}
|
||||
},
|
||||
|
||||
mouseout: function (e, cell) {
|
||||
Ext.QuickTips.unregister(e.target);
|
||||
}
|
||||
},
|
||||
|
||||
//tbar: tb,
|
||||
|
||||
tbar: new Ext.Toolbar({
|
||||
height: 33,
|
||||
items: toolbarconsolidated
|
||||
}),
|
||||
|
||||
bbar: new Ext.PagingToolbar({
|
||||
pageSize: pager,
|
||||
store: storeConsolidated,
|
||||
displayInfo: true,
|
||||
displayMsg: _("ID_DISPLAY_ITEMS"),
|
||||
emptyMsg: _("ID_DISPLAY_EMPTY")
|
||||
})
|
||||
});
|
||||
|
||||
//Ext.ComponentMgr.get("myId").body.update("");
|
||||
//pnlMain.removeAll(false);
|
||||
pnlMain.removeAll();
|
||||
//adicion del grid definido con anterioridad
|
||||
pnlMain.add(consolidatedGrid);
|
||||
pnlMain.doLayout();
|
||||
},
|
||||
|
||||
failure: function(){
|
||||
alert("Failure...");
|
||||
},
|
||||
|
||||
params: {
|
||||
xaction: 'read',
|
||||
tasUid: tasUid,
|
||||
dynUid: dynUid,
|
||||
proUid: proUid
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function generateGrid(proUid, tasUid, dynUid)
|
||||
@@ -1001,8 +997,6 @@ function generateGrid(proUid, tasUid, dynUid)
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
},
|
||||
success: function(response) {
|
||||
//Obtenemos el column model y los reader fields de proxyGenerateGrid
|
||||
//console.log(response.responseText);
|
||||
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||
var viewConfigObject;
|
||||
var textArea = dataResponse.hasTextArea;
|
||||
@@ -1027,7 +1021,6 @@ function generateGrid(proUid, tasUid, dynUid)
|
||||
storeConsolidated = new Ext.data.Store({
|
||||
id: "storeConsolidatedGrid",
|
||||
remoteSort: true,
|
||||
//definimos un proxy como un objeto de la clase HttpProxy
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
method: 'GET',
|
||||
url: urlProxy + 'cases/' + proUid + '/' + tasUid + '/' + dynUid,
|
||||
@@ -1046,7 +1039,6 @@ function generateGrid(proUid, tasUid, dynUid)
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
}
|
||||
}),
|
||||
//el data reader obtiene los reader fields de la consulta en ajax
|
||||
reader: new Ext.data.JsonReader({
|
||||
fields: dataResponse.readerFields,
|
||||
totalProperty: "totalCount",
|
||||
@@ -1056,20 +1048,12 @@ function generateGrid(proUid, tasUid, dynUid)
|
||||
messageProperty: "message"
|
||||
}),
|
||||
|
||||
//el data writer es un objeto generico pero q permitira a futuro el escribir los datos al servidor mediante el proxy
|
||||
writer: new Ext.data.JsonWriter({
|
||||
encode: false,
|
||||
writeAllFields: false
|
||||
}), //<-- plug a DataWriter into the store just as you would a Reader
|
||||
autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
|
||||
|
||||
//el ordenamiento para los campos posiblemente este tenga q ser el tercer dato obtenido del proxy dado q los listados son muy cambiantes de tarea en tarea
|
||||
//sortInfo:{
|
||||
// field: 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
// direction: "DESC"
|
||||
//}
|
||||
|
||||
//,
|
||||
listeners: { //
|
||||
beforeload:function (store, options) { //
|
||||
grdNumRows = 0; //
|
||||
@@ -1306,14 +1290,14 @@ function generateGrid(proUid, tasUid, dynUid)
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridGral, fieldGridGralVal){
|
||||
function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber, fieldGridGral, fieldGridGralVal){
|
||||
Ext.Ajax.request({
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
},
|
||||
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal,
|
||||
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal + '/',
|
||||
success: function(response) {
|
||||
var dataResponse;
|
||||
var fullResponseText = response.responseText;
|
||||
@@ -1333,10 +1317,8 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridG
|
||||
Ext.MessageBox.show({
|
||||
title: "Derivation Result",
|
||||
msg: htmlMessage,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
|
||||
fn: function (btn, text, opt) {
|
||||
//if (btn == "ok") {}
|
||||
if (maxLenght == storeConsolidated.getCount()) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user