0018094: Batch routing doesn-t work in ProcessMaker 3.0.x
This commit is contained in:
dheeyi
2015-08-24 18:14:08 -04:00
parent 2585cb9933
commit c85356b0f9
4 changed files with 358 additions and 327 deletions

View File

@@ -88,7 +88,7 @@ class ConsolidatedCases
$json = G::json_decode($dataDyna["DYN_CONTENT"]); $json = G::json_decode($dataDyna["DYN_CONTENT"]);
$fieldsDyna = $json->items[0]->items; $fieldsDyna = $json->items[0]->items;
foreach ($fieldsDyna as $value) { 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(); $aFieldsClases = array();
@@ -186,6 +186,11 @@ class ConsolidatedCases
$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->setConStatus('ACTIVE');
$oCaseConsolidated->setDynUid($sDynUid); $oCaseConsolidated->setDynUid($sDynUid);
$oCaseConsolidated->setRepTabUid($sRepTabUid); $oCaseConsolidated->setRepTabUid($sRepTabUid);

View File

@@ -597,6 +597,21 @@ class ajax_con extends WebResource
$oCaseConsolidated->setTasUid($sTasUid); $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') { if ($sStatus == '1') {
$oCaseConsolidated->setConStatus('ACTIVE'); $oCaseConsolidated->setConStatus('ACTIVE');
} else { } else {

View File

@@ -394,7 +394,9 @@ class Consolidated
foreach ($aTaskConsolidated as $key => $val) { foreach ($aTaskConsolidated as $key => $val) {
foreach ($val as $iKey => $iVal) { foreach ($val as $iKey => $iVal) {
if (self::checkValidDate($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; $response["data"][] = $val;
@@ -465,7 +467,7 @@ class Consolidated
$xmlfrm = new \stdclass(); $xmlfrm = new \stdclass();
$xmlfrm->fields = array(); $xmlfrm->fields = array();
foreach ($fieldsDyna as $key => $value) { 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; continue;
} }
$temp = new \stdclass(); $temp = new \stdclass();
@@ -478,7 +480,7 @@ class Consolidated
if (!empty($value[0]->options)) { if (!empty($value[0]->options)) {
$temp->storeData = '['; $temp->storeData = '[';
foreach ($value[0]->options as $valueOption) { 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 = substr($temp->storeData,0,-1);
$temp->storeData .= ']'; $temp->storeData .= ']';
@@ -528,12 +530,12 @@ class Consolidated
$required = (isset($field->required))? $field->required : null; $required = (isset($field->required))? $field->required : null;
$validate = (isset($field->validate))? strtolower($field->validate) : 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; $fieldRequired = ($required . "" == "1")? "allowBlank: false," : null;
$fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null; $fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null;
$fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>&#42;</span> ": null) . $field->label; $fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>&#42;</span> ": null) . $field->label;
$fieldDisabled = ($field->mode != "edit")? "true" : "false"; $fieldDisabled = ($field->mode == "view")? "true" : "false";
switch ($field->type) { switch ($field->type) {
case "dropdown": case "dropdown":
@@ -633,7 +635,7 @@ class Consolidated
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value; return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
} *"; } *";
if ($field->mode != "edit") { if ($field->mode == "view") {
$editor = null; $editor = null;
} }
@@ -735,6 +737,33 @@ class Consolidated
$hasTextArea = true; $hasTextArea = true;
break; 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": case "link":
$align = 'center'; $align = 'center';
$size = 100; $size = 100;

View File

@@ -406,6 +406,9 @@ Ext.onReady(function () {
text: "Derivate", text: "Derivate",
//iconCls: 'ICON_CASES_PAUSED', //iconCls: 'ICON_CASES_PAUSED',
handler : function (){ handler : function (){
Ext.Msg.confirm('Confirm Routing', 'Route cases per batch?',
function(btn, text){
if (btn=='yes'){
htmlMessage = ""; htmlMessage = "";
var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections(); var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections();
var maxLenght = selectedRow.length; var maxLenght = selectedRow.length;
@@ -418,11 +421,13 @@ Ext.onReady(function () {
} }
} }
if (selectedRow[i].data) { 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); ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal);
} }
} }
} }
}
);
}
}); });
switch(action){ switch(action){
case 'consolidated': case 'consolidated':
@@ -721,7 +726,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
Ext.Ajax.request({ Ext.Ajax.request({
url: '../pmConsolidatedCL/proxyGenerateGrid', url: '../pmConsolidatedCL/proxyGenerateGrid',
success: function(response) { success: function(response) {
//Obtenemos el column model y los reader fields de proxyGenerateGrid
var dataResponse = Ext.util.JSON.decode(response.responseText); var dataResponse = Ext.util.JSON.decode(response.responseText);
var viewConfigObject; var viewConfigObject;
var textArea = dataResponse.hasTextArea; var textArea = dataResponse.hasTextArea;
@@ -747,7 +751,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
storeConsolidated = new Ext.data.Store({ storeConsolidated = new Ext.data.Store({
id: "storeConsolidatedGrid", id: "storeConsolidatedGrid",
remoteSort: true, remoteSort: true,
//definimos un proxy como un objeto de la clase HttpProxy
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
url: "../pmConsolidatedCL/proxyConsolidated", url: "../pmConsolidatedCL/proxyConsolidated",
api: { api: {
@@ -757,7 +760,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
} }
}), }),
//el data reader obtiene los reader fields de la consulta en ajax
reader: new Ext.data.JsonReader({ reader: new Ext.data.JsonReader({
fields: dataResponse.readerFields, fields: dataResponse.readerFields,
totalProperty: "totalCount", totalProperty: "totalCount",
@@ -767,14 +769,12 @@ function generateGridClassic(proUid, tasUid, dynUid){
messageProperty: "message" 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({ writer: new Ext.data.JsonWriter({
encode: true, encode: true,
writeAllFields: false writeAllFields: false
}), //<-- plug a DataWriter into the store just as you would a Reader }), //<-- 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. 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:{ //sortInfo:{
// field: 'APP_CACHE_VIEW.APP_NUMBER', // field: 'APP_CACHE_VIEW.APP_NUMBER',
// direction: "DESC" // direction: "DESC"
@@ -803,7 +803,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
cm.config[3].renderer = renderTitle; //Case Title cm.config[3].renderer = renderTitle; //Case Title
cm.config[4].renderer = renderSummary;//Case Summary cm.config[4].renderer = renderSummary;//Case Summary
//generacion del grid basados en los atributos definidos con anterioridad
storeConsolidated.setBaseParam("limit", pager); storeConsolidated.setBaseParam("limit", pager);
storeConsolidated.setBaseParam("start", pagei); storeConsolidated.setBaseParam("start", pagei);
storeConsolidated.setBaseParam('tasUid', tasUid); storeConsolidated.setBaseParam('tasUid', tasUid);
@@ -964,21 +963,18 @@ function generateGridClassic(proUid, tasUid, dynUid){
}) })
}); });
//remocion de todos los elementos del panel principal donde se carga el grid
//Ext.ComponentMgr.get("myId").body.update(""); //Ext.ComponentMgr.get("myId").body.update("");
//pnlMain.removeAll(false); //pnlMain.removeAll(false);
pnlMain.removeAll(); pnlMain.removeAll();
//adicion del grid definido con anterioridad //adicion del grid definido con anterioridad
pnlMain.add(consolidatedGrid); pnlMain.add(consolidatedGrid);
//recarga de los elementos del grid, para su visualizacion.
pnlMain.doLayout(); pnlMain.doLayout();
}, },
//en caso de fallo ejecutar la siguiente funcion.
failure: function(){ failure: function(){
alert("Failure..."); alert("Failure...");
}, },
// parametros que son enviados en la peticion al servidor.
params: { params: {
xaction: 'read', xaction: 'read',
tasUid: tasUid, tasUid: tasUid,
@@ -1001,8 +997,6 @@ function generateGrid(proUid, tasUid, dynUid)
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
}, },
success: function(response) { 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 dataResponse = Ext.util.JSON.decode(response.responseText);
var viewConfigObject; var viewConfigObject;
var textArea = dataResponse.hasTextArea; var textArea = dataResponse.hasTextArea;
@@ -1027,7 +1021,6 @@ function generateGrid(proUid, tasUid, dynUid)
storeConsolidated = new Ext.data.Store({ storeConsolidated = new Ext.data.Store({
id: "storeConsolidatedGrid", id: "storeConsolidatedGrid",
remoteSort: true, remoteSort: true,
//definimos un proxy como un objeto de la clase HttpProxy
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
method: 'GET', method: 'GET',
url: urlProxy + 'cases/' + proUid + '/' + tasUid + '/' + dynUid, url: urlProxy + 'cases/' + proUid + '/' + tasUid + '/' + dynUid,
@@ -1046,7 +1039,6 @@ function generateGrid(proUid, tasUid, dynUid)
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
} }
}), }),
//el data reader obtiene los reader fields de la consulta en ajax
reader: new Ext.data.JsonReader({ reader: new Ext.data.JsonReader({
fields: dataResponse.readerFields, fields: dataResponse.readerFields,
totalProperty: "totalCount", totalProperty: "totalCount",
@@ -1056,20 +1048,12 @@ function generateGrid(proUid, tasUid, dynUid)
messageProperty: "message" 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({ writer: new Ext.data.JsonWriter({
encode: false, encode: false,
writeAllFields: false writeAllFields: false
}), //<-- plug a DataWriter into the store just as you would a Reader }), //<-- 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. 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: { // listeners: { //
beforeload:function (store, options) { // beforeload:function (store, options) { //
grdNumRows = 0; // grdNumRows = 0; //
@@ -1313,7 +1297,7 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridG
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
}, },
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal, url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal + '/',
success: function(response) { success: function(response) {
var dataResponse; var dataResponse;
var fullResponseText = response.responseText; var fullResponseText = response.responseText;
@@ -1333,10 +1317,8 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridG
Ext.MessageBox.show({ Ext.MessageBox.show({
title: "Derivation Result", title: "Derivation Result",
msg: htmlMessage, msg: htmlMessage,
buttons: Ext.MessageBox.OK,
fn: function (btn, text, opt) { fn: function (btn, text, opt) {
//if (btn == "ok") {}
if (maxLenght == storeConsolidated.getCount()) { if (maxLenght == storeConsolidated.getCount()) {
window.location.reload(); window.location.reload();
} }