Commit e12b46f1 authored by Elias Villiger's avatar Elias Villiger
Browse files

B6911 - Only fire afterInsert on new record (also fix afterUpdate,...

B6911 - Only fire afterInsert on new record (also fix afterUpdate, beforeInsert, beforeUpdate) - refs #6911, closes #6911
parent 8203e8f7
Pipeline #966 passed with stage
in 1 minute and 39 seconds
......@@ -472,7 +472,8 @@ class QuickFormQuery {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
// Action: Before
$formAction->elements($recordId, $this->feSpecAction, FE_TYPE_BEFORE_INSERT . ',' . FE_TYPE_BEFORE_UPDATE . ',' . FE_TYPE_BEFORE_SAVE);
$feTypeList = FE_TYPE_BEFORE_SAVE . ',' . ($recordId == 0 ? FE_TYPE_BEFORE_INSERT : FE_TYPE_BEFORE_UPDATE);
$formAction->elements($recordId, $this->feSpecAction, $feTypeList);
// If an old record exist: load it. Necessary to delete uploaded files which should be overwritten.
$this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $recordId,
......@@ -492,7 +493,8 @@ class QuickFormQuery {
$save->processAllUploads($rc);
// Action: After
$status = $formAction->elements($rc, $this->feSpecAction, FE_TYPE_AFTER_INSERT . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_AFTER_SAVE);
$feTypeList = FE_TYPE_AFTER_SAVE . ',' . ($recordId == 0 ? FE_TYPE_AFTER_INSERT : FE_TYPE_AFTER_UPDATE);
$status = $formAction->elements($rc, $this->feSpecAction, $feTypeList);
if ($status != ACTION_ELEMENT_NO_CHANGE) {
// Reload fresh saved record and fill STORE_RECORD with it.
$this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $rc, $this->dbArray[$this->dbIndexData], $this->formSpec[F_PRIMARY_KEY]);
......
Supports Markdown
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