Documentation

ChangeStatus

CPosting::ChangeStatus(
    int ID,
    string status
);

The method ChangeStatus changes the issue status and performs action according to the rules summarized in the table below.

Current statusNew statusActions
Draft Sending Creates a list of addresses to which to send messages.
Sending Suspended No action.
Suspended Sending No action.
Sending Errors occurred No action.
Sending Sent No action.
Errors occurred Sending List of fault addresses is copied to the delivery list and the former clears.
Errors occurred,
Sent,
Suspended
Draft The list of fault addresses, the delivery list and the successful list are all cleared.

Parameters

ParameterDescription
ID The issue ID.
status The new status of the issue. Can be one of the following:
  • "S" (sent successfully); 
  • "E" (error); 
  • "P" (partially sent); 
  • "W" (suspended);
  • "D" (draft).

Return Values

Returns true on successful status change, or false otherwise. On error, the class variable LAST_ERROR contains the error description.

Example

 

//******************************
// Stop sending the message
//******************************
if($action=="stop" && $ID>0 && $POST_RIGHT=="W")
{
    $cPosting->ChangeStatus($ID, "W");
}
© «Bitrix24», 2001-2024