diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index b6f284eba..af27c0b64 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -165,9 +165,16 @@ try { // saving the data ina pm table in case that is a new record if (! empty( $newValues )) { $id = key( $newValues ); - if (! $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues )) { + $newValues[$id] = $aData['APP_DATA'][$id]; + $idPmtable = $oForm->fields[$id]->owner->tree->children[0]->attributes['pmtable']; + + while (strlen($id) < 3) { + $id = '_' . $id; + } + + if (!($oAdditionalTables->updateDataInTable($idPmtable, $newValues ))) { //<--This is to know if it is a new registry on the PM Table - $oAdditionalTables->saveDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues ); + $oAdditionalTables->saveDataInTable($idPmtable, $newValues ); } }