From 36ab8ffd1117bf3b9f6c86682475e67e13371291 Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Fri, 10 Jul 2015 20:42:26 -0400 Subject: [PATCH 1/3] PM-2890 0017477: Update in Variable convert special chars to unicode in the database Dynaform list dissapear Se cambio la forma de codificar valores utf8 --- .../src/ProcessMaker/BusinessModel/Variable.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index 44fbf9136..b4fc4b89c 100755 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -75,7 +75,12 @@ class Variable $variable->setVarDefault($arrayData["VAR_DEFAULT"]); } if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { - $encodeAcceptedValues = json_encode($arrayData["VAR_ACCEPTED_VALUES"]); + $VAR_ACCEPTED_VALUES = $arrayData["VAR_ACCEPTED_VALUES"]; + foreach($VAR_ACCEPTED_VALUES as $key => $val) { + $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"]); + $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"]); + } + $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES)); $variable->setVarAcceptedValues($encodeAcceptedValues); } $variable->save(); @@ -168,7 +173,12 @@ class Variable $variable->setVarDefault($arrayData["VAR_DEFAULT"]); } if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { - $encodeAcceptedValues = json_encode($arrayData["VAR_ACCEPTED_VALUES"]); + $VAR_ACCEPTED_VALUES = $arrayData["VAR_ACCEPTED_VALUES"]; + foreach($VAR_ACCEPTED_VALUES as $key => $val) { + $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"]); + $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"]); + } + $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES)); $variable->setVarAcceptedValues($encodeAcceptedValues); } $variable->save(); From 7f38aa4888262c930859185124fd183b98800a6d Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Mon, 13 Jul 2015 17:35:40 -0400 Subject: [PATCH 2/3] PM-2890 0017477: Update in Variable convert special chars to unicode in the database Dynaform list dissapear Se cambio la forma de codificar valores utf8 --- .../src/ProcessMaker/BusinessModel/Variable.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index b4fc4b89c..502fbfdf1 100755 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -77,10 +77,10 @@ class Variable if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { $VAR_ACCEPTED_VALUES = $arrayData["VAR_ACCEPTED_VALUES"]; foreach($VAR_ACCEPTED_VALUES as $key => $val) { - $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"]); - $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"]); + $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"], ENT_IGNORE, 'UTF-8'); + $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"], ENT_IGNORE, 'UTF-8'); } - $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES)); + $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES), ENT_IGNORE, 'UTF-8'); $variable->setVarAcceptedValues($encodeAcceptedValues); } $variable->save(); @@ -175,10 +175,10 @@ class Variable if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { $VAR_ACCEPTED_VALUES = $arrayData["VAR_ACCEPTED_VALUES"]; foreach($VAR_ACCEPTED_VALUES as $key => $val) { - $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"]); - $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"]); + $VAR_ACCEPTED_VALUES[$key]["label"] = htmlentities($val["label"], ENT_IGNORE,'UTF-8'); + $VAR_ACCEPTED_VALUES[$key]["value"] = htmlentities($val["value"], ENT_IGNORE,'UTF-8'); } - $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES)); + $encodeAcceptedValues = html_entity_decode(json_encode($VAR_ACCEPTED_VALUES), ENT_IGNORE, 'UTF-8'); $variable->setVarAcceptedValues($encodeAcceptedValues); } $variable->save(); From e1368978bde361c250220d14ae2479ae295f1886 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 14 Jul 2015 11:06:38 -0400 Subject: [PATCH 3/3] PM-3065 --- workflow/engine/classes/class.pmDynaform.php | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 04a0f6f47..b50accfd6 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -16,6 +16,7 @@ class pmDynaform public $credentials = null; public $lang = null; public $langs = null; + private $dependent = null; //todo public function __construct($fields = array()) { @@ -184,6 +185,21 @@ class pmDynaform if ($json->data["label"] === "") { $json->data["label"] = $json->data["value"]; } + //synchronize data label + $withoutOptions = true; + foreach ($json->options as $io) { + if ($json->data["value"] === $io["value"]) { + if ($json->data["label"] != $io["label"]) { + $this->dependent = $json->variable; //todo + $json->data["label"] = $io["label"]; + $withoutOptions = false; + } + } + } + if ($withoutOptions) { + $json->data["label"] = $json->data["value"];//todo + } + //end synchronize data label } if ($key === "type" && ($value === "checkbox")) { $json->data = array( @@ -253,6 +269,27 @@ class pmDynaform } } + public function jsond(&$json) + { + foreach ($json as $key => &$value) { + $sw1 = is_array($value); + $sw2 = is_object($value); + if ($sw1 || $sw2) { + $this->jsond($value); + } + if (!$sw1 && !$sw2) { + if (isset($json->dbConnection) && $json->dbConnection !== "" && $json->dbConnection !== "none" && isset($json->sql) && $json->sql != "") { + $prefix = array("@@", "@#", "@%", "@?", "@$", "@="); + foreach ($prefix as $val) { + if (strpos($json->sql, $val . $this->dependent) !== false) { + $json->data = array("value" => "", "label" => ""); + } + } + } + } + } + } + public function isResponsive() { return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false; @@ -273,6 +310,7 @@ class pmDynaform } $this->jsonr($json); + $this->jsond($json); //todo $javascript = "