Documentation

Update

bool
CEventMessage::Update(
 int id,
 array fields
)

The method updates the mail template with ID. Returns "true" on success. In case of error the method will return false, and the LAST_ERROR object property will contain the error description. Non-static method.

Parameters

ParameterDescription
id ID of the updated record.
fields An array of the fields values in the format array("field"=>"value" [, ...]).

See Also

Examples of use

<?
if($REQUEST_METHOD=="POST" && (strlen($save)>0 || strlen($apply)>0)&& $MAIN_RIGHT=="W")
{
    $em = new CEventMessage;
    $arFields = Array(
        "ACTIVE"        => $ACTIVE,
        "EVENT_NAME"    => $EVENT_NAME,
        "LID"           => $LID,
        "EMAIL_FROM"    => $EMAIL_FROM,
        "EMAIL_TO"      => $EMAIL_TO,
        "BCC"           => $BCC,
        "SUBJECT"       => $SUBJECT,
        "MESSAGE"       => $MESSAGE,
        "BODY_TYPE"     => $BODY_TYPE
        );
    if($ID>0)
    {
        $res = $em->Update($ID, $arFields);
    }
    else
    {
        $ID = $em->Add($arFields);
        $res = ($ID>0);
    }
    if(!$res)
    {
        $strError .= $em->LAST_ERROR."<br>";
        $bVarsFromForm = true;
    }
    else
    {
        if (strlen($save)>0) 
            LocalRedirect(BX_ROOT."/admin/message_admin.php?lang=".LANGUAGE_ID);
        else
            LocalRedirect(BX_ROOT."/admin/message_edit.php?lang=".LANGUAGE_ID."&ID=".$ID);
    }
}
?>


© «Bitrix24», 2001-2024
Up