//моя реализация
function n46_answers_ResultUpdate($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID, $CHECK_RIGHTS)
{
if ($WEB_FORM_ID == 33 && $NEW_STATUS_ID == 59)
{
CModule::IncludeModule("form");
$arAnswer = CFormResult::GetDataByID($RESULT_ID, array(), $arResult, $arAnswer2);
$rsEM = CEventMessage::GetByID("125");
$arEM = $rsEM->Fetch();
$arEM[EMAILX_TO]=$arAnswer[MAIL_VOP][0][USER_TEXT];
$arEM[SOME_FIO]=$arAnswer[FIO][0][USER_TEXT];
$arEM[SOME_VOPROS]=$arAnswer[VOPROS1][0][USER_TEXT];
$arEM[SOME_ID]=$RESULT_ID;
if (CEvent::Send("FORM_STATUS_CHANGE_VOPROS_xxxx", "s2", $arEM)){
echo "Почтовое событие успешно создано.";
}else{ global $strError; echo $strError;}
}
}
AddEventHandler('form', 'onAfterResultStatusChange', 'n46_answers_ResultUpdate'); |