From 7eaad8c06326a3906fbb8c55a6468ea9e7a26245 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 28 Nov 2017 09:43:16 -0400 Subject: [PATCH] HOR-4121 --- workflow/engine/classes/PmDynaform.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 1e4aa37e4..22d60b082 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -1882,15 +1882,25 @@ class PmDynaform /** * Remove the posted values that are not in the definition of Dynaform. + * * @param array $post + * * @return array */ - public function validatePost($post = array()) + public function validatePost($post = []) { $result = array(); $previusFunction = $this->onPropertyRead; $this->onPropertyRead = function($json, $key, $value) use (&$post) { 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($post[$json->variable])) { unset($post[$json->variable]); @@ -1919,12 +1929,6 @@ class PmDynaform if ($validatorClass !== null) { $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"]);