diff --git a/core/coreexception.class.inc.php b/core/coreexception.class.inc.php index 3365f8575..112c61ed1 100644 --- a/core/coreexception.class.inc.php +++ b/core/coreexception.class.inc.php @@ -183,11 +183,25 @@ class CoreCannotSaveObjectException extends CoreException } } +/** + * @since 2.7.0 N°2555 + */ +class CorePortalInvalidActionRuleException extends CoreException +{ + +} + +/** + * @since 2.7.0 N°2555 + */ class CoreOqlException extends CoreException { } +/** + * @since 2.7.0 N°2555 + */ class CoreOqlMultipleResultsForbiddenException extends CoreOqlException { diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php index 31716ab00..5e986f169 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php @@ -25,7 +25,7 @@ namespace Combodo\iTop\Portal\Helper; use BinaryExpression; use Combodo\iTop\Portal\Brick\BrickCollection; use CoreOqlMultipleResultsForbiddenException; -use CoreUnexpectedValue; +use CorePortalInvalidActionRuleException; use DBObject; use DBSearch; use DOMFormatException; @@ -279,6 +279,7 @@ class ContextManipulatorHelper * @throws \Exception * @throws \CoreException * @throws \OQLException + * @throws \CorePortalInvalidActionRuleException N°2555 if action_rule query return more than 1 result (we should only have 1 source object) */ public function PrepareObject(array $aData, DBObject &$oObject) { @@ -351,7 +352,7 @@ class ContextManipulatorHelper // N°2555 : disallow searches without any condition $sErrMsg = "Portal query was stopped: action_rule '$sId' searches for '$sSearchClass' without any condition is forbidden"; IssueLog::Error($sErrMsg); - throw new CoreUnexpectedValue($sErrMsg); + throw new CorePortalInvalidActionRuleException($sErrMsg); } // Checking for silos @@ -372,7 +373,7 @@ class ContextManipulatorHelper // N°2555 : disallow searches returning more than 1 result $sErrMsg = "Portal query was stopped: action_rule '$sId' gives more than 1 '$sSearchClass' result"; IssueLog::Error($sErrMsg); - throw new CoreUnexpectedValue($sErrMsg); + throw new CorePortalInvalidActionRuleException($sErrMsg); } if ($oSourceObject === null) {