mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 08:12:26 +02:00
N°1598 - Improve user feedback on invalid transition: Display a better error message to the user in the portal
This commit is contained in:
@@ -341,6 +341,19 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
|
||||
// Building form from its properties
|
||||
// - Consistency checks for stimulus form
|
||||
if (isset($this->aFormProperties['stimulus_code']))
|
||||
{
|
||||
$aTransitions = MetaModel::EnumTransitions($sObjectClass, $this->oObject->GetState());
|
||||
if (!isset($aTransitions[$this->aFormProperties['stimulus_code']]))
|
||||
{
|
||||
$aStimuli = Metamodel::EnumStimuli($sObjectClass);
|
||||
$sStimulusLabel = $aStimuli[$this->aFormProperties['stimulus_code']]->GetLabel();
|
||||
|
||||
$sExceptionMessage = Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulusLabel, $this->oObject->GetName(), $this->oObject->GetStateLabel());
|
||||
throw new Exception($sExceptionMessage);
|
||||
}
|
||||
}
|
||||
// - The fields
|
||||
switch ($this->aFormProperties['type'])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user