HOR-300: Todos los report tables deben tener un indice para el campo APP_UID
This commit is contained in:
@@ -978,14 +978,14 @@ class pmTablesProxy extends HttpProxyController
|
||||
$fsData = intval( fread( $fp, 9 ) ); //reading the metadata
|
||||
$sType = fread( $fp, $fsData );
|
||||
|
||||
//Ask for all Process
|
||||
$processMap = new processMap();
|
||||
$aProcess = json_decode ($processMap->getAllProcesses());
|
||||
foreach($aProcess as $key => $val){
|
||||
if ($val->value != ''){
|
||||
$proUids[] = $val->value;
|
||||
}
|
||||
}
|
||||
//Ask for all Process
|
||||
$processMap = new processMap();
|
||||
$aProcess = json_decode ($processMap->getAllProcesses());
|
||||
foreach($aProcess as $key => $val){
|
||||
if ($val->value != ''){
|
||||
$proUids[] = $val->value;
|
||||
}
|
||||
}
|
||||
// first create the tables structures
|
||||
|
||||
while (! feof( $fp )) {
|
||||
@@ -1005,33 +1005,33 @@ class pmTablesProxy extends HttpProxyController
|
||||
$tableNameMap[$contentSchema['ADD_TAB_NAME']] = $contentSchema['ADD_TAB_NAME'];
|
||||
|
||||
$tableData = new stdClass();
|
||||
|
||||
if(isset( $contentSchema["PRO_UID"] )){
|
||||
$tableData->PRO_UID = $contentSchema["PRO_UID"];
|
||||
}else{
|
||||
$tableData->PRO_UID = $_POST["form"]["PRO_UID"];
|
||||
}
|
||||
|
||||
if(isset( $contentSchema["PRO_UID"] )){
|
||||
$tableData->PRO_UID = $contentSchema["PRO_UID"];
|
||||
}else{
|
||||
$tableData->PRO_UID = $_POST["form"]["PRO_UID"];
|
||||
}
|
||||
$isPmTable = false; /*is a report table*/
|
||||
if($contentSchema["PRO_UID"] == "" ) {
|
||||
$isPmTable = true;
|
||||
}
|
||||
$currentPRO_UID = '';
|
||||
if (isset( $_POST["form"]["PRO_UID_HELP"] ) && !empty($_POST["form"]["PRO_UID_HELP"])) {
|
||||
$currentPRO_UID = $_POST["form"]["PRO_UID_HELP"];
|
||||
$currentPRO_UID = '';
|
||||
if (isset( $_POST["form"]["PRO_UID_HELP"] ) && !empty($_POST["form"]["PRO_UID_HELP"])) {
|
||||
$currentPRO_UID = $_POST["form"]["PRO_UID_HELP"];
|
||||
} else {
|
||||
if(isset( $_POST["form"]["PRO_UID"]) && !empty( $_POST["form"]["PRO_UID"])){
|
||||
$currentPRO_UID = $_POST["form"]["PRO_UID"];
|
||||
$_SESSION['PROCESS'] = $currentPRO_UID;
|
||||
} else{
|
||||
$currentPRO_UID = $_SESSION['PROCESS'];
|
||||
}
|
||||
if(isset( $_POST["form"]["PRO_UID"]) && !empty( $_POST["form"]["PRO_UID"])){
|
||||
$currentPRO_UID = $_POST["form"]["PRO_UID"];
|
||||
$_SESSION['PROCESS'] = $currentPRO_UID;
|
||||
} else{
|
||||
$currentPRO_UID = $_SESSION['PROCESS'];
|
||||
}
|
||||
}
|
||||
|
||||
if($fromAdmin) { /* from admin tab */
|
||||
if ($tableExists !== false && !$fromConfirm && !$overWrite) {
|
||||
if ($tableExists !== false && !$fromConfirm && !$overWrite) {
|
||||
$validationType = 1;
|
||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
||||
}
|
||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
||||
}
|
||||
if(!in_array($tableData->PRO_UID, $proUids) && !$isPmTable) {
|
||||
$validationType = 2;
|
||||
throw new Exception( G::loadTranslation( 'ID_NO_RELATED_PROCESS' ) );
|
||||
@@ -1041,7 +1041,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$validationType = '';
|
||||
throw new Exception( G::loadTranslation( 'ID_NO_REPORT_TABLE' ) );
|
||||
}
|
||||
if ($tableExists !== false && !$fromConfirm && !$overWrite) {
|
||||
if ($tableExists !== false && !$fromConfirm && !$overWrite) {
|
||||
$validationType = 1;
|
||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
||||
}
|
||||
@@ -1537,6 +1537,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$application->field_size = 32;
|
||||
$application->field_dyn = '';
|
||||
$application->field_key = 1;
|
||||
$application->field_index = 1;
|
||||
$application->field_null = 0;
|
||||
$application->field_filter = false;
|
||||
$application->field_autoincrement = false;
|
||||
@@ -1723,25 +1724,25 @@ class pmTablesProxy extends HttpProxyController
|
||||
$row = $oDataset->getRow();
|
||||
if (isset($row["PRJ_UID"])) {
|
||||
$sProcessUID = $row["PRJ_UID"];
|
||||
|
||||
$arrayDataTypeToExclude = array("array", "grid");
|
||||
$arrayTypeToExclude = array("title", "subtitle", "link", "file", "button", "reset", "submit", "listbox", "grid", "array", "javascript", "location", "scannerCode");
|
||||
|
||||
$arrayControlSupported = array();
|
||||
|
||||
$dynaformAllControl = $this->getDynaformVariables($sProcessUID, $arrayTypeToExclude, true, "DATA");
|
||||
|
||||
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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$arrayTypeToExclude,false);
|
||||
|
||||
$arrayDataTypeToExclude = array("array", "grid");
|
||||
$arrayTypeToExclude = array("title", "subtitle", "link", "file", "button", "reset", "submit", "listbox", "grid", "array", "javascript", "location", "scannerCode");
|
||||
|
||||
$arrayControlSupported = array();
|
||||
|
||||
$dynaformAllControl = $this->getDynaformVariables($sProcessUID, $arrayTypeToExclude, true, "DATA");
|
||||
|
||||
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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$arrayTypeToExclude,false);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
|
||||
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
||||
@@ -1752,7 +1753,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$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)) {
|
||||
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"],
|
||||
@@ -1761,20 +1762,20 @@ class pmTablesProxy extends HttpProxyController
|
||||
"_isset" => true
|
||||
));
|
||||
}
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"]);
|
||||
|
||||
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
|
||||
));
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"] . "_label");
|
||||
}
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"]);
|
||||
|
||||
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
|
||||
));
|
||||
|
||||
array_push($fieldsNames, $row["VAR_NAME"] . "_label");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1919,7 +1920,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
*
|
||||
* @param $sProcessUID
|
||||
*/
|
||||
public function getDynaformVariables($sProcessUID, $excludeFieldsList, $allowed = true, $option = "VARIABLE")
|
||||
public function getDynaformVariables($sProcessUID, $excludeFieldsList, $allowed = true, $option = "VARIABLE")
|
||||
{
|
||||
$dynaformVariables = array();
|
||||
$oC = new Criteria( 'workflow' );
|
||||
@@ -1936,33 +1937,33 @@ class pmTablesProxy extends HttpProxyController
|
||||
foreach($val as $column) {
|
||||
if($allowed) {
|
||||
if(isset($column['type']) && !in_array( $column['type'], $excludeFieldsList )){
|
||||
switch ($option) {
|
||||
case "VARIABLE":
|
||||
if (array_key_exists("variable", $column)) {
|
||||
if($column["variable"] != "") {
|
||||
$dynaformVariables[] = $column["variable"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "DATA":
|
||||
$dynaformVariables[] = $column;
|
||||
break;
|
||||
}
|
||||
switch ($option) {
|
||||
case "VARIABLE":
|
||||
if (array_key_exists("variable", $column)) {
|
||||
if($column["variable"] != "") {
|
||||
$dynaformVariables[] = $column["variable"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "DATA":
|
||||
$dynaformVariables[] = $column;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isset($column['type']) && in_array( $column['type'], $excludeFieldsList )){
|
||||
switch ($option) {
|
||||
case "VARIABLE":
|
||||
if (array_key_exists("variable", $column)) {
|
||||
if($column["variable"] != "") {
|
||||
$dynaformVariables[] = $column["variable"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "DATA":
|
||||
$dynaformVariables[] = $column;
|
||||
break;
|
||||
}
|
||||
switch ($option) {
|
||||
case "VARIABLE":
|
||||
if (array_key_exists("variable", $column)) {
|
||||
if($column["variable"] != "") {
|
||||
$dynaformVariables[] = $column["variable"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "DATA":
|
||||
$dynaformVariables[] = $column;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1970,12 +1971,12 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
$oData->next();
|
||||
}
|
||||
|
||||
if ($option == "VARIABLE") {
|
||||
return array_unique($dynaformVariables);
|
||||
} else {
|
||||
return $dynaformVariables;
|
||||
}
|
||||
|
||||
if ($option == "VARIABLE") {
|
||||
return array_unique($dynaformVariables);
|
||||
} else {
|
||||
return $dynaformVariables;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user