Created
July 21, 2018 13:31
-
-
Save davletyarov/085ea91a86361576b6a5f079cfdbce9e to your computer and use it in GitHub Desktop.
Класс обработчика событии для сделок
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Davletyarov\Core\Crm\Handler; | |
class DealHandler | |
{ | |
public function onBeforeCrmDealAddAndUpdate(&$arFields) | |
{ | |
// проверяем не случаи ли обновление стади сделки ч/з прогресс бар | |
if (!isset($_REQUEST['ACTION']) && 'SAVE_PROGRESS' != $_REQUEST['ACTION']) { | |
if (!$arFields['COMPANY_ID'] && !$arFields['CONTACT_BINDINGS']) { | |
// перебиваем штатный сообщение об ошибке | |
$arFields['RESULT_MESSAGE'] = 'Клиент для сделки обязателен!'; | |
$GLOBALS['APPLICATION']->ThrowException('Клиент для сделки обязателен!'); | |
return false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if (!isset($_REQUEST['ACTION']) && 'SAVE_PROGRESS' != $_REQUEST['ACTION'])
Если
!isset($_REQUEST['ACTION']) == true
, то'SAVE_PROGRESS' != $_REQUEST['ACTION']
уж подавноtrue
, раз$_REQUEST['ACTION']
не установлен, он и не может быть равен'SAVE_PROGRESS'