diff --git a/core/action.class.inc.php b/core/action.class.inc.php index 1c9b49945..a45529db2 100644 --- a/core/action.class.inc.php +++ b/core/action.class.inc.php @@ -118,6 +118,39 @@ abstract class Action extends cmdbAbstractObject return false; } } + + /** + * @inheritDoc + * @since 3.0.0 + */ + public function AfterInsert() + { + parent::AfterInsert(); + $this->DoCheckIfHasTrigger(); + } + + /** + * @inheritDoc + * @since 3.0.0 + */ + public function AfterUpdate() + { + parent::AfterUpdate(); + $this->DoCheckIfHasTrigger(); + } + + /** + * Check if the Action has at least 1 trigger linked. Otherwise, it adds a warning. + * @return void + * @since 3.0.0 + */ + protected function DoCheckIfHasTrigger() + { + $oTriggersSet = $this->Get('trigger_list'); + if ($oTriggersSet->Count() === 0) { + $this->m_aCheckWarnings[] = Dict::S('Action:WarningNoTriggerLinked'); + } + } } /** diff --git a/dictionaries/cs.dictionary.itop.core.php b/dictionaries/cs.dictionary.itop.core.php index 0128ab6a9..5e7b1e64e 100755 --- a/dictionaries/cs.dictionary.itop.core.php +++ b/dictionaries/cs.dictionary.itop.core.php @@ -501,6 +501,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Action/Attribute:trigger_list+' => 'Triggery spojené s touto akcí', 'Class:Action/Attribute:finalclass' => 'Typ', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/da.dictionary.itop.core.php b/dictionaries/da.dictionary.itop.core.php index 4fbd7bc4d..49bc33da2 100644 --- a/dictionaries/da.dictionary.itop.core.php +++ b/dictionaries/da.dictionary.itop.core.php @@ -499,6 +499,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Action/Attribute:trigger_list+' => '', 'Class:Action/Attribute:finalclass' => 'Type', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/de.dictionary.itop.core.php b/dictionaries/de.dictionary.itop.core.php index 3e8c79e44..92c7724ad 100644 --- a/dictionaries/de.dictionary.itop.core.php +++ b/dictionaries/de.dictionary.itop.core.php @@ -498,6 +498,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Action/Attribute:trigger_list+' => 'Trigger, die mit dieser Aktion verknüpft sind', 'Class:Action/Attribute:finalclass' => 'Typ', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php index 90699a621..5c2d92e66 100644 --- a/dictionaries/en.dictionary.itop.core.php +++ b/dictionaries/en.dictionary.itop.core.php @@ -499,6 +499,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Action/Attribute:trigger_list+' => 'Triggers linked to this action', 'Class:Action/Attribute:finalclass' => 'Action sub-class', 'Class:Action/Attribute:finalclass+' => 'Name of the final class', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.', )); // diff --git a/dictionaries/es_cr.dictionary.itop.core.php b/dictionaries/es_cr.dictionary.itop.core.php index 564366dfe..a3c4b172e 100644 --- a/dictionaries/es_cr.dictionary.itop.core.php +++ b/dictionaries/es_cr.dictionary.itop.core.php @@ -500,6 +500,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Action/Attribute:trigger_list+' => 'Disparadores Asociados a esta Acción', 'Class:Action/Attribute:finalclass' => 'Clase', 'Class:Action/Attribute:finalclass+' => 'Clase', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/fr.dictionary.itop.core.php b/dictionaries/fr.dictionary.itop.core.php index 67b7df14a..105191cf0 100644 --- a/dictionaries/fr.dictionary.itop.core.php +++ b/dictionaries/fr.dictionary.itop.core.php @@ -497,6 +497,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Action/Attribute:trigger_list+' => '', 'Class:Action/Attribute:finalclass' => 'Sous-classe d\'Action', 'Class:Action/Attribute:finalclass+' => 'Nom de la classe instanciable', + 'Action:WarningNoTriggerLinked' => 'Attention, aucun déclencheur n\'est associé à l\'action. Elle ne sera pas active tant qu\'elle n\'en aura pas au moins 1.', )); // diff --git a/dictionaries/hu.dictionary.itop.core.php b/dictionaries/hu.dictionary.itop.core.php index c4f1dc028..bbaa2ed68 100755 --- a/dictionaries/hu.dictionary.itop.core.php +++ b/dictionaries/hu.dictionary.itop.core.php @@ -497,6 +497,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Action/Attribute:trigger_list+' => '', 'Class:Action/Attribute:finalclass' => 'Típus', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/it.dictionary.itop.core.php b/dictionaries/it.dictionary.itop.core.php index 0a4788511..0f11540e1 100644 --- a/dictionaries/it.dictionary.itop.core.php +++ b/dictionaries/it.dictionary.itop.core.php @@ -499,6 +499,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Action/Attribute:trigger_list+' => 'Triggers colleagati a questa azione', 'Class:Action/Attribute:finalclass' => 'Tipo', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/ja.dictionary.itop.core.php b/dictionaries/ja.dictionary.itop.core.php index 1ce769203..2c836c77e 100644 --- a/dictionaries/ja.dictionary.itop.core.php +++ b/dictionaries/ja.dictionary.itop.core.php @@ -497,6 +497,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Action/Attribute:trigger_list+' => 'このアクションにリンクされたトリガー', 'Class:Action/Attribute:finalclass' => 'タイプ', 'Class:Action/Attribute:finalclass+' => 'タイプ', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/nl.dictionary.itop.core.php b/dictionaries/nl.dictionary.itop.core.php index ab503644b..f94ccd05e 100644 --- a/dictionaries/nl.dictionary.itop.core.php +++ b/dictionaries/nl.dictionary.itop.core.php @@ -505,6 +505,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Action/Attribute:trigger_list+' => 'Triggers gelinkt aan deze actie', 'Class:Action/Attribute:finalclass' => 'Type', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/pl.dictionary.itop.core.php b/dictionaries/pl.dictionary.itop.core.php index 17662d951..68ab4af05 100644 --- a/dictionaries/pl.dictionary.itop.core.php +++ b/dictionaries/pl.dictionary.itop.core.php @@ -499,6 +499,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Action/Attribute:trigger_list+' => 'Wyzwalacze powiązane z działaniem', 'Class:Action/Attribute:finalclass' => 'Podklasa działania', 'Class:Action/Attribute:finalclass+' => 'Nazwa ostatniej klasy', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/pt_br.dictionary.itop.core.php b/dictionaries/pt_br.dictionary.itop.core.php index 2d8a313b8..aa7f882f5 100644 --- a/dictionaries/pt_br.dictionary.itop.core.php +++ b/dictionaries/pt_br.dictionary.itop.core.php @@ -499,6 +499,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Action/Attribute:trigger_list+' => 'Gatilhos ligados a esta ação', 'Class:Action/Attribute:finalclass' => 'Tipo', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/ru.dictionary.itop.core.php b/dictionaries/ru.dictionary.itop.core.php index 16144e539..e184f6d20 100644 --- a/dictionaries/ru.dictionary.itop.core.php +++ b/dictionaries/ru.dictionary.itop.core.php @@ -486,6 +486,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Action/Attribute:trigger_list+' => 'Триггеры, которые запускают данное действие', 'Class:Action/Attribute:finalclass' => 'Тип', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/sk.dictionary.itop.core.php b/dictionaries/sk.dictionary.itop.core.php index 0054e9847..3c713d411 100644 --- a/dictionaries/sk.dictionary.itop.core.php +++ b/dictionaries/sk.dictionary.itop.core.php @@ -496,6 +496,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Action/Attribute:trigger_list+' => '', 'Class:Action/Attribute:finalclass' => 'Typ', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/tr.dictionary.itop.core.php b/dictionaries/tr.dictionary.itop.core.php index 7c9c68874..b9df78acc 100644 --- a/dictionaries/tr.dictionary.itop.core.php +++ b/dictionaries/tr.dictionary.itop.core.php @@ -507,6 +507,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Action/Attribute:trigger_list+' => 'İşleme bağlı tetikleyici', 'Class:Action/Attribute:finalclass' => 'Tip', 'Class:Action/Attribute:finalclass+' => '', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); // diff --git a/dictionaries/zh_cn.dictionary.itop.core.php b/dictionaries/zh_cn.dictionary.itop.core.php index d5a5ef6f0..531f9ddd6 100644 --- a/dictionaries/zh_cn.dictionary.itop.core.php +++ b/dictionaries/zh_cn.dictionary.itop.core.php @@ -498,6 +498,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Action/Attribute:trigger_list+' => '该操作关联的触发器', 'Class:Action/Attribute:finalclass' => 'Action sub-class', 'Class:Action/Attribute:finalclass+' => 'Name of the final class', + 'Action:WarningNoTriggerLinked' => 'Warning, no trigger is linked to the action. It will not be active until it has at least 1.~~', )); //