PM-3065 improvement: debug panel for var_label update

This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-07-27 15:13:45 -04:00
parent 8682766395
commit 8ac366b0e5
2 changed files with 22 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ class pmDynaform
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
$a->add(DynaformPeer::DYN_UID, $this->fields["CURRENT_DYNAFORM"], Criteria::EQUAL);
$ds = ProcessPeer::doSelectRS($a);
$ds = DynaformPeer::doSelectRS($a);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
$row = $ds->getRow();
@@ -199,6 +199,25 @@ class pmDynaform
if ($json->data["label"] === "") {
$json->data["label"] = $json->data["value"];
}
//synchronize var_label
if (isset($this->fields["APP_DATA"]["__VAR_CHANGED__"]) &&
in_array($json->name, explode(",", $this->fields["APP_DATA"]["__VAR_CHANGED__"]))) {
$json->data["label"] = $json->data["value"];
foreach ($json->options as $io) {
if ($json->data["value"] === $io->value) {
$json->data["label"] = $io->label;
}
}
foreach ($json->optionsSql as $io) {
if ($json->data["value"] === $io["value"]) {
$json->data["label"] = $io["label"];
}
}
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = Array(
"key" => $json->name . "_label",
"value" => $json->data["label"]
);
}
}
if ($key === "type" && ($value === "checkbox")) {
$json->data = array(

View File

@@ -346,6 +346,7 @@ class PMScript
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n " . " \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
//echo '<pre>-->'; print_r($this->aFields); echo '<---</pre>';
$this->executeAndCatchErrors( $sScript, $this->sScript );
$this->aFields["__VAR_CHANGED__"] = implode(",", $this->affected_fields);
for ($i = 0; $i < count( $this->affected_fields ); $i ++) {
$_SESSION['TRIGGER_DEBUG']['DATA'][] = Array ('key' => $this->affected_fields[$i],'value' => isset( $this->aFields[$this->affected_fields[$i]] ) ? $this->aFields[$this->affected_fields[$i]] : ''
);