Documentation

tab_tickets

Class tab_tickets

This class represents a ticket management system. It provides methods for retrieving, inserting, updating, and deleting ticket records from the database.

Table of Contents

Properties

$allowedCols  : array<string|int, mixed>
An array containing allowed column names.
$db  : db_tenant
The $db variable is an instance of the DatabaseConnection class.

Methods

__construct()  : mixed
Constructs a new instance of the class.
__destruct()  : void
Destructor method for cleaning up resources.
all()  : array<string|int, mixed>|bool
Retrieves all tickets from the database.
delete()  : bool
Delete a record from the 'tickets' table based on the specified value and column.
get()  : array<string|int, mixed>|bool
Retrieves a single ticket from the database based on the specified column and value.
getall()  : array<string|int, mixed>|bool
Retrieves all tickets from the database that match a specific value in a given column.
getoverduetickets()  : array<string|int, mixed>|bool
Retrieves overdue tickets from the database.
insert()  : int|string|bool
Insert a new record into the `tickets` table.
update()  : bool
Update a record in the 'tickets' table based on the specified column, value, and ticket ID.

Properties

$allowedCols

An array containing allowed column names.

protected array<string|int, mixed> $allowedCols = ['id', 'number', 'status', 'subject', 'customer', 'customername', 'customerno', 'tech', 'tech_old', 'created', 'modified', 'resubmission']

$db

The $db variable is an instance of the DatabaseConnection class.

protected db_tenant $db

It is used to establish a connection to the database and perform various database operations.

Methods

__construct()

Constructs a new instance of the class.

public __construct() : mixed

Sets the database connection object to the class instance.

__destruct()

Destructor method for cleaning up resources.

public __destruct() : void

This method is automatically called when the object is no longer referenced and destroyed. It cleans up any resources used by the object.

all()

Retrieves all tickets from the database.

public all([string $sort = 'id' ][, string $order = 'ASC' ][, string $statusactives = '0' ][, string $resubs = '0' ]) : array<string|int, mixed>|bool
Parameters
$sort : string = 'id'

The column to sort the tickets by. Default is 'id'.

$order : string = 'ASC'

The order in which to sort the tickets. Default is 'ASC'.

$statusactives : string = '0'

If set to '1', retrieves only active tickets. Default is '0'.

$resubs : string = '0'

If set to '1', retrieves only tickets with resubmission date greater than the current time. Default is '0'.

Return values
array<string|int, mixed>|bool

Returns an array of all tickets based on the given parameters, or false if there are no tickets.

delete()

Delete a record from the 'tickets' table based on the specified value and column.

public delete(string $val[, string $col = 'id' ]) : bool
Parameters
$val : string

The value of the record to be deleted.

$col : string = 'id'

The column to search for the record. Default is 'id'.

Return values
bool

Returns true if the record is deleted successfully, false otherwise.

get()

Retrieves a single ticket from the database based on the specified column and value.

public get(string $val[, string $col = 'number' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to match against the specified column.

$col : string = 'number'

(optional) The column to search for the specified value. Defaults to 'number'.

Return values
array<string|int, mixed>|bool

Returns an array of ticket record if the ticket is found, or false if the ticket does not exist.

getall()

Retrieves all tickets from the database that match a specific value in a given column.

public getall(string $val[, string $col = 'number' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to match in the specified column.

$col : string = 'number'

(optional) The column to search for the specified value. Defaults to 'number'.

Return values
array<string|int, mixed>|bool

Returns an array of ticket records if successful, or false if an error occurs.

getoverduetickets()

Retrieves overdue tickets from the database.

public getoverduetickets(string $uid[, string $grp = '1' ][, string $sort = 'resubmission' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
$uid : string

The ID of the technician.

$grp : string = '1'

The group ID. Default is '1'.

$sort : string = 'resubmission'

The column to sort the tickets by. Default is 'resubmission'.

$order : string = 'ASC'

The order in which to sort the tickets. Default is 'ASC'.

Return values
array<string|int, mixed>|bool

Returns an array of overdue tickets if there are any, or false if there are no overdue tickets.

insert()

Insert a new record into the `tickets` table.

public insert(string $number, string $statusid, string $subject, string $customerid, string $customerno, string $tech, string $resub[, string $customername = '' ]) : int|string|bool
Parameters
$number : string

The ticket number.

$statusid : string

The ticket status ID.

$subject : string

The ticket subject.

$customerid : string

The customer ID associated with the ticket.

$customerno : string

The customer number associated with the ticket.

$tech : string

The technician assigned to the ticket.

$resub : string

The ticket resubmission.

$customername : string = ''

The customer name associated with the ticket (optional).

Return values
int|string|bool

Returns the ID of the inserted record if successful, or false otherwise.

update()

Update a record in the 'tickets' table based on the specified column, value, and ticket ID.

public update(string $col, string $val, string $tid) : bool
Parameters
$col : string

The column to be updated.

$val : string

The new value for the specified column.

$tid : string

The ticket ID of the record to be updated.

Return values
bool

Returns true if the record is updated successfully, false otherwise.


        
On this page

Search results