Documentation

Set

Description and parameters

int
CTicket::Set(
 array arFields,
 int &MESSAGE_ID,
 int TICKET_ID="",
 char(1) CHECK_RIGHTS="Y"

);

Method creates a new message, or modifies an existing message in case message ID is indicated in the second parameter. Returns ID for created message or modified query ID. Non-static method.

Method parameters

ParameterDescriptionAvailable from version
arFields Array with query parameters. The following indexes are available in the array:
  • *TITLE - query title (required field when creating a new query)
  • MESSAGE - message body (required field when creating a new query)
  • IMAGE - array describing an uploaded image; the array allows for the following indexes:
    • name - source name for uploaded file
    • type - type of uploaded file (for example: "image/gif")
    • tmp_name - temporary filename on the server
    • error - error code ("0" - no errors)
    • size - uploaded file size
    • MODULE_ID - module identifier ("support")
  • *OWNER_SID - query author symbolic code; can indicate any value, identifying the message author - email, phone number, address and etc.
  • *OWNER_USER_ID - query author ID (default value - current user ID)
  • *SOURCE_SID - query source symbolic code (default - "web")
  • *CREATED_MODULE_NAME - module identifier from which query is created (default - "support")
  • **MESSAGE_AUTHOR_SID - query author symbolic code (can indicate any value, identifying message author - email, phone number, address and etc)
  • **MESSAGE_AUTHOR_USER_ID - user ID - message author (by default - current user ID)
  • **MESSAGE_SOURCE_SID - message source symbolic code (by default - "web")
  • **MODIFIED_MODULE_NAME - module identifier from which the query is modified (by default - "support")
  • **HIDDEN - "Y" - message will be added as hidden and will be visible only to technical support employees; "N" - message will be added as visible for both query author and technical support employees (by default)
  • CATEGORY_SID - category symbolic code
  • CATEGORY_ID - category ID.
  • CRITICALITY_SID - criticality symbolic code
  • STATUS_SID - status symbolic code
  • MARK_ID - answer rating ID
  • RESPONSIBLE_USER_ID - user ID, responsible for query
  • SUPPORT_COMMENTS - comment visible only to users included into technical support group
  • CLOSE - "Y" - close the query; "N" - open the query
  • AUTO_CLOSE_DAYS - period of days to expire until automatically closing the query if there was no author reply
* - this field can be used for creating new queries
** - this field is used only when modifying existing queries.
MESSAGE_ID Added message ID. Optional parameter.
TICKET_ID Modified query ID.
CHECK_RIGHTS Flag for required user access permission check: "Y" - check access permissions for current user that creates or modifies a query; "N" - crate and modify queries independently from current user access permissions. Optional parameter. Default value - "Y".
MID Pass message ID when editing the query in the variable; when message is added, writes created query ID to the variable
EMAIL_NOTIFY Optional parameter. Default value - "Y". Deleted from version 3.3.11
SEND_EMAIL_TO_AUTHOR Optional parameter. Default value - "Y".
SEND_EMAIL_TO_TECHSUPPORT Optional parameter. Default value - "Y".

Example

Example of code that adds a new message to technical support, received by email,
or that adds a new message into query if $TICKET_ID is specified:
<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
CModule::IncludeModule("support");
$arFields = array(
	"CREATED_MODULE_NAME"       => "mail",
	"MODIFIED_MODULE_NAME"      => "mail",
	"OWNER_SID"                 => "user@mail.com",
	"SOURCE_SID"                => "email",
	"MESSAGE_AUTHOR_SID"        => "user@mail.com",
	"MESSAGE_SOURCE_SID"        => "email",
	"TITLE"                     => "title",
	"MESSAGE"                   => "message"
	);
//$TICKET_ID = 866;
$NEW_TICKET_ID = CTicket::Set($arFields, $MESSAGE_ID, $TICKET_ID, "N");
echo "MESSAGE_ID = ".$MESSAGE_ID;
?>

© «Bitrix24», 2001-2024