G
G
genrich_pauls2020-01-21 10:49:47
1C-Bitrix
genrich_pauls, 2020-01-21 10:49:47

How not to be tied to the id of the letter on Bitrix by sending a letter to the administrator with an attachment, and to the user without?

5e26ad11ab279454395653.png

if(empty($arResult["ERROR_MESSAGE"]))
        {
            $arFields = Array(
                "AUTHOR" => $_POST["user_name"],
                "AUTHOR_EMAIL" => $_POST["user_email"],
                "PHONE" => $_POST["user_phone"],
                "EMAIL_TO" => $arParams["EMAIL_TO"],
                "TEXT" => $_POST["MESSAGE"],
                "FILE_NAME" => $_FILES['file']['name']
            );
            if(!empty($arParams["EVENT_MESSAGE_ID"]))
            {
                foreach($arParams["EVENT_MESSAGE_ID"] as $v)
                    if(IntVal($v) > 0)
                      
                          	CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields, "N", IntVal($v));
                       
                          	CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields, "N", IntVal($v), $file_array);
                          
                        
              			
            }
            else
             
                   CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","49");
                
              
                  CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","7",$file_array);
             
                
            $_SESSION["MF_NAME"] = htmlspecialcharsbx($_POST["user_name"]);
            $_SESSION["MF_EMAIL"] = htmlspecialcharsbx($_POST["user_email"]);
            $_SESSION["MF_PHONE"] = htmlspecialcharsbx($_POST["user_phone"]);
            LocalRedirect($APPLICATION->GetCurPageParam("success=".$arResult["PARAMS_HASH"], Array("success")));
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yaroslav Alexandrov, 2020-01-21
@alexyarik

You didn't go down that path. You need to use the OnBeforeEventAdd
event handler to change or add some value at the time of adding the mail event:
1) Get the necessary data in the handler
2) Define the admin (write a condition)
3) Reset the value of the macro where the attachment is located for non-admins

G
genrich_pauls, 2020-01-21
@genrich_pauls

And where and how to substitute it, tell me more please, I have a component of the main fitback file component.php, I
tried to determine the component in this file by email, but I have 2 emails adin [email protected], and another [email protected] from which letters are sent to inf0 @ didn’t work out, this way define the admin Define the admin (write a condition)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question