HOR-80 "0018229: Error en report tables para grillas" SOLVED

Issue:
    0018229: Error en report tables para grillas - Create report tables from grids
Cause:
    Nuevo requerimiento de funciones (procesos BPMN)
Solution:
    - Se a implementado la creacion de Report-tables de tipo Grid para procesos BPMN
    - Esta funcionaldad es la misma que los procesos Clasicos

Fix
This commit is contained in:
Victor Saisa Lopez
2016-06-15 17:03:07 -04:00
parent 4979c587bd
commit e3d08619d3
6 changed files with 313 additions and 128 deletions

View File

@@ -1577,4 +1577,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;
}
}
}