@@ -1599,4 +1599,57 @@ class pmDynaform
|
|||||||
return (string) $value;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,8 +340,6 @@ class Process extends BaseProcess
|
|||||||
|
|
||||||
public function getAll ()
|
public function getAll ()
|
||||||
{
|
{
|
||||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
|
||||||
|
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
|
|
||||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
|
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
|
||||||
@@ -362,7 +360,7 @@ class Process extends BaseProcess
|
|||||||
$uids = array ();
|
$uids = array ();
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$row = $oDataset->getRow();
|
$row = $oDataset->getRow();
|
||||||
$row['PRO_PROCESS_TYPE'] = ($bpmn->exists($row['PRO_UID']))? 'BPMN' : 'CLASSIC';
|
|
||||||
$processes[] = $row;
|
$processes[] = $row;
|
||||||
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,13 +113,6 @@ class pmTables extends Controller
|
|||||||
$this->setJSVar( '_plugin_permissions', $repTabPluginPermissions );
|
$this->setJSVar( '_plugin_permissions', $repTabPluginPermissions );
|
||||||
$this->setJSVar( 'sizeTableName', $this->getSizeTableName());
|
$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' );
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,28 +148,32 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$aFields['PRO_UID'] = $httpData->PRO_UID;
|
$aFields['PRO_UID'] = $httpData->PRO_UID;
|
||||||
$dynFields = array ();
|
$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') {
|
if (isset( $httpData->TYPE ) && $httpData->TYPE == 'GRID') {
|
||||||
$aProcessGridFields = Array ();
|
|
||||||
if (isset( $httpData->GRID_UID )) {
|
if (isset( $httpData->GRID_UID )) {
|
||||||
list ($gridName, $gridId) = explode( '-', $httpData->GRID_UID );
|
list($gridId, $dynaFormUid) = explode('-', $httpData->GRID_UID);
|
||||||
$this->dynUid = $gridId;
|
|
||||||
|
|
||||||
$httpData->textFilter = isset( $httpData->textFilter ) ? $httpData->textFilter : null;
|
$this->dynUid = $dynaFormUid;
|
||||||
$dynFields = $this->_getDynafields( $aFields['PRO_UID'], 'grid', $httpData->start, $httpData->limit, $httpData->textFilter );
|
$this->gridId = $gridId;
|
||||||
|
|
||||||
|
$dynFields = $this->_getDynafields($aFields['PRO_UID'], 'grid', $httpData->start, $httpData->limit, $httpData->textFilter);
|
||||||
} else {
|
} else {
|
||||||
if (isset( $_SESSION['_cache_pmtables'] )) {
|
$gridFields = $this->_getGridFields($aFields['PRO_UID']);
|
||||||
unset( $_SESSION['_cache_pmtables'] );
|
|
||||||
}
|
|
||||||
$gridFields = $this->_getGridFields( $aFields['PRO_UID'] );
|
|
||||||
|
|
||||||
foreach ($gridFields as $gfield) {
|
foreach ($gridFields as $value) {
|
||||||
$dynFields[] = array ('FIELD_UID' => $gfield['name'] . '-' . $gfield['xmlform'],'FIELD_NAME' => $gfield['name']
|
$dynFields[] = [
|
||||||
);
|
'FIELD_UID' => $value['gridId'] . '-' . $value['uid'],
|
||||||
|
'FIELD_NAME' => $value['gridName']
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// normal dynaform
|
// normal dynaform
|
||||||
$httpData->textFilter = isset( $httpData->textFilter ) ? $httpData->textFilter : null;
|
|
||||||
$dynFields = $this->_getDynafields( $aFields['PRO_UID'], 'xmlform', $httpData->start, $httpData->limit, $httpData->textFilter );
|
$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)
|
public function _getDynafields ($proUid, $type = 'xmlform', $start = null, $limit = null, $filter = null)
|
||||||
{
|
{
|
||||||
|
G::LoadClass('pmDynaform');
|
||||||
|
|
||||||
$cache = 1;
|
$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)) {
|
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
|
// getting bpmn projects
|
||||||
$oCriteria = new Criteria('workflow');
|
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||||
$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"];
|
|
||||||
|
|
||||||
$arrayDataTypeToExclude = array("array", "grid");
|
if ($bpmn->exists($proUid)) {
|
||||||
$arrayTypeToExclude = array("title", "subtitle", "link", "file", "button", "reset", "submit", "listbox", "grid", "array", "javascript", "location", "scannerCode");
|
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) {
|
foreach ($dynaformAllControl as $value) {
|
||||||
$arrayControl = array_change_key_case($value, CASE_UPPER);
|
$arrayControl = array_change_key_case($value, CASE_UPPER);
|
||||||
|
|
||||||
if(isset($arrayControl["DATATYPE"]) && isset($arrayControl["TYPE"])){
|
if (isset($arrayControl['DATATYPE']) && isset($arrayControl['TYPE'])) {
|
||||||
if (!in_array($arrayControl["DATATYPE"], $arrayDataTypeToExclude) && !in_array($arrayControl["TYPE"], $arrayTypeToExclude)) {
|
if (!in_array($arrayControl['DATATYPE'], $arrayDataTypeToExclude) &&
|
||||||
$arrayControlSupported[$arrayControl["VAR_UID"]] = $arrayControl["TYPE"];
|
!in_array($arrayControl['TYPE'], $arrayTypeToExclude)
|
||||||
|
) {
|
||||||
|
$arrayControlSupported[$arrayControl['VAR_UID']] = $arrayControl['TYPE'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$arrayTypeToExclude,false);
|
$dynaformNotAllowedVariables = $this->getDynaformVariables($proUid, $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
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($fieldsNames, $row["VAR_NAME"]);
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
if (isset($arrayControlSupported[$row["VAR_UID"]]) && !in_array($row["VAR_NAME"] . "_label", $fieldsNames)) {
|
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
|
||||||
array_push($fields, array(
|
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
||||||
"FIELD_UID" => $row["VAR_NAME"] . "_label-" . $arrayControlSupported[$row["VAR_UID"]],
|
$criteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
|
||||||
"FIELD_NAME" => $row["VAR_NAME"] . "_label",
|
$criteria->add(ProcessVariablesPeer::PRJ_UID, $proUid, Criteria::EQUAL);
|
||||||
"FIELD_VALIDATE" => "any",
|
|
||||||
"_index" => $index++,
|
|
||||||
"_isset" => true
|
|
||||||
));
|
|
||||||
|
|
||||||
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)
|
public function _getGridFields ($proUid)
|
||||||
{
|
{
|
||||||
require_once 'classes/model/Dynaform.php';
|
try {
|
||||||
G::loadSystem( 'dynaformhandler' );
|
G::LoadClass('pmDynaform');
|
||||||
$aFields = array ();
|
|
||||||
$aFieldsNames = array ();
|
|
||||||
|
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||||
$oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
|
$flagIsBpmn = $bpmn->exists($proUid);
|
||||||
$oCriteria->add( DynaformPeer::PRO_UID, $proUid );
|
|
||||||
$oCriteria->add( DynaformPeer::DYN_TYPE, 'xmlform' );
|
|
||||||
$oDataset = DynaformPeer::doSelectRS( $oCriteria );
|
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
|
||||||
$oDataset->next();
|
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
$arrayField = [];
|
||||||
//$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
|
$arrayFieldName = [];
|
||||||
$dynaformHandler = new dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
|
|
||||||
$nodeFieldsList = $dynaformHandler->getFields();
|
|
||||||
|
|
||||||
foreach ($nodeFieldsList as $node) {
|
$delimiter = DBAdapter::getStringDelimiter();
|
||||||
$arrayNode = $dynaformHandler->getArray( $node );
|
|
||||||
$fieldName = $arrayNode['__nodeName__'];
|
|
||||||
$fieldType = $arrayNode['type'];
|
|
||||||
|
|
||||||
if ($fieldType == 'grid') {
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
if (! in_array( $fieldName, $aFieldsNames )) {
|
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||||
$aFields[] = array ('name' => $fieldName,'xmlform' => str_replace( $proUid . '/', '', $arrayNode['xmlgrid'] )
|
$criteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
|
||||||
);
|
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||||
$aFieldsNames[] = $fieldName;
|
$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;
|
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: {
|
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() {
|
load: function() {
|
||||||
Ext.getCmp('availableGrid').store.sort();
|
Ext.getCmp('availableGrid').store.sort();
|
||||||
storeA.setBaseParam('PRO_UID', (PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue()));
|
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({
|
var types = new Ext.data.ArrayStore({
|
||||||
storeId: "types",
|
storeId: "types",
|
||||||
autoDestroy: true,
|
autoDestroy: true,
|
||||||
@@ -866,7 +878,7 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
|||||||
valueField : 'FIELD_UID',
|
valueField : 'FIELD_UID',
|
||||||
displayField : 'FIELD_NAME',
|
displayField : 'FIELD_NAME',
|
||||||
triggerAction : 'all',
|
triggerAction : 'all',
|
||||||
width: 120,
|
width: 200,
|
||||||
editable : false,
|
editable : false,
|
||||||
mode:'local',
|
mode:'local',
|
||||||
listeners:{
|
listeners:{
|
||||||
@@ -884,8 +896,6 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
comboReport.setDisabled(isBpmn);
|
|
||||||
|
|
||||||
processStore = new Ext.data.Store( {
|
processStore = new Ext.data.Store( {
|
||||||
autoLoad: true,
|
autoLoad: true,
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
@@ -896,7 +906,7 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
|||||||
action: 'getProcessList'
|
action: 'getProcessList'
|
||||||
},
|
},
|
||||||
reader : new Ext.data.JsonReader( {
|
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: {
|
listeners: {
|
||||||
load: function() {
|
load: function() {
|
||||||
@@ -940,7 +950,6 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var rptPosArray = 0;
|
|
||||||
processComboBox = new Ext.form.ComboBox({
|
processComboBox = new Ext.form.ComboBox({
|
||||||
id: 'PROCESS',
|
id: 'PROCESS',
|
||||||
fieldLabel : _("ID_CASESLIST_APP_PRO_TITLE"),
|
fieldLabel : _("ID_CASESLIST_APP_PRO_TITLE"),
|
||||||
@@ -960,21 +969,11 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
|||||||
|
|
||||||
listeners:{
|
listeners:{
|
||||||
select: function(){
|
select: function(){
|
||||||
var dataStore = Ext.getCmp('PROCESS').store.getRange();
|
var dataStoreAux = types.getRange(0);
|
||||||
var i = Ext.getCmp('PROCESS').store.find("PRO_UID", Ext.getCmp('PROCESS').getValue());
|
comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE);
|
||||||
|
comboGridsList.setVisible(false);
|
||||||
|
|
||||||
types.loadData(
|
comboDbConnections.getStore().reload({params: {PRO_UID: Ext.getCmp("PROCESS").getValue()}});
|
||||||
(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()}});
|
|
||||||
if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') {
|
if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') {
|
||||||
gridsListStore.reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
gridsListStore.reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
||||||
} else {
|
} else {
|
||||||
@@ -1409,7 +1408,8 @@ loadFieldNormal = function(){
|
|||||||
action: "getDynafields",
|
action: "getDynafields",
|
||||||
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
start: 0,
|
start: 0,
|
||||||
limit: pageSize
|
limit: pageSize,
|
||||||
|
loadField: 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var assignedGridGotData = Ext.getCmp('assignedGrid').getStore().getCount() > 0;
|
var assignedGridGotData = Ext.getCmp('assignedGrid').getStore().getCount() > 0;
|
||||||
@@ -1433,7 +1433,8 @@ loadFieldsGrids = function(){
|
|||||||
TYPE: 'GRID',
|
TYPE: 'GRID',
|
||||||
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(),
|
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(),
|
||||||
start: 0,
|
start: 0,
|
||||||
limit: pageSize
|
limit: pageSize,
|
||||||
|
loadField: 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1538,8 +1539,10 @@ function setReportFields(records) {
|
|||||||
isset : false
|
isset : false
|
||||||
},
|
},
|
||||||
success: function(resp){
|
success: function(resp){
|
||||||
result = Ext.util.JSON.decode(resp.responseText);
|
result = Ext.util.JSON.decode(resp.responseText);
|
||||||
availableGrid.store.reload();
|
|
||||||
|
availableGrid.store.lastOptions.params.loadField = 0;
|
||||||
|
availableGrid.store.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1603,8 +1606,10 @@ function unsetReportFields(records) {
|
|||||||
isset : true
|
isset : true
|
||||||
},
|
},
|
||||||
success: function(resp){
|
success: function(resp){
|
||||||
result = Ext.util.JSON.decode(resp.responseText);
|
result = Ext.util.JSON.decode(resp.responseText);
|
||||||
availableGrid.store.reload();
|
|
||||||
|
availableGrid.store.lastOptions.params.loadField = 0;
|
||||||
|
availableGrid.store.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user