Commit cdc0df99 authored by Carsten  Rose's avatar Carsten Rose

Merge remote-tracking branch 'origin/master'

parents ea7aae15 07e2e200
Pipeline #3130 passed with stages
in 1 minute and 49 seconds
...@@ -234,7 +234,7 @@ class Save { ...@@ -234,7 +234,7 @@ class Save {
* *
* @param $recordId * @param $recordId
* *
* @return int record id (in case of insert, it's different from $recordId) * @return int record id (in case of insert, it's different from $recordId)
* @throws \CodeException * @throws \CodeException
* @throws \DbException * @throws \DbException
* @throws \UserFormException * @throws \UserFormException
...@@ -243,6 +243,7 @@ class Save { ...@@ -243,6 +243,7 @@ class Save {
private function elements($recordId) { private function elements($recordId) {
$columnCreated = false; $columnCreated = false;
$columnModified = false; $columnModified = false;
$realColumnFound = false;
$newValues = array(); $newValues = array();
...@@ -260,6 +261,7 @@ class Save { ...@@ -260,6 +261,7 @@ class Save {
// Skip Upload Elements: those will be processed later. // Skip Upload Elements: those will be processed later.
if ($this->isColumnUploadField($column)) { if ($this->isColumnUploadField($column)) {
$realColumnFound = true;
continue; continue;
} }
...@@ -285,29 +287,31 @@ class Save { ...@@ -285,29 +287,31 @@ class Save {
Support::setIfNotSet($formValues, $column); Support::setIfNotSet($formValues, $column);
} }
$newValues[$column] = $formValues[$column]; $newValues[$column] = $formValues[$column];
$realColumnFound = true;
} }
if ($columnModified && !empty($newValues) && !isset($newValues[COLUMN_MODIFIED])) { // Only save record if real columns exist.
$newValues[COLUMN_MODIFIED] = date('YmdHis'); if ($realColumnFound) {
}
if ($recordId == 0) { if ($columnModified && !isset($newValues[COLUMN_MODIFIED])) {
if ($columnCreated && !isset($newValues[COLUMN_CREATED])) { $newValues[COLUMN_MODIFIED] = date('YmdHis');
$newValues[COLUMN_CREATED] = date('YmdHis');
} }
$rc = $this->insertRecord($this->formSpec[F_TABLE_NAME], $newValues);
} else { if ($recordId == 0) {
if (!empty($newValues)) { if ($columnCreated && !isset($newValues[COLUMN_CREATED])) {
$newValues[COLUMN_CREATED] = date('YmdHis');
}
$recordId = $this->insertRecord($this->formSpec[F_TABLE_NAME], $newValues);
} else {
$this->updateRecord($this->formSpec[F_TABLE_NAME], $newValues, $recordId, $this->formSpec[F_PRIMARY_KEY]); $this->updateRecord($this->formSpec[F_TABLE_NAME], $newValues, $recordId, $this->formSpec[F_PRIMARY_KEY]);
} }
$rc = $recordId;
} }
$this->nativeDoSlave($rc); $this->nativeDoSlave($recordId);
return $rc; return $recordId;
} }
/** /**
......
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