mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01: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'])
|
||||
{
|
||||
|
||||
@@ -458,7 +458,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'UI:Error:BulkModifyNotAllowedOn_Class' => 'You are not allowed to perform a bulk update of objects of class %1$s',
|
||||
'UI:Error:ObjectAlreadyCloned' => 'Error: the object has already been cloned!',
|
||||
'UI:Error:ObjectAlreadyCreated' => 'Error: the object has already been created!',
|
||||
'UI:Error:Invalid_Stimulus_On_Object_In_State' => 'Error: invalid stimulus "%1$s" on object %2$s in state "%3$s".',
|
||||
'UI:Error:Invalid_Stimulus_On_Object_In_State' => '%2$s is currently in the "%3$s" state, the "%1$s" operation you requested could not be applied.',
|
||||
'UI:Error:InvalidDashboardFile' => 'Error: invalid dashboard file',
|
||||
'UI:Error:InvalidDashboard' => 'Error: invalid dashboard',
|
||||
'UI:Error:MaintenanceMode' => 'Application is currently in maintenance',
|
||||
|
||||
@@ -441,7 +441,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'UI:Error:BulkModifyNotAllowedOn_Class' => 'Vous n\'êtes pas autorisé à faire une modification massive sur les objets de type %1$s',
|
||||
'UI:Error:ObjectAlreadyCloned' => 'Erreur: l\'objet a déjà été dupliqué !',
|
||||
'UI:Error:ObjectAlreadyCreated' => 'Erreur: l\'objet a déjà été créé !',
|
||||
'UI:Error:Invalid_Stimulus_On_Object_In_State' => 'Erreur: le stimulus "%1$s" n\'est pas valide pour l\'objet %2$s dans l\'état "%3$s".',
|
||||
'UI:Error:Invalid_Stimulus_On_Object_In_State' => '%2$s est actuellement dans l\'état "%3$s", l\'opération "%1$s" que vous avez demandée ne peut être appliquée.',
|
||||
'UI:Error:InvalidDashboardFile' => 'Erreur: Le fichier tableau de bord est invalide',
|
||||
'UI:Error:InvalidDashboard' => 'Erreur: Le tableau de bord est invalide',
|
||||
'UI:Error:MaintenanceMode' => 'L\'application est en maintenance',
|
||||
|
||||
Reference in New Issue
Block a user