N°2776 ObjectFormManager : change transaction scope

* move ApplyStimulus & triggers out of the transaction
* move \utils::RemoveTransaction to a finally block
This commit is contained in:
Pierre Goiffon
2020-02-11 11:36:59 +01:00
parent 4dc383cba8
commit 94b70fc473

View File

@@ -1130,6 +1130,10 @@ class ObjectFormManager extends FormManager
{
$this->FinalizeAttachments($aArgs['attachmentIds']);
}
// Ending transaction with a commit as everything was fine
CMDBSource::Query('COMMIT');
// Checking if we have to apply a stimulus
if (isset($aArgs['applyStimulus']))
{
@@ -1151,10 +1155,6 @@ class ObjectFormManager extends FormManager
}
}
}
// Removing transaction id
utils::RemoveTransaction($this->oForm->GetTransactionId());
// Ending transaction with a commit as everything was fine
CMDBSource::Query('COMMIT');
// Resetting caselog fields value, otherwise the value will stay in it after submit.
$this->oForm->ResetCaseLogFields();
@@ -1172,6 +1172,11 @@ class ObjectFormManager extends FormManager
$aData['messages']['error'] += array('_main' => array($e->getMessage()));
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Rollback during submit ('.$e->getMessage().')');
}
finally
{
// Removing transaction id
utils::RemoveTransaction($this->oForm->GetTransactionId());
}
}
else
{