PM-2938: I correct some issues

This commit is contained in:
Paula V. Quispe
2015-06-12 15:27:01 -04:00
parent 68d92c465b
commit 1aec306dbe
6 changed files with 406 additions and 35 deletions

View File

@@ -10,12 +10,12 @@ class Library
$criteria = new Criteria("workflow");
//SELECT
$criteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
$criteria->addSelectColumn(CaseConsolidatedCorePeer::CON_STATUS);
//FROM
//WHERE
$criteria->add(CaseConsolidatedPeer::CON_STATUS, "ACTIVE");
$criteria->add(CaseConsolidatedCorePeer::CON_STATUS, "ACTIVE");
$activeNumRec = CaseConsolidatedPeer::doCount($criteria);
$activeNumRec = CaseConsolidatedCorePeer::doCount($criteria);
//Number of records
$numRec = 0;

View File

@@ -1545,7 +1545,7 @@ class processMap
}
if ($iForm == 8) {
$oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"]);
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"]);
if ((is_object($oCaseConsolidated)) && get_class($oCaseConsolidated) == "CaseConsolidated") {
require_once ("classes/model/ReportTable.php");

View File

@@ -32,16 +32,7 @@ G::LoadTranslation('ID_NEW_CASE'), '');
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
//If plugin is active doesnot show the menu in Cases
$pluginRegistry = & PMPluginRegistry::getSingleton ();
$pluginDetail = $pluginRegistry->getPluginDetails("pmConsolidatedCL.php");
$pluginEnabled = 0;
if ($pluginDetail && $pluginDetail->enabled) {
$pluginEnabled = 1;
}
if($pluginEnabled == 0){
$G_TMP_MENU->AddIdRawOption('CONSOLIDATED_CASES', 'casesConsolidatedListExtJs?action=consolidated', 'Batch Routing', '');
}
$G_TMP_MENU->AddIdRawOption('CONSOLIDATED_CASES', 'casesConsolidatedListExtJs?action=consolidated', 'Batch Routing', '');
}
/*----------------------------------********---------------------------------*/
@@ -108,5 +99,4 @@ if (count($dashBoardPages)>0) {
ucwords(strtolower($tabName)), '');
}
}
}
}

View File

@@ -105,16 +105,31 @@ while ($rsSql->next()) {
$grdTitle = htmlentities($proTitle . " / " . $tabTitle, ENT_QUOTES, "UTF-8");
$tabTitle = htmlentities(substr($proTitle, 0, 25) . ((strlen($proTitle) > 25)? "..." : null) . " / " . $tabTitle, ENT_QUOTES, "UTF-8");
$arrayTabItem[] = "
{
title: \"<span onmouseover=\\\"toolTipTab('$grdTitle', 1);\\\" onmouseout=\\\"toolTipTab('', 0);\\\">$tabTitle</span>\",
listeners: {
activate: function ()
{
generateGrid(\"$processUid\", \"$taskUid\", \"$dynaformUid\");
$oProcess = new Process();
$isBpmn = $oProcess->isBpmnProcess($processUid);
if($isBpmn){
$arrayTabItem[] = "
{
title: \"<span onmouseover=\\\"toolTipTab('$grdTitle', 1);\\\" onmouseout=\\\"toolTipTab('', 0);\\\">$tabTitle</span>\",
listeners: {
activate: function ()
{
generateGrid(\"$processUid\", \"$taskUid\", \"$dynaformUid\");
}
}
}
}";
}";
}else{
$arrayTabItem[] = "
{
title: \"<span onmouseover=\\\"toolTipTab('$grdTitle', 1);\\\" onmouseout=\\\"toolTipTab('', 0);\\\">$tabTitle</span>\",
listeners: {
activate: function ()
{
generateGridClassic(\"$processUid\", \"$taskUid\", \"$dynaformUid\");
}
}
}";
}
}
if (count($arrayTabItem) > 0) {

View File

@@ -0,0 +1,91 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$appUid = isset($_POST["appUid"])? $_POST["appUid"] : "";
$dynUid = isset($_POST["dynUid"])? $_POST["dynUid"] : "";
$proUid = isset($_POST["proUid"])? $_POST["proUid"] : "";
$fieldName = isset($_POST["fieldName"])? $_POST["fieldName"] : "";
$filename = $proUid . PATH_SEP . $dynUid . ".xml";
$G_FORM = new xmlform();
$G_FORM->home = PATH_DYNAFORM;
$G_FORM->parseFile($filename, SYS_LANG, true);
G::LoadClass("case");
G::LoadClass("pmFunctions");
//Load the variables
$oCase = new Cases();
$sqlQuery = null;
$array = array();
$aFields = $oCase->loadCase($appUid);
foreach ($G_FORM->fields as $key => $val) {
if ($fieldName == $val->name) {
if ($G_FORM->fields[$key]->sql != null) {
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"]);
}
//$coma = "";
//$data1 = "";
if (is_array($val->options)) {
foreach ($val->options as $key1 => $val1) {
$array[] = array("value" => $key1, "text" => $val1);
}
}
}
}
//echo ($sqlQuery);
if ($sqlQuery != null) {
$aResult = executeQuery($sqlQuery);
//var_dump($aResult);
if ($aResult == "false" || $aResult == null) {
$aResult = array();
}
} else {
$aResult = array();
}
//var_dump($aResult);
$arrayTmp = array();
foreach ($aResult as $field) {
$i = 0;
foreach ($field as $key => $value) {
if ($i == 0) {
$arrayTmp["value"] = $value;
if (count($field) == 1) {
$arrayTmp["text"]=$value;
}
}
if ($i == 1) {
$arrayTmp["text"] = $value;
}
$i++;
}
$array[] = $arrayTmp;
}
//var_dump($array);
/*
if ($appUid == "5662082864d4c536a5d2a73024245754") {
$array[] = array("value"=>"BO", "text"=>"Bolivia");
$array[] = array("value"=>"US", "text"=>"USA");
$array[] = array("value"=>"AR", "text"=>"Argentina");
}
else {
$array[] = array("value"=>"EC", "text" => "Ecuador");
$array[] = array("value"=>"RU", "text" => "Rusia");
$array[] = array("value"=>"DE", "text" => "Alemania");
}
*/
$response["records"] = $array;
echo G::json_encode($response);
// echo "[" . json_encode($response) . "]";

View File

@@ -706,6 +706,279 @@ function renderSummary (val, p, r) {
return summaryIcon;
};
function generateGridClassic(proUid, tasUid, dynUid){
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
}
});
}
function generateGrid(proUid, tasUid, dynUid)
{
@@ -1055,16 +1328,18 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber){
buttons: Ext.MessageBox.OK,
fn: function (btn, text, opt) {
//if (btn == "ok") {}
if (maxLenght == storeConsolidated.getCount()) {
window.location.reload();
}
if (fullResponseText.charAt(0) != "<") {
parent.document.getElementById("batchRoutingCasesNumRec").innerHTML = parseInt(dataResponse.casesNumRec);
}
storeConsolidated.reload();
if (btn == "ok") {
if (maxLenght == storeConsolidated.getCount()) {
window.location.reload();
}
if (fullResponseText.charAt(0) != "<") {
parent.document.getElementById("batchRoutingCasesNumRec").innerHTML = parseInt(dataResponse.casesNumRec);
}
storeConsolidated.reload();
}else{
//Click in X
}
}
});
}