Documentation

Update

Description and parameters

bool
CPosting::Update(
 int ID,
 array arFields
);

Updates information about a posting by ID. Non-static method.

Parameters

ParameterDescriptionAvailable from version
ID Posting ID.
arFields Array with values "Posting" object fields. Additional fields:
USD_ID - array with email campaign IDs;
GROUP_ID - array with user group IDs.

Returned values

Returns true in success. Otherwise returns false, and class variable LAST_ERROR contains an error message.

Examples

$posting = new CPosting;
$arFields = Array(
    "FROM_FIELD" => $FROM_FIELD,
    "TO_FIELD" => $TO_FIELD,
    "BCC_FIELD" => $BCC_FIELD,
    "EMAIL_FILTER" => $EMAIL_FILTER,
    "SUBJECT" => $SUBJECT,
    "BODY_TYPE" => ($BODY_TYPE <> "html"? "text":"html"),
    "BODY" => $BODY,
    "DIRECT_SEND" => ($DIRECT_SEND <> "Y"? "N":"Y"),
    "CHARSET" => $CHARSET,
    "SUBSCR_FORMAT" => ($SUBSCR_FORMAT<>"html" && $SUBSCR_FORMAT<>"text"? false:$SUBSCR_FORMAT),
    "RUB_ID" => $RUB_ID,
    "GROUP_ID" => $GROUP_ID
);
if($STATUS <> "")
{
    if($STATUS<>"S" && $STATUS<>"E" && $STATUS<>"P")
        $STATUS = "D";
    $arFields["STATUS"] = $STATUS;
    if($STATUS == "D")
    {
        $arFields["DATE_SENT"] = false;
        $arFields["SENT_BCC"] = "";
        $arFields["ERROR_EMAIL"] = "";
    }
}
if(!$posting->Update($ID, $arFields))
    $strError = $posting->LAST_ERROR;


© «Bitrix24», 2001-2024