Merge remote branch 'upstream/3.0.1-GA' into 3.0.1-GA
This commit is contained in:
@@ -596,7 +596,7 @@ abstract class PreparedStatementCommon {
|
||||
if ( is_object ( $value ) ) {
|
||||
$this->boundInVars[$paramIndex] = "'" . $this->escape($value->__toString()) . "'";
|
||||
} else {
|
||||
$this->boundInVars[$paramIndex] = "'" . $this->escape((string)$value) . "'";
|
||||
@$this->boundInVars[$paramIndex] = "'" . $this->escape((string)$value) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,13 @@ 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;
|
||||
foreach ($value as $val) {
|
||||
if(isset($val->type)){
|
||||
if ($val->type == 'text' || $val->type == 'textarea' || $val->type == 'dropdown' || $val->type == 'checkbox' || $val->type == 'datetime' || $val->type == 'yesno' || $val->type == 'date' || $val->type == 'hidden' || $val->type == 'currency' || $val->type == 'percentage' || $val->type == 'link'){
|
||||
$_POST['form']['FIELDS'][] = $val->name . '-' . $val->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aFieldsClases = array();
|
||||
@@ -186,6 +192,11 @@ class ConsolidatedCases
|
||||
$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);
|
||||
|
||||
@@ -1656,7 +1656,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
|
||||
$excludeFieldsList = array ('title','subtitle','link','file','button','reset','submit','listbox','checkgroup','grid','javascript', ''
|
||||
$excludeFieldsList = array ('title','subtitle','link','file','button','reset','submit','listbox','checkgroup','grid','javascript','location','scannerCode','array'
|
||||
);
|
||||
|
||||
$labelFieldsTypeList = array ('dropdown','radiogroup');
|
||||
@@ -1709,23 +1709,19 @@ class pmTablesProxy extends HttpProxyController
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
if (isset($row["PRJ_UID"])) {
|
||||
$sProcessUID = $row["PRJ_UID"];
|
||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$excludeFieldsList,false);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_SQL);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
|
||||
$oCriteria->add(ProcessVariablesPeer::PRJ_UID, $row["PRJ_UID"]);
|
||||
$oDataset = ProcessVariablesPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = 0;
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$fieldType = isset($row["VAR_FIELD_TYPE"]) ? $row["VAR_FIELD_TYPE"]: '';
|
||||
$varSql = isset($row["VAR_SQL"]) ? $row["VAR_SQL"] : '';
|
||||
$varProcessVariable = isset($row["VAR_ACCEPTED_VALUES"]) ? $row["VAR_ACCEPTED_VALUES"] : '[]';
|
||||
if(! in_array( $fieldType, $excludeFieldsList )){
|
||||
if(strlen($varSql) == 0 && $varProcessVariable == '[]'){
|
||||
if(!in_array($row["VAR_NAME"], $dynaformNotAllowedVariables) && !in_array($row["VAR_FIELD_TYPE"], $excludeFieldsList)) {
|
||||
array_push($fields, array(
|
||||
"FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
|
||||
"FIELD_NAME" => $row["VAR_NAME"],
|
||||
@@ -1736,7 +1732,6 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sort( $fields );
|
||||
|
||||
@@ -1873,5 +1868,50 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
return $aFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all dynaform variables
|
||||
*
|
||||
* @param $sProcessUID
|
||||
*/
|
||||
public function getDynaformVariables($sProcessUID,$excludeFieldsList,$allowed = true)
|
||||
{
|
||||
$dynaformVariables = array();
|
||||
$oC = new Criteria( 'workflow' );
|
||||
$oC->addSelectColumn( DynaformPeer::DYN_CONTENT );
|
||||
$oC->add( DynaformPeer::PRO_UID, $sProcessUID );
|
||||
$oData = DynaformPeer::doSelectRS( $oC );
|
||||
$oData->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oData->next();
|
||||
while ($aRowd = $oData->getRow()) {
|
||||
$dynaform = G::json_decode($aRowd['DYN_CONTENT'],true);
|
||||
if(is_array($dynaform) && sizeof($dynaform)) {
|
||||
$items = $dynaform['items'][0]['items'];
|
||||
foreach($items as $key => $val){
|
||||
foreach($val as $column) {
|
||||
if($allowed) {
|
||||
if(!in_array( $column['type'], $excludeFieldsList )){
|
||||
if(array_key_exists('variable',$column)) {
|
||||
if($column['variable'] != "") {
|
||||
$dynaformVariables[] = $column['variable'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(in_array( $column['type'], $excludeFieldsList )){
|
||||
if(array_key_exists('variable',$column)) {
|
||||
if($column['variable'] != "") {
|
||||
$dynaformVariables[] = $column['variable'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$oData->next();
|
||||
}
|
||||
return array_unique($dynaformVariables);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,21 +467,26 @@ class Consolidated
|
||||
$xmlfrm = new \stdclass();
|
||||
$xmlfrm->fields = array();
|
||||
foreach ($fieldsDyna as $key => $value) {
|
||||
if ($value[0]->type == 'title' || $value[0]->type == 'submit') {
|
||||
foreach ($value as $val) {
|
||||
if ($val->type == 'title' || $val->type == 'submit' || $val->type == 'panel' || $val->type == 'image' || $val->type == 'button' || $val->type == 'grid' || $val->type == 'checkgroup' || $val->type == 'radiogroup' || $val->type == 'radio' || $val->type == 'hidden' || $val->type == 'link' || $val->type == 'file' || $val->type == 'subform' || $val->type == 'label') {
|
||||
continue;
|
||||
}
|
||||
$temp = new \stdclass();
|
||||
$temp->type = $value[0]->type;
|
||||
$temp->label = $value[0]->label;
|
||||
$temp->name = $value[0]->name;
|
||||
$temp->required = (isset($value[0]->required)) ? $value[0]->required : 0;
|
||||
$temp->mode = (isset($value[0]->mode)) ? $value[0]->mode : 'edit';
|
||||
$temp->type = $val->type;
|
||||
$temp->label = $val->label;
|
||||
$temp->name = $val->name;
|
||||
$temp->required = (isset($val->required)) ? $val->required : 0;
|
||||
$temp->mode = (isset($val->mode)) ? $val->mode : 'edit';
|
||||
|
||||
if (!empty($value[0]->options)) {
|
||||
if (!empty($val->options)) {
|
||||
$temp->storeData = '[';
|
||||
foreach ($value[0]->options as $valueOption) {
|
||||
foreach ($val->options as $valueOption) {
|
||||
if(isset($valueOption->value)){
|
||||
$temp->storeData .= '["' . $valueOption->value . '", "' . $valueOption->label . '"],';
|
||||
}else{
|
||||
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
|
||||
}
|
||||
}
|
||||
$temp->storeData = substr($temp->storeData,0,-1);
|
||||
$temp->storeData .= ']';
|
||||
}
|
||||
@@ -488,6 +495,7 @@ class Consolidated
|
||||
$temp->colWidth = 200;
|
||||
$xmlfrm->fields[] = $temp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
|
||||
if (!class_exists('Smarty')) {
|
||||
@@ -528,12 +536,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 +641,7 @@ class Consolidated
|
||||
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
|
||||
} *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
if ($field->mode == "view") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
@@ -735,6 +743,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;
|
||||
|
||||
@@ -468,6 +468,12 @@ class FilesManager
|
||||
|
||||
if (file_exists($path) && !is_dir($path)) {
|
||||
unlink($path);
|
||||
} else {
|
||||
$path = PATH_DATA_PUBLIC.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
|
||||
|
||||
if (file_exists($path) && !is_dir($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
$rs = \ProcessFilesPeer::doDelete($criteria);
|
||||
|
||||
@@ -406,6 +406,9 @@ Ext.onReady(function () {
|
||||
text: "Derivate",
|
||||
//iconCls: 'ICON_CASES_PAUSED',
|
||||
handler : function (){
|
||||
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;
|
||||
@@ -418,11 +421,13 @@ Ext.onReady(function () {
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
switch(action){
|
||||
case 'consolidated':
|
||||
@@ -721,7 +726,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
|
||||
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;
|
||||
@@ -747,7 +751,6 @@ function generateGridClassic(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({
|
||||
url: "../pmConsolidatedCL/proxyConsolidated",
|
||||
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({
|
||||
fields: dataResponse.readerFields,
|
||||
totalProperty: "totalCount",
|
||||
@@ -767,14 +769,12 @@ function generateGridClassic(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: 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"
|
||||
@@ -803,7 +803,6 @@ function generateGridClassic(proUid, tasUid, dynUid){
|
||||
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);
|
||||
@@ -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("");
|
||||
//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,
|
||||
@@ -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; //
|
||||
@@ -1313,7 +1297,7 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridG
|
||||
'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