Documentation

main

Class main

This class represents the main customer management functionality.

Table of Contents

Properties

$tcust  : tab_customers
$tdetails  : tab_customers_details

Methods

__construct()  : void
Constructor method.
__destruct()  : void
Clean up resources when the object is destroyed.
all()  : array<string|int, mixed>|bool
Retrieve all items.
delete()  : bool
Deletes a record from the customer table based on the given value and column.
detailsdelete()  : bool
Deletes details based on the given value and column from the customers details table.
detailsget()  : array<string|int, mixed>|bool
Retrieve details for a given value.
detailsinsert()  : bool
Inserts details of a customer into the details table.
detailsupdate()  : bool
Updates a record in the customers details table based on the given column, value, and customer ID.
get()  : array<string|int, mixed>|bool
Retrieve data for a given value.
getcustomersintickets()  : array<string|int, mixed>|bool
insert()  : string|bool
Inserts a new record into the database.
search()  : array<string|int, mixed>|bool
Searches for a given term.
update()  : bool
Updates a record in the customer table based on the given column, value, and customer ID.

Properties

$tcust

protected tab_customers $tcust

This variable represents the customer main information table.

Methods

__construct()

Constructor method.

public __construct() : void

Initializes the 'tcust' and 'tdetails' variables by creating instances of the 'tab_customers' and 'tab_customers_details' classes respectively.

__destruct()

Clean up resources when the object is destroyed.

public __destruct() : void

This method will unset the $tcust and $tdetails properties, freeing up any resources they may hold.

all()

Retrieve all items.

public all([string $type = '-1' ][, string $sort = 'number' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
$type : string = '-1'

(Optional) The type of items to retrieve. Default is '-1'.

$sort : string = 'number'

(Optional) The field to sort the items by. Default is 'number'.

$order : string = 'ASC'

(Optional) The order in which the items should be sorted. Default is 'ASC'.

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

An array of items if successful, or false on failure.

delete()

Deletes a record from the customer table based on the given value and column.

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

The value to match against the specified column.

$col : string = 'id'

The column to search for the specified value. Default is 'id'.

Return values
bool —

True if the record was successfully deleted, false otherwise.

detailsdelete()

Deletes details based on the given value and column from the customers details table.

public detailsdelete(string $val[, string $col = 'customer' ]) : bool
Parameters
$val : string

The value to be matched for deletion in the specified column.

$col : string = 'customer'

The column in the details table to search for the specified value. Default value is 'customer'.

Return values
bool —

Returns true if the deletion is successful, false otherwise.

detailsget()

Retrieve details for a given value.

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

The value to retrieve details for.

$col : string = 'customer'

The column to search for the value. Default is 'customer'.

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

The details for the given value as an array if found, otherwise false.

detailsinsert()

Inserts details of a customer into the details table.

public detailsinsert(string $cid, string $street, string $zip, string $city, string $phone, string $mobile[, string $country = '' ][, string $cost = '' ][, string $hours = '' ][, string $rate = '' ][, string $ah = '' ][, string $standby = '' ]) : bool
Parameters
$cid : string

The customer id.

$street : string

The customer's street address.

$zip : string

The customer's ZIP code.

$city : string

The customer's city.

$phone : string

The customer's phone number.

$mobile : string

The customer's mobile number.

$country : string = ''

The customer's country. Default is an empty string.

$cost : string = ''

The cost associated with the customer. Default is an empty string.

$hours : string = ''

The hours worked by the customer. Default is an empty string.

$rate : string = ''

The rate of the customer. Default is an empty string.

$ah : string = ''

The AH value of the customer. Default is an empty string.

$standby : string = ''

The standby value of the customer. Default is an empty string.

Return values
bool —

True if the details were successfully inserted, false otherwise.

detailsupdate()

Updates a record in the customers details table based on the given column, value, and customer ID.

public detailsupdate(string $col, string $val, string $cid) : bool
Parameters
$col : string

The column to update in the details table.

$val : string

The value to update in the specified column.

$cid : string

The ID of the customer whose record needs to be updated.

Return values
bool —

True if the record was successfully updated, false otherwise.

get()

Retrieve data for a given value.

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

The value to retrieve data for.

$col : string = 'id'

The column to search for the value. Default is 'number'.

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

The data for the given value as an array if found, otherwise false.

getcustomersintickets()

public getcustomersintickets([string $status = '' ]) : array<string|int, mixed>|bool
Parameters
$status : string = ''
Return values
array<string|int, mixed>|bool

insert()

Inserts a new record into the database.

public insert(string $type, string $number, string $name, string $email[, string $remail = '' ][, string $wk = '0' ]) : string|bool
Parameters
$type : string

The type of record.

$number : string

The number associated with the record.

$name : string

The name associated with the record.

$email : string

The email associated with the record.

$remail : string = ''

Optional. An alternate email associated with the record. Default is empty string.

$wk : string = '0'

Optional. The work number associated with the record. Default is '0'.

Return values
string|bool —

Returns a string value if the insertion was successful. Otherwise, returns false.

Searches for a given term.

public search(string $term) : array<string|int, mixed>|bool
Parameters
$term : string

The term to search for.

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

Returns an array of results if found, otherwise returns a boolean value.

update()

Updates a record in the customer table based on the given column, value, and customer ID.

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

The column to update in the customer table.

$val : string

The new value to set for the specified column.

$cid : string

The customer ID to identify the record to update.

Return values
bool —

True if the record was successfully updated, false otherwise.


        
On this page

Search results