Merged in 3.1 (pull request #4450)
Updating branch with changes to 2016-06-23 11:35
This commit is contained in:
@@ -1599,4 +1599,57 @@ class pmDynaform
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grids and fields
|
||||
*
|
||||
* @param mixed $form
|
||||
* @param bool $flagGridAssocToVar
|
||||
*
|
||||
* @return array Return an array, FALSE otherwise
|
||||
*/
|
||||
public static function getGridsAndFields($form, $flagGridAssocToVar = true)
|
||||
{
|
||||
try {
|
||||
if (!is_object($form)) {
|
||||
//This code it runs only in the first call to the method
|
||||
$object = \ProcessMaker\Util\Common::stringToJson($form);
|
||||
|
||||
if ($object !== false) {
|
||||
$form = $object->items[0];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayGrid = [];
|
||||
|
||||
foreach ($form->items as $value) {
|
||||
foreach ($value as $value2) {
|
||||
$field = $value2;
|
||||
|
||||
if (isset($field->type)) {
|
||||
switch ($field->type) {
|
||||
case 'grid':
|
||||
$flagInsert = ($flagGridAssocToVar)? (isset($field->var_uid) && $field->var_uid != '' && isset($field->variable) && $field->variable != '') : true;
|
||||
|
||||
if ($flagInsert) {
|
||||
$arrayGrid[$field->id] = $field;
|
||||
}
|
||||
break;
|
||||
case 'form':
|
||||
$arrayGrid = array_merge(
|
||||
$arrayGrid, $this->getGridsAndFields($field, $flagGridAssocToVar)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayGrid;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,18 +611,11 @@ class ReportTables
|
||||
}
|
||||
if (! isset( $aFields[$aField['sFieldName'] . '_label'] )) {
|
||||
$aFields[$aField['sFieldName'] . '_label'] = '';
|
||||
}
|
||||
}
|
||||
if(is_array($aFields[$aField['sFieldName']])){
|
||||
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']][0] : '') . "',";
|
||||
}else{
|
||||
if (!isset($aFields[$aField['sFieldName'] . '_label'])) {
|
||||
$aFields[$aField['sFieldName'].'_label'] = '';
|
||||
}
|
||||
if($aFields[$aField['sFieldName']] == $aFields[$aField['sFieldName'].'_label']){
|
||||
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "',";
|
||||
}else{
|
||||
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aFields[$aField['sFieldName'].'_label'] ) : '') . "',";
|
||||
}
|
||||
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']]))? @mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . '\',';
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
|
||||
@@ -296,8 +296,6 @@ class Process extends BaseProcess
|
||||
|
||||
public function getAll ()
|
||||
{
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
|
||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
|
||||
@@ -320,7 +318,7 @@ class Process extends BaseProcess
|
||||
$uids = array ();
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$row['PRO_PROCESS_TYPE'] = ($bpmn->exists($row['PRO_UID']))? 'BPMN' : 'CLASSIC';
|
||||
|
||||
$processes[] = $row;
|
||||
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
||||
}
|
||||
|
||||
@@ -113,13 +113,6 @@ class pmTables extends Controller
|
||||
$this->setJSVar( '_plugin_permissions', $repTabPluginPermissions );
|
||||
$this->setJSVar( 'sizeTableName', $this->getSizeTableName());
|
||||
|
||||
$isBpmn = 0;
|
||||
if (isset( $_GET['PRO_UID'] )) {
|
||||
$process = new Process();
|
||||
$isBpmn = $process->isBpmnProcess($_GET['PRO_UID']);
|
||||
}
|
||||
$this->setJSVar( 'isBpmn', $isBpmn );
|
||||
|
||||
G::RenderPage( 'publish', 'extJs' );
|
||||
}
|
||||
|
||||
|
||||
@@ -148,28 +148,32 @@ class pmTablesProxy extends HttpProxyController
|
||||
$aFields['PRO_UID'] = $httpData->PRO_UID;
|
||||
$dynFields = array ();
|
||||
|
||||
if (isset($httpData->loadField) && $httpData->loadField) {
|
||||
unset($_SESSION['_cache_pmtables']);
|
||||
}
|
||||
|
||||
$httpData->textFilter = (isset($httpData->textFilter))? $httpData->textFilter : null;
|
||||
|
||||
if (isset( $httpData->TYPE ) && $httpData->TYPE == 'GRID') {
|
||||
$aProcessGridFields = Array ();
|
||||
if (isset( $httpData->GRID_UID )) {
|
||||
list ($gridName, $gridId) = explode( '-', $httpData->GRID_UID );
|
||||
$this->dynUid = $gridId;
|
||||
list($gridId, $dynaFormUid) = explode('-', $httpData->GRID_UID);
|
||||
|
||||
$httpData->textFilter = isset( $httpData->textFilter ) ? $httpData->textFilter : null;
|
||||
$dynFields = $this->_getDynafields( $aFields['PRO_UID'], 'grid', $httpData->start, $httpData->limit, $httpData->textFilter );
|
||||
$this->dynUid = $dynaFormUid;
|
||||
$this->gridId = $gridId;
|
||||
|
||||
$dynFields = $this->_getDynafields($aFields['PRO_UID'], 'grid', $httpData->start, $httpData->limit, $httpData->textFilter);
|
||||
} else {
|
||||
if (isset( $_SESSION['_cache_pmtables'] )) {
|
||||
unset( $_SESSION['_cache_pmtables'] );
|
||||
}
|
||||
$gridFields = $this->_getGridFields( $aFields['PRO_UID'] );
|
||||
$gridFields = $this->_getGridFields($aFields['PRO_UID']);
|
||||
|
||||
foreach ($gridFields as $gfield) {
|
||||
$dynFields[] = array ('FIELD_UID' => $gfield['name'] . '-' . $gfield['xmlform'],'FIELD_NAME' => $gfield['name']
|
||||
);
|
||||
foreach ($gridFields as $value) {
|
||||
$dynFields[] = [
|
||||
'FIELD_UID' => $value['gridId'] . '-' . $value['uid'],
|
||||
'FIELD_NAME' => $value['gridName']
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// normal dynaform
|
||||
$httpData->textFilter = isset( $httpData->textFilter ) ? $httpData->textFilter : null;
|
||||
$dynFields = $this->_getDynafields( $aFields['PRO_UID'], 'xmlform', $httpData->start, $httpData->limit, $httpData->textFilter );
|
||||
}
|
||||
|
||||
@@ -1240,6 +1244,8 @@ class pmTablesProxy extends HttpProxyController
|
||||
|
||||
public function _getDynafields ($proUid, $type = 'xmlform', $start = null, $limit = null, $filter = null)
|
||||
{
|
||||
G::LoadClass('pmDynaform');
|
||||
|
||||
$cache = 1;
|
||||
if (! isset( $_SESSION['_cache_pmtables'] ) || (isset( $_SESSION['_cache_pmtables'] ) && $_SESSION['_cache_pmtables']['pro_uid'] != $proUid) || (isset( $_SESSION['_cache_pmtables'] ) && $_SESSION['_cache_pmtables']['dyn_uid'] != $this->dynUid)) {
|
||||
|
||||
@@ -1306,67 +1312,139 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
|
||||
// getting bpmn projects
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(BpmnProcessPeer::PRJ_UID);
|
||||
$oCriteria->add(BpmnProcessPeer::PRJ_UID, $proUid);
|
||||
$oDataset = BpmnProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
if (isset($row["PRJ_UID"])) {
|
||||
$sProcessUID = $row["PRJ_UID"];
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
|
||||
$arrayDataTypeToExclude = array("array", "grid");
|
||||
$arrayTypeToExclude = array("title", "subtitle", "link", "file", "button", "reset", "submit", "listbox", "grid", "array", "javascript", "location", "scannerCode");
|
||||
if ($bpmn->exists($proUid)) {
|
||||
switch ($type) {
|
||||
case 'xmlform':
|
||||
$arrayDataTypeToExclude = ['array', 'grid'];
|
||||
$arrayTypeToExclude = ['title', 'subtitle', 'link', 'file', 'button', 'reset', 'submit', 'listbox', 'grid', 'array', 'javascript', 'location', 'scannerCode'];
|
||||
|
||||
$arrayControlSupported = array();
|
||||
$arrayControlSupported = [];
|
||||
|
||||
$dynaformAllControl = $this->getDynaformVariables($sProcessUID, $arrayTypeToExclude, true, "DATA");
|
||||
$dynaformAllControl = $this->getDynaformVariables($proUid, $arrayTypeToExclude, true, 'DATA');
|
||||
|
||||
foreach ($dynaformAllControl as $value) {
|
||||
$arrayControl = array_change_key_case($value, CASE_UPPER);
|
||||
foreach ($dynaformAllControl as $value) {
|
||||
$arrayControl = array_change_key_case($value, CASE_UPPER);
|
||||
|
||||
if(isset($arrayControl["DATATYPE"]) && isset($arrayControl["TYPE"])){
|
||||
if (!in_array($arrayControl["DATATYPE"], $arrayDataTypeToExclude) && !in_array($arrayControl["TYPE"], $arrayTypeToExclude)) {
|
||||
$arrayControlSupported[$arrayControl["VAR_UID"]] = $arrayControl["TYPE"];
|
||||
if (isset($arrayControl['DATATYPE']) && isset($arrayControl['TYPE'])) {
|
||||
if (!in_array($arrayControl['DATATYPE'], $arrayDataTypeToExclude) &&
|
||||
!in_array($arrayControl['TYPE'], $arrayTypeToExclude)
|
||||
) {
|
||||
$arrayControlSupported[$arrayControl['VAR_UID']] = $arrayControl['TYPE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$arrayTypeToExclude,false);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
|
||||
$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();
|
||||
if(!in_array($row["VAR_NAME"], $dynaformNotAllowedVariables) && !in_array($row["VAR_FIELD_TYPE"], $arrayTypeToExclude) && !in_array($row["VAR_NAME"], $fieldsNames)) {
|
||||
array_push($fields, array(
|
||||
"FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
|
||||
"FIELD_NAME" => $row["VAR_NAME"],
|
||||
"FIELD_VALIDATE" => "any",
|
||||
"_index" => $index ++,
|
||||
"_isset" => true
|
||||
));
|
||||
}
|
||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($proUid, $arrayTypeToExclude, false);
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"]);
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
if (isset($arrayControlSupported[$row["VAR_UID"]]) && !in_array($row["VAR_NAME"] . "_label", $fieldsNames)) {
|
||||
array_push($fields, array(
|
||||
"FIELD_UID" => $row["VAR_NAME"] . "_label-" . $arrayControlSupported[$row["VAR_UID"]],
|
||||
"FIELD_NAME" => $row["VAR_NAME"] . "_label",
|
||||
"FIELD_VALIDATE" => "any",
|
||||
"_index" => $index++,
|
||||
"_isset" => true
|
||||
));
|
||||
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
|
||||
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
||||
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
|
||||
$criteria->add(ProcessVariablesPeer::PRJ_UID, $proUid, Criteria::EQUAL);
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"] . "_label");
|
||||
}
|
||||
$rsCriteria = ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$index = 0;
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$record = $rsCriteria->getRow();
|
||||
|
||||
if (!in_array($record['VAR_NAME'], $dynaformNotAllowedVariables) &&
|
||||
!in_array($record['VAR_FIELD_TYPE'], $arrayTypeToExclude) &&
|
||||
!in_array($record['VAR_NAME'], $fieldsNames)
|
||||
) {
|
||||
$fields[] = [
|
||||
'FIELD_UID' => $record['VAR_NAME'] . '-' . $record['VAR_FIELD_TYPE'],
|
||||
'FIELD_NAME' => $record['VAR_NAME'],
|
||||
'FIELD_VALIDATE' => 'any',
|
||||
'_index' => $index++,
|
||||
'_isset' => true
|
||||
];
|
||||
|
||||
$fieldsNames[] = $record['VAR_NAME'];
|
||||
}
|
||||
|
||||
if (isset($arrayControlSupported[$record['VAR_UID']]) &&
|
||||
!in_array($record['VAR_NAME'] . '_label', $fieldsNames)
|
||||
) {
|
||||
$fields[] = [
|
||||
'FIELD_UID' => $record['VAR_NAME'] . '_label' . '-' . $arrayControlSupported[$record['VAR_UID']],
|
||||
'FIELD_NAME' => $record['VAR_NAME'] . '_label',
|
||||
'FIELD_VALIDATE' => 'any',
|
||||
'_index' => $index++,
|
||||
'_isset' => true
|
||||
];
|
||||
|
||||
$fieldsNames[] = $record['VAR_NAME'] . '_label';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'grid':
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
|
||||
$dynaFormUid = $this->dynUid;
|
||||
$gridId = $this->gridId;
|
||||
|
||||
$arrayDynaFormData = $dynaForm->getDynaFormRecordByPk($dynaFormUid, [], false);
|
||||
|
||||
if ($arrayDynaFormData !== false) {
|
||||
$arrayGrid = pmDynaform::getGridsAndFields($arrayDynaFormData['DYN_CONTENT']);
|
||||
|
||||
if ($arrayGrid !== false && isset($arrayGrid[$gridId])) {
|
||||
$grid = $arrayGrid[$gridId];
|
||||
|
||||
$arrayValidTypes = [
|
||||
'text' => ['type' => 'text', 'label' => false],
|
||||
'textarea' => ['type' => 'textarea', 'label' => false],
|
||||
'dropdown' => ['type' => 'dropdown', 'label' => true],
|
||||
'checkbox' => ['type' => 'checkbox', 'label' => false],
|
||||
'datetime' => ['type' => 'date', 'label' => false],
|
||||
'suggest' => ['type' => 'suggest', 'label' => false],
|
||||
'hidden' => ['type' => 'hidden', 'label' => false]
|
||||
];
|
||||
|
||||
$index = 0;
|
||||
|
||||
foreach ($grid->columns as $value) {
|
||||
$field = $value;
|
||||
|
||||
if (isset($field->type) && isset($arrayValidTypes[$field->type]) &&
|
||||
isset($field->id) && $field->id != '' && isset($field->name) && $field->name != ''
|
||||
) {
|
||||
if (!in_array($field->id, $fieldsNames)) {
|
||||
$fields[] = [
|
||||
'FIELD_UID' => $field->id . '-' . $arrayValidTypes[$field->type]['type'],
|
||||
'FIELD_NAME' => $field->id,
|
||||
'FIELD_VALIDATE' => 'any',
|
||||
'_index' => $index++,
|
||||
'_isset' => true
|
||||
];
|
||||
|
||||
$fieldsNames[] = $field->id;
|
||||
}
|
||||
|
||||
if ($arrayValidTypes[$field->type]['label'] &&
|
||||
!in_array($field->id . '_label', $fieldsNames)
|
||||
) {
|
||||
$fields[] = [
|
||||
'FIELD_UID' => $field->id . '_label' . '-' . $arrayValidTypes[$field->type]['type'],
|
||||
'FIELD_NAME' => $field->id . '_label',
|
||||
'FIELD_VALIDATE' => 'any',
|
||||
'_index' => $index++,
|
||||
'_isset' => true
|
||||
];
|
||||
|
||||
$fieldsNames[] = $field->id . '_label';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,42 +1546,82 @@ class pmTablesProxy extends HttpProxyController
|
||||
*/
|
||||
public function _getGridFields ($proUid)
|
||||
{
|
||||
require_once 'classes/model/Dynaform.php';
|
||||
G::loadSystem( 'dynaformhandler' );
|
||||
$aFields = array ();
|
||||
$aFieldsNames = array ();
|
||||
try {
|
||||
G::LoadClass('pmDynaform');
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
|
||||
$oCriteria->add( DynaformPeer::PRO_UID, $proUid );
|
||||
$oCriteria->add( DynaformPeer::DYN_TYPE, 'xmlform' );
|
||||
$oDataset = DynaformPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
$flagIsBpmn = $bpmn->exists($proUid);
|
||||
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
//$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
|
||||
$dynaformHandler = new dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
|
||||
$nodeFieldsList = $dynaformHandler->getFields();
|
||||
$arrayField = [];
|
||||
$arrayFieldName = [];
|
||||
|
||||
foreach ($nodeFieldsList as $node) {
|
||||
$arrayNode = $dynaformHandler->getArray( $node );
|
||||
$fieldName = $arrayNode['__nodeName__'];
|
||||
$fieldType = $arrayNode['type'];
|
||||
$delimiter = DBAdapter::getStringDelimiter();
|
||||
|
||||
if ($fieldType == 'grid') {
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
if (! in_array( $fieldName, $aFieldsNames )) {
|
||||
$aFields[] = array ('name' => $fieldName,'xmlform' => str_replace( $proUid . '/', '', $arrayNode['xmlgrid'] )
|
||||
);
|
||||
$aFieldsNames[] = $fieldName;
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$criteria->addSelectColumn(ContentPeer::CON_VALUE . ' AS DYN_TITLE');
|
||||
|
||||
$arrayCondition = [];
|
||||
$arrayCondition[] = [DynaformPeer::DYN_UID, ContentPeer::CON_ID, Criteria::EQUAL];
|
||||
$arrayCondition[] = [ContentPeer::CON_CATEGORY, $delimiter . 'DYN_TITLE' . $delimiter, Criteria::EQUAL];
|
||||
$arrayCondition[] = [ContentPeer::CON_LANG, $delimiter . SYS_LANG . $delimiter, Criteria::EQUAL];
|
||||
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||
|
||||
$criteria->add(DynaformPeer::PRO_UID, $proUid, Criteria::EQUAL);
|
||||
$criteria->add(DynaformPeer::DYN_TYPE, 'xmlform', Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = DynaformPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$record = $rsCriteria->getRow();
|
||||
|
||||
if ($flagIsBpmn) {
|
||||
$arrayGrid = pmDynaform::getGridsAndFields($record['DYN_CONTENT']);
|
||||
|
||||
if ($arrayGrid !== false) {
|
||||
foreach ($arrayGrid as $value) {
|
||||
$grid = $value;
|
||||
|
||||
$arrayField[] = [
|
||||
'uid' => $record['DYN_UID'], //dynaFormUid
|
||||
'gridId' => $grid->id,
|
||||
'gridName' => $grid->id . ' (' . $record['DYN_TITLE'] . ')'
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$dynaformHandler = new dynaformHandler(PATH_DYNAFORM . $record['DYN_FILENAME'] . '.xml');
|
||||
$nodeFieldsList = $dynaformHandler->getFields();
|
||||
|
||||
foreach ($nodeFieldsList as $node) {
|
||||
$arrayNode = $dynaformHandler->getArray($node);
|
||||
$fieldName = $arrayNode['__nodeName__'];
|
||||
$fieldType = $arrayNode['type'];
|
||||
|
||||
if ($fieldType == 'grid') {
|
||||
if (!in_array($fieldName, $arrayFieldName)) {
|
||||
$arrayField[] = [
|
||||
'uid' => str_replace($proUid . '/', '', $arrayNode['xmlgrid']), //dynaFormUid (Grid)
|
||||
'gridId' => $fieldName,
|
||||
'gridName' => $fieldName
|
||||
];
|
||||
|
||||
$arrayFieldName[] = $fieldName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oDataset->next();
|
||||
//Return
|
||||
return $arrayField;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
return $aFields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,5 +136,23 @@ class Common extends \Maveriks\Util\Common
|
||||
|
||||
return $sCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string to JSON
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return object Returns an object, FALSE otherwise
|
||||
*/
|
||||
public static function stringToJson($string)
|
||||
{
|
||||
try {
|
||||
$object = json_decode($string);
|
||||
|
||||
return (json_last_error() == JSON_ERROR_NONE)? $object : false;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,21 @@ Ext.onReady(function(){
|
||||
]
|
||||
}),
|
||||
listeners: {
|
||||
beforeload: function (store, options)
|
||||
{
|
||||
var p = {PRO_UID: (PRO_UID !== false)? PRO_UID : Ext.getCmp("PROCESS").getValue()};
|
||||
|
||||
if (Ext.getCmp("REP_TAB_TYPE").getValue() == "GRID" && Ext.getCmp("REP_TAB_GRID").getValue() != "") {
|
||||
p.TYPE = "GRID";
|
||||
p.GRID_UID = Ext.getCmp("REP_TAB_GRID").getValue();
|
||||
}
|
||||
|
||||
if (Ext.getCmp("searchTxt").getValue() != "") {
|
||||
p.textFilter = Ext.getCmp("searchTxt").getValue();
|
||||
}
|
||||
|
||||
this.baseParams = p;
|
||||
},
|
||||
load: function() {
|
||||
Ext.getCmp('availableGrid').store.sort();
|
||||
storeA.setBaseParam('PRO_UID', (PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue()));
|
||||
@@ -721,9 +736,6 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
}
|
||||
});
|
||||
|
||||
var arrayBpmnTypeData = [["NORMAL", _("ID_GLOBAL")]];
|
||||
var arrayClassicTypeData = [["NORMAL", _("ID_GLOBAL")], ["GRID", _("ID_GRID")]];
|
||||
|
||||
var types = new Ext.data.ArrayStore({
|
||||
storeId: "types",
|
||||
autoDestroy: true,
|
||||
@@ -866,7 +878,7 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
valueField : 'FIELD_UID',
|
||||
displayField : 'FIELD_NAME',
|
||||
triggerAction : 'all',
|
||||
width: 120,
|
||||
width: 200,
|
||||
editable : false,
|
||||
mode:'local',
|
||||
listeners:{
|
||||
@@ -884,8 +896,6 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
}
|
||||
});
|
||||
|
||||
comboReport.setDisabled(isBpmn);
|
||||
|
||||
processStore = new Ext.data.Store( {
|
||||
autoLoad: true,
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
@@ -896,7 +906,7 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
action: 'getProcessList'
|
||||
},
|
||||
reader : new Ext.data.JsonReader( {
|
||||
fields : [{name : 'PRO_UID'}, {name : 'PRO_TITLE'},{name : 'PRO_DESCRIPTION'}, {name: "PRO_PROCESS_TYPE"}]
|
||||
fields: [{name: "PRO_UID"}, {name: "PRO_TITLE"}, {name: "PRO_DESCRIPTION"}]
|
||||
}),
|
||||
listeners: {
|
||||
load: function() {
|
||||
@@ -940,7 +950,6 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
}
|
||||
});
|
||||
|
||||
var rptPosArray = 0;
|
||||
processComboBox = new Ext.form.ComboBox({
|
||||
id: 'PROCESS',
|
||||
fieldLabel : _("ID_CASESLIST_APP_PRO_TITLE"),
|
||||
@@ -960,21 +969,11 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
|
||||
listeners:{
|
||||
select: function(){
|
||||
var dataStore = Ext.getCmp('PROCESS').store.getRange();
|
||||
var i = Ext.getCmp('PROCESS').store.find("PRO_UID", Ext.getCmp('PROCESS').getValue());
|
||||
var dataStoreAux = types.getRange(0);
|
||||
comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE);
|
||||
comboGridsList.setVisible(false);
|
||||
|
||||
types.loadData(
|
||||
(dataStore[i].data.PRO_PROCESS_TYPE == "BPMN")? arrayBpmnTypeData : arrayClassicTypeData, false
|
||||
);
|
||||
|
||||
var dataStoreAux = types.getRange(rptPosArray);
|
||||
|
||||
comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE);
|
||||
comboReport.setDisabled(dataStore[i].data.PRO_PROCESS_TYPE === "BPMN");
|
||||
|
||||
comboGridsList.setVisible(false);
|
||||
|
||||
comboDbConnections.getStore().reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
||||
comboDbConnections.getStore().reload({params: {PRO_UID: Ext.getCmp("PROCESS").getValue()}});
|
||||
if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') {
|
||||
gridsListStore.reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
||||
} else {
|
||||
@@ -1409,7 +1408,8 @@ loadFieldNormal = function(){
|
||||
action: "getDynafields",
|
||||
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||
start: 0,
|
||||
limit: pageSize
|
||||
limit: pageSize,
|
||||
loadField: 1
|
||||
}
|
||||
});
|
||||
var assignedGridGotData = Ext.getCmp('assignedGrid').getStore().getCount() > 0;
|
||||
@@ -1433,7 +1433,8 @@ loadFieldsGrids = function(){
|
||||
TYPE: 'GRID',
|
||||
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(),
|
||||
start: 0,
|
||||
limit: pageSize
|
||||
limit: pageSize,
|
||||
loadField: 1
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1538,8 +1539,10 @@ function setReportFields(records) {
|
||||
isset : false
|
||||
},
|
||||
success: function(resp){
|
||||
result = Ext.util.JSON.decode(resp.responseText);
|
||||
availableGrid.store.reload();
|
||||
result = Ext.util.JSON.decode(resp.responseText);
|
||||
|
||||
availableGrid.store.lastOptions.params.loadField = 0;
|
||||
availableGrid.store.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1603,8 +1606,10 @@ function unsetReportFields(records) {
|
||||
isset : true
|
||||
},
|
||||
success: function(resp){
|
||||
result = Ext.util.JSON.decode(resp.responseText);
|
||||
availableGrid.store.reload();
|
||||
result = Ext.util.JSON.decode(resp.responseText);
|
||||
|
||||
availableGrid.store.lastOptions.params.loadField = 0;
|
||||
availableGrid.store.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user