Bitrix Site Manager

CTicket::GetList

record set
CTicket::GetList(
 varchar &by,
 varchar &order,
 array arFilter=array(),
 boolean &is_filtered,
 char(1) CHECK_RIGHTS="Y",
 char(1) get_user_name="Y",
 char(1) get_dictionary_name="Y",
 char(2) lang=LANG
);

The method GetList obtains a list of techsupport tickets.

Parameters

ParameterDescription
by Identifier specifying the name of the field by which sorting is to be performed. The following values are possible:
  • s_id - by the ID;
  • s_lid - by the site for which the ticket was created;
  • s_lamp - by indicator;
  • s_date_create - by the date of creation;
  • s_timestamp - by the modification date;
  • s_date_close - by the closing date;
  • s_owner - by creator;
  • s_modified_by - by the ID of the user who has modified the ticket;
  • s_title - by the title;
  • s_responsible - by the ID of the person in charge;
  • s_messages - by the number of messages;
  • s_category - by the category ID;
  • s_criticality - by the emergency level ID;
  • s_status - by the status ID;
  • s_mark - by the mark ID;
  • s_online - by the number of users.
order Sort order. One of the following values is possible:
  • desc - descending (default);
  • asc - ascending
arFilter An array used to filter values. The following keys are possible:
  • ID - the ticket ID (complex logic allowed);
  • ID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the ticket ID (default). If "N", the method performs loose searches (entry is sufficient);
  • LID - the site ID;
  • LID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the language ID (default). If "N", the method performs loose searches (entry is sufficient);
  • LAMP - array of indicator values: "red", "yellow", "green", "green_s", "grey";
  • DATE_CREATE_1 - lower bound of the date range when the ticket could be created;
  • DATE_CREATE_2 - upper bound of the date range when the ticket could be created;
  • DATE_TIMESTAMP_1 - lower bound of the date range when the ticket could be modified;
  • DATE_TIMESTAMP_2 - upper bound of the date range when the ticket could be modified;
  • DATE_CLOSE_1 - lower bound of the date range when the ticket could be closed;
  • DATE_CLOSE_2 - upper bound of the date range when the ticket could be closed;
  • AUTO_CLOSE_DAYS1 - lower bound of the day range on expiry of which the ticket will be automatically closed in case the author does not respond;
  • AUTO_CLOSE_DAYS2 - upper bound of the day range on expiry of which the ticket will be automatically closed in case the author does not respond;
  • TICKET_TIME_1 - lower bound of the day range from the ticket opening till closing;
  • TICKET_TIME_2 - upper bound of the day range from the ticket opening till closing;
  • TITLE - the ticket title (complex logic allowed);
  • TITLE_EXACT_MATCH - set to "Y" for exact match searches when filtering by the ticket title (default). If "N", the method performs loose searches (entry is sufficient);
  • MESSAGES1 - lower bound of the range of messages in the ticket;
  • MESSAGES1 - upper bound of the range of messages in the ticket;
  • OWNER - the ticket owner. The search is performed by the user ID, login, first and last names and the symbolic code (complex logic allowed);
  • OWNER_EXACT_MATCH - set to "Y" for exact match searches when filtering by the ticket owner (default). If "N", the method performs loose searches;
  • CREATED_BY - the ticket creator. The search is performed by the user ID, login, first and last names and the name of the module from which the ticket originates (complex logic allowed);
  • CREATED_BY_EXACT_MATCH - set to "Y" for exact match searches when filtering by the ticket creator (default). If "N", the method performs loose searches;
  • MODIFIED_BY - the person who modified the ticket. The search is performed by the user ID, login, first and last names and the name of the module from which the ticket was modified (complex logic allowed);
  • MODIFIED_BY_EXACT_MATCH - set to "Y" for exact match searches when filtering by the status symbolic  code (default). If "N", the method performs loose searches;
  • RESPONSIBLE - the person in charge of the ticket. The search is performed by the user ID, login, first and last names (complex logic allowed);
  • RESPONSIBLE_EXACT_MATCH - set to "Y" for exact match searches when filtering by the person in charge of the ticket (default). If "N", the method performs loose searches;
  • RESPONSIBLE_ID - the ID of the user responsible for the ticket. If set to "0", only the tickets without a responsible person are selected;
  • CATEGORY - the ticket category ID (0 - no category);
  • CATEGORY_SID - the symbolic code of the ticket category (complex logic allowed);
  • CATEGORY_SID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the category symbolic code (default). If "N", the method performs loose searches;
  • CRITICALITY - the ID of ticket emergency level (0 - no emergency level);
  • CRITICALITY_SID - the emergency level symbolic code (complex logic allowed);
  • CRITICALITY_SID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the emergency level symbolic code (default). If "N", the method performs loose searches;
  • STATUS - the ID of the ticket status (0 - no status);
  • STATUS_SID - the ticket status symbolic code (complex logic allowed);
  • STATUS_SID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the status symbolic code (default). If "N", the method performs loose searches;
  • MARK - the ID of the reply mark (0 - no mark);
  • MARK_SID - the reply mark symbolic code (complex logic allowed);
  • SOURCE - the source ID (0 - from the web);
  • SOURCE_SID - the source symbolic code (complex logic allowed);
  • SOURCE_SID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the source symbolic code (default). If "N", the method performs loose searches;
  • MESSAGE - the message body text (complex logic allowed);
  • MESSAGE_EXACT_MATCH - set to "Y" for exact match searches when filtering by the message body text (default). If "N", the method performs loose searches;
  • LAST_MESSAGE_USER_ID - the ID of a user who has created the last message in the ticket (complex logic allowed);
  • LAST_MESSAGE_USER_ID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the ID of a user who has created the last message in the ticket (default). If "N", the method performs loose searches;
  • LAST_MESSAGE_SID - the symbolic code of a user who has created the last message in the ticket (if the source is an e-mail, this can be the e-mail address; if the source is a phone call, this can be the phone number) (complex logic allowed);
  • LAST_MESSAGE_SID_EXACT_MATCH - set to "Y" for exact match searches when filtering by the symbolic code of a user who has created the last message in the ticket (default). If "N", the method performs loose searches;
  • SUPPORT_COMMENTS - techsupport comments which can be viewed by users who are members of the techsupport user group;
  • SUPPORT_COMMENTS_EXACT_MATCH - set to "Y" for exact match searches when filtering by the techsupport comments (default). If "N", the method performs loose searches;
is_filtered On return, this variable contains true if the returned list of contracts is filtered by any above criteria, or false otherwise.
CHECK_RIGHTS If set to "Y", only the tickets the current user can view are selected (default). If "N", all tickets regardless of the current user permissions are selected.
get_user_name If set to "Y", the following fields describing the parameters of users related to this ticket are also returned when selecting tickets:
  • OWNER_LOGIN
  • OWNER_NAME
  • RESPONSIBLE_LOGIN
  • RESPONSIBLE_NAME
  • MODIFIED_LOGIN
  • MODIFIED_NAME
  • LAST_MESSAGE_LOGIN
  • LAST_MESSAGE_NAME
  • CREATED_LOGIN
  • CREATED_EMAIL
  • CREATED_NAME
If "N", all the above fields are not returned which speeds up the method execution.
get_dictionary_name If set to "Y", the following fields from the techsupport dictionary are also returned when selecting tickets:
  • CATEGORY_NAME
  • CATEGORY_SID
  • CRITICALITY_NAME
  • CRITICALITY_SID
  • STATUS_NAME
  • STATUS_SID
  • MARK_NAME
  • MARK_SID
  • SOURCE_NAME
  • SOURCE_SID
If "N", all the above fields are not returned which speeds up the method execution.
lang Two-character identifier of the language whose format is to be used to get the time parameters of a ticket (time of creation, modification, closing). The current site identifier is used by default.

Example


<?
$FilterArr = Array(
 "find_id",
 "find_lid",
 "find_lamp",
 "find_date_create1",
 "find_date_create2",
 "find_date_timestamp1",
 "find_date_timestamp2",
 "find_date_close1",
 "find_date_close2",
 "find_close",
 "find_ticket_time_1",
 "find_ticket_time_2",
 "find_title",
 "find_messages1",
 "find_messages2",
 "find_owner",
 "find_created_by",
 "find_responsible",
 "find_responsible_id",
 "find_category_id",
 "find_criticality_id",
 "find_status_id",
 "find_mark_id",
 "find_source_id",
 "find_modified_by",
 "find_message"
 );

if (strlen($set_filter)>0)
    InitFilterEx($FilterArr,"TICKET_LIST","set",true);
else
    InitFilterEx($FilterArr,"TICKET_LIST","get",true);

if (strlen($del_filter) > 0)
    DelFilterEx($FilterArr,"TICKET_LIST",true);

if (CheckFilter())
{
 $arFilter = Array(
 "ID" => $find_id,
 "LID" => $find_lid,
 "LAMP" => $find_lamp,
 "DATE_CREATE_1" => $find_date_create1,
 "DATE_CREATE_2" => $find_date_create2,
 "DATE_TIMESTAMP_1" => $find_date_timestamp1,
 "DATE_TIMESTAMP_2" => $find_date_timestamp2,
 "DATE_CLOSE_1" => $find_date_close1,
 "DATE_CLOSE_2" => $find_date_close2,
 "CLOSE" => $find_close,
 "TICKET_TIME_1" => $find_ticket_time_1,
 "TICKET_TIME_2" => $find_ticket_time_2,
 "TITLE" => $find_title,
 "MESSAGES1" => $find_messages1,
 "MESSAGES2" => $find_messages2,
 "OWNER" => $find_owner,
 "CREATED_BY" => $find_created_by,
 "RESPONSIBLE" => $find_responsible,
 "RESPONSIBLE_ID" => $find_responsible_id,
 "CATEGORY" => $find_category_id,
 "CRITICALITY" => $find_criticality_id,
 "STATUS" => $find_status_id,
 "MARK" => $find_mark_id,
 "SOURCE" => $find_source_id,
 "MODIFIED_BY" => $find_modified_by,
 "MESSAGE" => $find_message
 );
}
$tickets = CTicket::GetList($by, 
                            $order,
                            $arFilter,
                            $is_filtered);
?>