Commit 3e4321db authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'B6911-afterInsert-fix' into 'master'

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

See merge request !96
parents f9ed695f e12b46f1
Pipeline #1016 canceled with stage
...@@ -478,7 +478,8 @@ class QuickFormQuery { ...@@ -478,7 +478,8 @@ class QuickFormQuery {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP); $recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
// Action: Before // 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. // 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, $this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $recordId,
...@@ -498,7 +499,8 @@ class QuickFormQuery { ...@@ -498,7 +499,8 @@ class QuickFormQuery {
$save->processAllUploads($rc); $save->processAllUploads($rc);
// Action: After // 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) { if ($status != ACTION_ELEMENT_NO_CHANGE) {
// Reload fresh saved record and fill STORE_RECORD with it. // 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]); $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