From 3f2d2bf29e203c4bd7d7398a6c45d7fdd551968d Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Mon, 5 May 2014 14:09:22 -0400 Subject: [PATCH] Improvement keys pmtables in dynaform --- workflow/engine/methods/cases/cases_SaveData.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index 89db581c7..8d9529c4f 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -166,7 +166,6 @@ try { if (! empty( $newValues )) { $id = key( $newValues ); $newValues[$id] = $aData['APP_DATA'][$id]; - $sw = false; foreach ($aKeys as $key => $value) { if ($newValues[$key] == '') { $G_PUBLISH = new Publisher(); @@ -178,6 +177,7 @@ try { } } $idPmtable = $oForm->fields[$id]->pmconnection->pmtable != '' ? $oForm->fields[$id]->pmconnection->pmtable : $oForm->fields[$id]->owner->tree->children[0]->attributes['pmtable']; + if (!($oAdditionalTables->updateDataInTable($idPmtable, $newValues ))) { //<--This is to know if it is a new registry on the PM Table $oAdditionalTables->saveDataInTable($idPmtable, $newValues ); @@ -320,6 +320,16 @@ try { //$oJSON = new Services_JSON(); $_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields']; if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], Bootstrap::json_decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) { + $fieldsRequired = Bootstrap::json_decode(str_replace(array("%27", "%39"), array("\"", "'"), $_POST["DynaformRequiredFields"])); + + foreach ($fieldsRequired as $key1 => $value1) { + foreach ($missing_req_values as $key2 => $value2) { + if ($value1->name == $value2) { + $missing_req_values[$key2] = $value1->label; + } + } + } + $_POST['next_step'] = $aNextStep; $_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $_POST['req_val'] = $missing_req_values;