N°9383 - CheckToWrite inside a transition: Incorrect error message display

This commit is contained in:
Anne-Cath
2026-03-10 18:29:08 +01:00
parent 9fca81cc32
commit 1f860623c4

View File

@@ -1186,6 +1186,12 @@ try {
if ($bRes) {
try {
$bApplyStimulus = $oObj->ApplyStimulus($sStimulus); // will write the object in the DB
}
catch (CoreCannotSaveObjectException $e) {
// Rollback to the previous state... by reloading the object from the database and applying the modifications again
$oObj = MetaModel::GetObject(get_class($oObj), $oObj->GetKey());
$oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes);
$sIssues = implode(' ', $e->getIssues());
} catch (CoreException $e) {
// Rollback to the previous state... by reloading the object from the database and applying the modifications again
$oObj = MetaModel::GetObject(get_class($oObj), $oObj->GetKey());