Commit b73e7bcb authored by Carsten  Rose's avatar Carsten Rose

Refs #5695 Multiform: update values after saving.

parent 324a1ad3
Pipeline #2476 passed with stages
in 2 minutes and 34 seconds
......@@ -212,7 +212,7 @@ abstract class AbstractBuildForm {
* @throws \UserFormException
* @throws \UserReportException
*/
private function buildMultiForm($filter, $modeCollectFe, array $rcJson) {
private function buildMultiForm($filter, $modeCollectFe, array &$rcJson) {
$htmlElements = '';
$rcJson = array();
......@@ -234,10 +234,26 @@ abstract class AbstractBuildForm {
ERROR_INVALID_OR_MISSING_PARAMETER);
}
// This is a dirty workaround for formSave: clear FORM STORE (already outdated values).
// Otherwise those outdated values will be taken to fill non primary FE in multiForm (which are garbage).
// Better solution would be to have FORM_STORE in sync.
$this->store::unsetStore(STORE_FORM);
$storeVarBase = $this->evaluate->parse($this->formSpec[FE_FILL_STORE_VAR]);
if (!is_array($storeVarBase)) {
$storeVarBase = array();
}
// Per row, iterate over all form elements
foreach ($parentRecords as $row) {
// Always start with a clean STORE_VAR
$this->store->setStore($storeVarBase, STORE_VAR, true);
$this->store->setStore($row, STORE_PARENT_RECORD, true);
$this->store->setVar(F_MULTI_COL_ID, $row[$idName], STORE_PARENT_RECORD); // In case '_id' is used, both '_id' and 'id' should be accessible.
$record = $this->dbArray[$this->dbIndexData]->sql('SELECT * FROM `' . $this->formSpec[F_TABLE_NAME] . '` WHERE id=' . $row[F_MULTI_COL_ID], ROW_EXPECT_1);
$this->store->setStore($record, STORE_RECORD, true);
$jsonTmp = array();
$feTmp = $this->feSpecNative;
......@@ -252,7 +268,7 @@ abstract class AbstractBuildForm {
$this->feSpecNative = $feTmp;
$this->store::unsetStore(STORE_RECORD);
$rcJson[] = $jsonTmp;
$rcJson = array_merge($rcJson, $jsonTmp);
}
$tableHead = Support::wrapTag('<tr>', $this->buildMultiFormTableHead($parentRecords[0]));
......@@ -386,7 +402,7 @@ abstract class AbstractBuildForm {
} else {
// Multi Form
if ($mode === FORM_LOAD) {
if ($mode === FORM_LOAD || $mode === FORM_SAVE) {
$htmlElements = $this->buildMultiForm($filter, $modeCollectFe, $json);
}
}
......
......@@ -340,6 +340,7 @@ class QuickFormQuery {
$foundInStore = '';
$flagApiStructureReGroup = true;
$formModeNew = '';
$build = null;
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP . STORE_TYPO3 . STORE_CLIENT . STORE_ZERO);
$this->setParameterLanguageFieldName();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment