HOR-4121
This commit is contained in:
@@ -1882,15 +1882,25 @@ class PmDynaform
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the posted values that are not in the definition of Dynaform.
|
* Remove the posted values that are not in the definition of Dynaform.
|
||||||
|
*
|
||||||
* @param array $post
|
* @param array $post
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function validatePost($post = array())
|
public function validatePost($post = [])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$previusFunction = $this->onPropertyRead;
|
$previusFunction = $this->onPropertyRead;
|
||||||
$this->onPropertyRead = function($json, $key, $value) use (&$post) {
|
$this->onPropertyRead = function($json, $key, $value) use (&$post) {
|
||||||
if ($key === "type" && isset($json->variable) && !empty($json->variable)) {
|
if ($key === "type" && isset($json->variable) && !empty($json->variable)) {
|
||||||
|
//Clears the data in the appData for grids
|
||||||
|
if ($json->type === 'grid' &&
|
||||||
|
array_key_exists($json->id, $this->fields) &&
|
||||||
|
!array_key_exists($json->id, $post)
|
||||||
|
) {
|
||||||
|
$post[$json->variable] = [[]];
|
||||||
|
}
|
||||||
|
//validate 'protectedValue' property
|
||||||
if (isset($json->protectedValue) && $json->protectedValue === true) {
|
if (isset($json->protectedValue) && $json->protectedValue === true) {
|
||||||
if (isset($post[$json->variable])) {
|
if (isset($post[$json->variable])) {
|
||||||
unset($post[$json->variable]);
|
unset($post[$json->variable]);
|
||||||
@@ -1919,12 +1929,6 @@ class PmDynaform
|
|||||||
if ($validatorClass !== null) {
|
if ($validatorClass !== null) {
|
||||||
$validatorClass->validatePost($post);
|
$validatorClass->validatePost($post);
|
||||||
}
|
}
|
||||||
//Clears the data in the appData for grids
|
|
||||||
if (array_key_exists($json->id, $this->fields) && $json->type === 'grid' &&
|
|
||||||
!array_key_exists($json->id, $post)
|
|
||||||
) {
|
|
||||||
$post[$json->variable] = array(array());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$json = G::json_decode($this->record["DYN_CONTENT"]);
|
$json = G::json_decode($this->record["DYN_CONTENT"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user