dolibarr 24.0.0-beta
Tickets Class Reference
Inheritance diagram for Tickets:
Collaboration diagram for Tickets:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id, $contact_list=1)
 Get properties of a Ticket object.
 
 getByTrackId ($track_id, $contact_list=1)
 Get properties of a Ticket object from track id.
 
 getByRef ($ref, $contact_list=1)
 Get properties of a Ticket object from ref.
 
 index ($socid=0, $sortfield="t.rowid", $sortorder="ASC", $limit=100, $page=0, $sqlfilters='', $properties='', $loadcontacts=0, $pagination_data=false)
 List tickets.
 
 post ($request_data=null)
 Create ticket object.
 
 postNewMessage ($request_data=null)
 Add a new message to an existing ticket identified by property ->track_id into request.
 
 put ($id, $request_data=null)
 Update ticket.
 
 delete ($id)
 Delete ticket.
 
 postContact (int $id, int $contactid, string $type, string $source="external", int $notrigger=0)
 Add a contact type of given ticket.
 
 deleteContact (int $id, int $contactid, string $type, string $source="external")
 Unlink a contact type of given ticket.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas @phpstan-template T.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _checkValExtrafieldsForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 getCommon ($id=0, $track_id='', $ref='', $contact_list=1)
 Get properties of a Ticket object Return an array with ticket information.
 
 _validate ($data)
 Validate fields before create or update object.
 
 _validateMessage ($data)
 Validate fields before create or update object message.
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

Definition at line 32 of file api_tickets.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Tickets::_cleanObjectDatas ( $object)
protected

Clean sensible object datas @phpstan-template T.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

@phpstan-param T $object @phpstan-return T

Reimplemented from DolibarrApi.

Definition at line 685 of file api_tickets.class.php.

References $object, and _cleanObjectDatas().

Referenced by _cleanObjectDatas(), getCommon(), and index().

◆ _validate()

Tickets::_validate ( $data)
private

Validate fields before create or update object.

Parameters
?array<string,string>$data Data to validate
Returns
array<string,string>
Exceptions
RestException

Definition at line 635 of file api_tickets.class.php.

Referenced by post().

◆ _validateMessage()

Tickets::_validateMessage ( $data)
private

Validate fields before create or update object message.

Parameters
?array<string,string>$data Data to validate
Returns
array<string,string>
Exceptions
RestException

Definition at line 658 of file api_tickets.class.php.

Referenced by postNewMessage().

◆ delete()

Tickets::delete ( $id)

Delete ticket.

Parameters
int$idTicket ID
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}

Definition at line 601 of file api_tickets.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ deleteContact()

Tickets::deleteContact ( int $id,
int $contactid,
string $type,
string $source = "external" )

Unlink a contact type of given ticket.

Since
12.0.0 Initial implementation
Parameters
int$idId of ticket to update
int$contactidId of contact
string$typeType of the contact (BILLING, SHIPPING, CUSTOMER).
string$sourceinternal=Contact intern (llx_user), external=Contact extern (llx_socpeople)

@url DELETE {id}/contact/{contactid}/{type}

Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}
Exceptions
RestException401
RestException404
RestException500 System error

Definition at line 896 of file api_tickets.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ get()

Tickets::get ( $id,
$contact_list = 1 )

Get properties of a Ticket object.

Return an array with ticket information

Parameters
int$idID of ticket
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
Returns
Object Object with cleaned properties
Exceptions
RestException401
RestException403
RestException404

Definition at line 78 of file api_tickets.class.php.

References $id, and getCommon().

◆ getByRef()

Tickets::getByRef ( $ref,
$contact_list = 1 )

Get properties of a Ticket object from ref.

Return an array with ticket information

Parameters
string$refReference for ticket
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
Returns
array|mixed Data without useless information

@url GET ref/{ref}

Exceptions
RestException401
RestException403
RestException404

Definition at line 118 of file api_tickets.class.php.

References getCommon().

◆ getByTrackId()

Tickets::getByTrackId ( $track_id,
$contact_list = 1 )

Get properties of a Ticket object from track id.

Return an array with ticket information

Parameters
string$track_idTracking ID of ticket
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
Returns
array|mixed Data without useless information

@url GET track_id/{track_id}

Exceptions
RestException401
RestException403
RestException404

Definition at line 98 of file api_tickets.class.php.

References getCommon().

◆ getCommon()

Tickets::getCommon ( $id = 0,
$track_id = '',
$ref = '',
$contact_list = 1 )
private

Get properties of a Ticket object Return an array with ticket information.

Parameters
int$idID of ticket
string$track_idTracking ID of ticket
string$refReference for ticket
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
Returns
array|mixed Data without useless information

Definition at line 133 of file api_tickets.class.php.

References $conf, $id, DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and dolGetFirstLastname().

Referenced by get(), getByRef(), and getByTrackId().

◆ index()

Tickets::index ( $socid = 0,
$sortfield = "t.rowid",
$sortorder = "ASC",
$limit = 100,
$page = 0,
$sqlfilters = '',
$properties = '',
$loadcontacts = 0,
$pagination_data = false )

List tickets.

Get a list of tickets

Parameters
int$socidFilter list with thirdparty ID
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:>:'20160101') and (t.fk_statut:=:1)"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
int$loadcontactsLoad also contacts/addresses (0=No, 1=Yes)
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
Returns
array Array of ticket objects @phan-return Ticket[]|array{data:Ticket[],pagination:array{total:int,page:int,page_count:int,limit:int}} @phpstan-return Ticket[]|array{data:Ticket[],pagination:array{total:int,page:int,page_count:int,limit:int}}

Definition at line 232 of file api_tickets.class.php.

References _cleanObjectDatas(), and DolibarrApi\_filterObjectProperties().

◆ post()

Tickets::post ( $request_data = null)

Create ticket object.

Parameters
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of ticket

Definition at line 351 of file api_tickets.class.php.

References DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), _validate(), generate_random_id(), and sanitizeVal().

◆ postContact()

Tickets::postContact ( int $id,
int $contactid,
string $type,
string $source = "external",
int $notrigger = 0 )

Add a contact type of given ticket.

Parameters
int$idId of ticket to update
int$contactidId of contact to add
string$typeType (code in dictionary) of the contact (BILLING, SHIPPING, CUSTOMER + possibly your own)
string$sourceinternal=Contact intern (llx_user), external=Contact extern (llx_socpeople)
int$notrigger0=Enable all triggers (default), 1=Disable all triggers
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}

@url POST {id}/contact/{contactid}/{type}

Exceptions
RestException400
RestException401
RestException403
RestException404
RestException503

Definition at line 786 of file api_tickets.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ postNewMessage()

Tickets::postNewMessage ( $request_data = null)

Add a new message to an existing ticket identified by property ->track_id into request.

Parameters
array$request_dataRequest data @phan-param ?array<string,mixed> $request_data @phpstan-param ?array<string,mixed> $request_data
Returns
int|array ID of ticket, or ticket/action IDs when requested @phan-return int|array{ticket_id:int,action_id:int} @phpstan-return int|array{ticket_id:int,action_id:int}

Definition at line 407 of file api_tickets.class.php.

References $conf, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), _validateMessage(), dol_is_dir(), dol_mkdir(), dol_move(), dol_now(), dol_sanitizeFileName(), and sanitizeVal().

◆ put()

Tickets::put ( $id,
$request_data = null )

Update ticket.

Parameters
int$idId of ticket to update
array$request_dataData @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Updated object

Definition at line 538 of file api_tickets.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValExtrafieldsForAPI(), DolibarrApi\_checkValForAPI(), and sanitizeVal().


The documentation for this class was generated from the following file: