mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°5170 - In a transition DoCheckToWrite returned error, generes a Fatal error (#539)
This commit is contained in:
@@ -3592,16 +3592,26 @@ EOF
|
||||
$oPage->add_ready_script(InlineImage::EnableCKEditorImageUpload($this, $sTempId));
|
||||
} else {
|
||||
//we can directly apply the stimuli
|
||||
$sExceptionMessage = null;
|
||||
try {
|
||||
$bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB
|
||||
if (!$bApplyStimulus) {
|
||||
throw new ApplicationException(Dict::S('UI:FailedToApplyStimuli'));
|
||||
} else {
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
// Catch any exception happening during the stimulus
|
||||
$bApplyStimulus = false;
|
||||
$sExceptionMessage = ($oException instanceof CoreCannotSaveObjectException) ? $oException->getHtmlMessage() : $oException->getMessage();
|
||||
}
|
||||
finally {
|
||||
if ($sOwnershipToken !== null) {
|
||||
// Release the concurrent lock, if any
|
||||
iTopOwnershipLock::ReleaseLock($sClass, $iKey, $sOwnershipToken);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!$bApplyStimulus) {
|
||||
// Throw an application oriented exception if necessary
|
||||
throw new ApplicationException($sExceptionMessage ?? Dict::S('UI:FailedToApplyStimuli'));
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1222,9 +1222,18 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreCannotSaveObjectException $e) {
|
||||
$aData['valid'] = false;
|
||||
$aData['messages']['error'] += array('_main' => array($e->getHtmlMessage()));
|
||||
if (false === $bExceptionLogged) {
|
||||
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$aData['valid'] = false;
|
||||
$aData['messages']['error'] += array('_main' => array($e->getMessage()));
|
||||
$aData['messages']['error'] += [
|
||||
'_main' => [ ($e instanceof CoreCannotSaveObjectException) ? $e->getHtmlMessage() : $e->getMessage()]
|
||||
];
|
||||
if (false === $bExceptionLogged) {
|
||||
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage());
|
||||
}
|
||||
|
||||
@@ -333,6 +333,8 @@ class ObjectFormHandlerHelper
|
||||
'modal' => true,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, implode('<br/>', $aFormData['validation']['messages']['error']['_main']));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
10
pages/UI.php
10
pages/UI.php
@@ -1206,8 +1206,16 @@ try
|
||||
$bApplyTransition = $oObj->DisplayStimulusForm($oP, $sStimulus, $aPrefillFormParam);
|
||||
}
|
||||
catch (ApplicationException $e) {
|
||||
$bApplyTransition = false;
|
||||
$sMessage = $e->getMessage();
|
||||
$sSeverity = 'info';
|
||||
$sSeverity = 'warning';
|
||||
ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity);
|
||||
}
|
||||
catch (CoreCannotSaveObjectException $e) {
|
||||
$bApplyTransition = false;
|
||||
$aIssues = $e->getIssues();
|
||||
$sMessage = $e->getHtmlMessage();
|
||||
$sSeverity = 'warning';
|
||||
ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity);
|
||||
}
|
||||
if ($bApplyTransition) {
|
||||
|
||||
Reference in New Issue
Block a user