. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ namespace Espo\Tools\EntityManager\Hook\Hooks; use Espo\Core\Exceptions\Conflict; use Espo\Core\Exceptions\Error\Body; use Espo\Tools\EntityManager\Hook\UpdateHook; use Espo\Tools\EntityManager\Params; /** * @noinspection PhpUnused */ class PipelinesBeforeUpdateHook implements UpdateHook { private const string PARAM = 'pipelines'; public function process(Params $params, Params $previousParams): void { if ($params->get(self::PARAM) && !$params->get('statusField')) { throw Conflict::createWithBody( 'cannotEnablePipelinesWithNoStatusField', Body::create()->withMessageTranslation('cannotEnablePipelinesWithNoStatusField', 'EntityManager') ); } } }